Equalizer  1.6.1
eVolve/main.cpp
1 
2 /* Copyright (c) 2005-2009, 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;
65  return EXIT_FAILURE;
66  }
67 
68  // 2. parse arguments
69  eVolve::LocalInitData initData;
70  initData.parseArguments( argc, argv );
71 
72  // 3. initialization of local client node
73  lunchbox::RefPtr< eVolve::EVolve > client = new eVolve::EVolve( initData );
74  if( !client->initLocal( argc, argv ))
75  {
76  LBERROR << "Can't init client" << std::endl;
77  eq::exit();
79  return EXIT_FAILURE;
80  }
81 
82  // 4. run client
83  const int ret = client->run();
84 
85  // 5. cleanup and exit
86  client->exitLocal();
87 
88  LBASSERTINFO( client->getRefCount() == 1, "Client still referenced by " <<
89  client->getRefCount() - 1 );
90  client = 0;
91 
92  eq::exit();
94  return ret;
95 }
virtual eq::Window * createWindow(eq::Pipe *parent)
Create a new window.
Definition: eVolve/main.cpp:49
A configuration is a visualization session driven by an application.
virtual eq::Config * createConfig(eq::ServerPtr parent)
Create a new config.
Definition: eVolve/main.cpp:43
virtual eq::Node * createNode(eq::Config *parent)
Create a new node.
Definition: eVolve/main.cpp:45
A channel represents a two-dimensional viewport within a Window.
void exitErrors()
Clear eVolve-specific error codes.
A Window represents an on-screen or off-screen drawable.
virtual eq::Pipe * createPipe(eq::Node *parent)
Create a new pipe.
Definition: eVolve/main.cpp:47
A Node represents a single computer in the cluster.
A Pipe represents a graphics card (GPU) on a Node.
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
The node factory is a per-node singleton used to create and release Equalizer resource instances...
Definition: nodeFactory.h:36
bool init(const int argc, char **argv, NodeFactory *nodeFactory)
Initialize the Equalizer client library.
Definition: client/init.h:57
bool exit()
De-initialize the Equalizer client library.
void initErrors()
Set up eVolve-specific error codes.
virtual eq::Channel * createChannel(eq::Window *parent)
Create a new channel.
Definition: eVolve/main.cpp:51