Equalizer
1.4.1
|
00001 00002 /* 00003 * Copyright (c) 2009, Philippe Robert <philippe.robert@gmail.com> 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * - Redistributions of source code must retain the above copyright notice, this 00009 * list of conditions and the following disclaimer. 00010 * - Redistributions in binary form must reproduce the above copyright notice, 00011 * this list of conditions and the following disclaimer in the documentation 00012 * and/or other materials provided with the distribution. 00013 * - Neither the name of Eyescale Software GmbH nor the names of its 00014 * contributors may be used to endorse or promote products derived from this 00015 * software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 * POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 00030 #include "client.h" 00031 #include "channel.h" 00032 #include "config.h" 00033 #include "node.h" 00034 #include "pipe.h" 00035 #include "window.h" 00036 00037 #include <eq/eq.h> 00038 #include <stdlib.h> 00039 00040 class NodeFactory : public eq::NodeFactory 00041 { 00042 public: 00043 virtual eq::Config* createConfig( eq::ServerPtr parent ) 00044 { return new eqNbody::Config( parent ); } 00045 virtual eq::Node* createNode( eq::Config* parent ) 00046 { return new eqNbody::Node( parent ); } 00047 virtual eq::Pipe* createPipe( eq::Node* parent ) 00048 { return new eqNbody::Pipe( parent ); } 00049 virtual eq::Window* createWindow( eq::Pipe* parent ) 00050 { return new eqNbody::Window( parent ); } 00051 virtual eq::Channel* createChannel( eq::Window* parent ) 00052 { return new eqNbody::Channel( parent ); } 00053 }; 00054 00055 int main( const int argc, char** argv ) 00056 { 00057 NodeFactory nodeFactory; 00058 00059 if( !eq::init( argc, argv, &nodeFactory )) 00060 { 00061 LBERROR << "Equalizer init failed" << std::endl; 00062 return EXIT_FAILURE; 00063 } 00064 00065 eqNbody::InitData id; 00066 lunchbox::RefPtr< eqNbody::Client > client = new eqNbody::Client( id ); 00067 if( !client->initLocal( argc, argv )) 00068 { 00069 LBERROR << "Can't init client" << std::endl; 00070 eq::exit(); 00071 return EXIT_FAILURE; 00072 } 00073 00074 // Init 00075 if( client->init() != EXIT_SUCCESS ) 00076 { 00077 LBERROR << "Can't init client" << std::endl; 00078 eq::exit(); 00079 return EXIT_FAILURE; 00080 } 00081 00082 // Run the simulation 00083 client->run(); 00084 00085 // Exit 00086 if( client->exit() != EXIT_SUCCESS ) 00087 { 00088 LBERROR << "Can't exit client" << std::endl; 00089 } 00090 00091 client->exitLocal(); 00092 client = 0; 00093 00094 eq::exit(); 00095 return EXIT_SUCCESS; 00096 }