| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

GaudiMain.cpp

Go to the documentation of this file.
00001 // $Id: GaudiMain.cpp,v 1.9 2009/01/26 12:24:10 cattanem Exp $
00002 //------------------------------------------------------------------------------
00003 //
00004 //  Package    : GaudiConf
00005 //
00006 //  Description: Main Program for Gaudi applications
00007 //               Sets up default job options path as ../options/job.opts
00008 //
00009 //------------------------------------------------------------------------------
00010 // Include files
00011 #include "GaudiKernel/SmartIF.h"
00012 #include "GaudiKernel/Bootstrap.h"
00013 #include "GaudiKernel/IAppMgrUI.h"
00014 #include "GaudiKernel/IProperty.h"
00015 #include "GaudiKernel/StatusCode.h"
00016 #include <iostream>
00017 
00018 //--- Example main program
00019 int main ( int argc, char** argv ) {
00020   // Create an instance of an application manager
00021   IInterface* iface = Gaudi::createApplicationMgr();
00022   SmartIF<IProperty>     propMgr ( iface );
00023   SmartIF<IAppMgrUI>     appMgr  ( iface );
00024 
00025   if( !appMgr.isValid() || !propMgr.isValid() ) {
00026     std::cout << "Fatal error while creating the ApplicationMgr " << std::endl;
00027     return 1;
00028   }
00029 
00030   // Get the input configuration file from arguments
00031   std:: string opts = (argc>1) ? argv[1] :  "";
00032 
00033   propMgr->setProperty( "JobOptionsPath", opts );
00034 
00035   // Set the program name and version using macros defined in compilation flags
00036 #if defined APPNAME
00037   propMgr->setProperty( "AppName",    APPNAME );
00038 #endif
00039 #if defined APPVERS
00040   propMgr->setProperty( "AppVersion", APPVERS );
00041 #endif
00042 
00043   if( opts != "" && opts.substr( opts.length() - 3, 3 ) == ".py" ) {
00044     propMgr->setProperty( "EvtSel",         "NONE" );
00045     propMgr->setProperty( "JobOptionsType", "NONE" );
00046     propMgr->setProperty( "DLLs",           "['GaudiPython']" );
00047     propMgr->setProperty( "Runable",        "PythonScriptingSvc" );
00048   }
00049 
00050   // Run the application manager and process events
00051   StatusCode sc=appMgr->run();
00052 
00053   // Release Application Manager
00054   iface->release();
00055 
00056   // All done - exit
00057   return (sc==StatusCode::SUCCESS)?0:1;  
00058 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:04:42 2011 for GaudiConf by doxygen 1.4.7