Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

GaudiMain.cpp

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/GlastSvc/src/test/GaudiMain.cpp,v 1.3 2001/04/19 01:32:31 igable Exp $
00002 #define COMMON_MAIN_CPP
00003 
00004 
00005 // Include files
00006 #include "GaudiKernel/SmartIF.h"
00007 #include "GaudiKernel/Bootstrap.h"
00008 #include "GaudiKernel/IAppMgrUI.h"
00009 #include "GaudiKernel/IProperty.h"
00010 #include "GaudiKernel/Property.h"
00011 #include "GaudiKernel/System.h"
00012 
00013 
00014 //------------------------------------------------------------------------------
00015 //
00016 //  Package    : Gaudi Examples
00017 //
00018 //  Description: Main Program
00019 //
00020 //------------------------------------------------------------------------------
00021 #ifndef WIN32
00022 void FATAL(const char* text){std::cerr << text << std::endl;}
00023 #endif // WIN32 
00024 
00025 
00026 //--- Example main program
00027 int main( int argn, char** argc) {
00028     
00029 
00030 
00031     // get the path to this package from its root environment variable: if not there,
00032     // assume that we are in the root
00033     const char * local_path = ::getenv("GLASTSVCROOT");
00034     
00035     std::string joboptions_file = std::string(local_path? local_path: "");
00036 
00037     joboptions_file +=  std::string("/src/test/jobOptions.txt");
00038     
00039     
00040     // Create an instance of an application manager
00041     IInterface* iface = Gaudi::createApplicationMgr();
00042     
00043     SmartIF<IProperty>     propMgr ( IID_IProperty, iface );
00044     SmartIF<IAppMgrUI>     appMgr  ( IID_IAppMgrUI, iface );
00045     
00046     // Set properties of algorithms and services
00047     StatusCode status = StatusCode::SUCCESS;
00048     if ( iface && propMgr == iface )    {
00049         status = propMgr->setProperty( StringProperty("JobOptionsPath", joboptions_file) );
00050     }
00051     else  {
00052         exit(-1);
00053     }
00054 
00055     
00056     // Run the application manager and process events
00057     if ( appMgr )   {
00058         status = appMgr->run();
00059     }
00060     else  {
00061         return 0;
00062     }
00063     
00064     // All done - exit
00065     return 0;
00066     
00067 }

Generated at Wed Nov 21 12:21:12 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000