eqNBody/main.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "client.h"
00019 #include "channel.h"
00020 #include "config.h"
00021 #include "node.h"
00022 #include "pipe.h"
00023 #include "window.h"
00024
00025 #include <eq/eq.h>
00026 #include <stdlib.h>
00027
00028 using namespace eq::base;
00029 using namespace std;
00030
00031 class NodeFactory : public eq::NodeFactory
00032 {
00033 public:
00034 virtual eq::Config* createConfig( eq::ServerPtr parent ) { return new eqNbody::Config( parent ); }
00035 virtual eq::Node* createNode( eq::Config* parent ) { return new eqNbody::Node( parent ); }
00036 virtual eq::Pipe* createPipe( eq::Node* parent ) { return new eqNbody::Pipe( parent ); }
00037 virtual eq::Window* createWindow( eq::Pipe* parent ) { return new eqNbody::Window( parent ); }
00038 virtual eq::Channel* createChannel( eq::Window* parent ) { return new eqNbody::Channel( parent ); }
00039 };
00040
00041 int main( const int argc, char** argv )
00042 {
00043 eqNbody::LocalInitData ld;
00044 NodeFactory nodeFactory;
00045
00046 if( !eq::init( argc, argv, &nodeFactory ))
00047 {
00048 EQERROR << "Equalizer init failed" << endl;
00049 return EXIT_FAILURE;
00050 }
00051
00052 RefPtr< eqNbody::Client > client = new eqNbody::Client( ld );
00053 if( !client->initLocal( argc, argv ))
00054 {
00055 EQERROR << "Can't init client" << endl;
00056 eq::exit();
00057 return EXIT_FAILURE;
00058 }
00059
00060
00061 if( client->init() != EXIT_SUCCESS ) {
00062 EQERROR << "Can't init client" << endl;
00063 eq::exit();
00064 return EXIT_FAILURE;
00065 }
00066
00067
00068 client->run();
00069
00070
00071 if( client->exit() != EXIT_SUCCESS ) {
00072 EQERROR << "Can't exit client" << endl;
00073 }
00074
00075 client->exitLocal();
00076 client = 0;
00077
00078 eq::exit();
00079 return EXIT_SUCCESS;
00080 }