eqServer.cpp

00001 
00002 /* Copyright (c) 2006-2009, Stefan Eilemann <eile@equalizergraphics.com>
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #include "server.h"
00019 
00020 #include "global.h"
00021 #include "loader.h"
00022 
00023 #include <eq/net/global.h>
00024 #include <eq/net/init.h>
00025 
00026 #include <iostream>
00027 
00028 using namespace eq::server;
00029 using namespace eq::base;
00030 using namespace std;
00031 
00032 #define CONFIG "server{ config{ appNode{ pipe { window { viewport [ .25 .25 .5 .5 ] channel { name \"channel\" }}}} compound { channel \"channel\" wall { bottom_left [ -.8 -.5 -1 ] bottom_right [  .8 -.5 -1 ] top_left [ -.8  .5 -1 ] }}}}"
00033 
00034 int main( const int argc, char** argv )
00035 {
00036     eq::net::init( argc, argv );
00037     eq::net::Global::setDefaultPort( EQ_DEFAULT_PORT );
00038 
00039     Loader loader;
00040     RefPtr<Server> server;
00041 
00042     if( argc == 1 )
00043     {
00044         server = loader.parseServer( CONFIG );
00045     }
00046     else
00047     {
00048         server = loader.loadFile( argv[1] );
00049     }
00050 
00051     if( !server.isValid( ))
00052     {
00053         EQERROR << "Server load failed" << endl;
00054         return EXIT_FAILURE;
00055     }
00056 
00057     Loader::addOutputCompounds( server );
00058     Loader::addDestinationViews( server );
00059     Loader::addDefaultObserver( server );
00060 
00061     if( !server->initLocal( argc, argv ))
00062     {
00063         EQERROR << "Can't create listener for server, please consult log" 
00064                 << endl;
00065         return EXIT_FAILURE;
00066     }
00067 
00068     if( !server->run( ))
00069     {
00070         EQERROR << "Server did not run correctly, please consult log" << endl;
00071         return EXIT_FAILURE;
00072     }
00073 
00074     server->exitLocal();
00075 
00076     EQINFO << "Server ref count: " << server->getRefCount() << endl;
00077     return EXIT_SUCCESS;
00078 }
00079 
Generated on Mon Aug 10 18:58:32 2009 for Equalizer 0.9 by  doxygen 1.5.8