Equalizer  1.8.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
eVolve/main.cpp
1 
2 /* Copyright (c) 2005-2014, Stefan Eilemann <eile@equalizergraphics.com>
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * - Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  * - Redistributions in binary form must reproduce the above copyright notice,
10  * this list of conditions and the following disclaimer in the documentation
11  * and/or other materials provided with the distribution.
12  * - Neither the name of Eyescale Software GmbH nor the names of its
13  * contributors may be used to endorse or promote products derived from this
14  * software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #include "eVolve.h"
30 
31 #include "channel.h"
32 #include "config.h"
33 #include "error.h"
34 #include "node.h"
35 #include "pipe.h"
36 #include "window.h"
37 
38 #include <stdlib.h>
39 
40 class NodeFactory : public eq::NodeFactory
41 {
42 public:
44  { return new eVolve::Config( parent ); }
45  virtual eq::Node* createNode( eq::Config* parent )
46  { return new eVolve::Node( parent ); }
47  virtual eq::Pipe* createPipe( eq::Node* parent )
48  { return new eVolve::Pipe( parent ); }
49  virtual eq::Window* createWindow( eq::Pipe* parent )
50  { return new eVolve::Window( parent ); }
51  virtual eq::Channel* createChannel( eq::Window* parent )
52  { return new eVolve::Channel( parent ); }
53 };
54 
55 int main( const int argc, char** argv )
56 {
57  // 1. Equalizer initialization
58  NodeFactory nodeFactory;
60 
61  if( !eq::init( argc, argv, &nodeFactory ))
62  {
63  LBERROR << "Equalizer init failed" << std::endl;
64  eq::exit();
66  return EXIT_FAILURE;
67  }
68 
69  // 2. parse arguments
70  eVolve::LocalInitData initData;
71  initData.parseArguments( argc, argv );
72 
73  // 3. initialization of local client node
74  lunchbox::RefPtr< eVolve::EVolve > client = new eVolve::EVolve( initData );
75  if( !client->initLocal( argc, argv ))
76  {
77  LBERROR << "Can't init client" << std::endl;
78  eq::exit();
80  return EXIT_FAILURE;
81  }
82 
83  // 4. run client
84  const int ret = client->run();
85 
86  // 5. cleanup and exit
87  client->exitLocal();
88 
89  LBASSERTINFO( client->getRefCount() == 1, "Client still referenced by " <<
90  client->getRefCount() - 1 );
91  client = 0;
92 
93  eq::exit();
95  return ret;
96 }
A channel represents a two-dimensional viewport within a Window.
A configuration is a visualization session driven by an application.
A Pipe represents a graphics card (GPU) on a Node.
A Node represents a single computer in the cluster.
void exitErrors()
Clear eVolve-specific error codes.
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
A Window represents an on-screen or off-screen drawable.
virtual eq::Channel * createChannel(eq::Window *parent)
Create a new channel.
Definition: eVolve/main.cpp:51
virtual eq::Window * createWindow(eq::Pipe *parent)
Create a new window.
Definition: eVolve/main.cpp:49
bool init(const int argc, char **argv, NodeFactory *nodeFactory)
Initialize the Equalizer client library.
Definition: client/init.h:58
void initErrors()
Set up eVolve-specific error codes.
EQ_API bool exit()
De-initialize the Equalizer client library.
virtual eq::Node * createNode(eq::Config *parent)
Create a new node.
Definition: eVolve/main.cpp:45
virtual eq::Pipe * createPipe(eq::Node *parent)
Create a new pipe.
Definition: eVolve/main.cpp:47
The node factory is a per-node singleton used to create and release Equalizer resource instances...
Definition: nodeFactory.h:36
virtual eq::Config * createConfig(eq::ServerPtr parent)
Create a new config.
Definition: eVolve/main.cpp:43