Gaudi Framework, version v22r0

Home   Generated: 9 Feb 2011

GaudiMain.cpp

Go to the documentation of this file.
00001 // $Id: GaudiMain.cpp,v 1.4 2006/09/13 15:25:15 hmd Exp $
00002 //------------------------------------------------------------------------------
00003 //
00004 //  Description: Main Program for Gaudi applications
00005 //
00006 //------------------------------------------------------------------------------
00007 #include "GaudiKernel/SmartIF.h"
00008 #include "GaudiKernel/Bootstrap.h"
00009 #include "GaudiKernel/IAppMgrUI.h"
00010 #include "GaudiKernel/IProperty.h"
00011 #include "GaudiKernel/Property.h"
00012 #include "GaudiKernel/StatusCode.h"
00013 #include <iostream>
00014 
00015 extern "C" GAUDI_API int GaudiMain(int argc,char **argv) {
00016   IInterface* iface = Gaudi::createApplicationMgr();
00017   SmartIF<IProperty>     propMgr ( iface );
00018   SmartIF<IAppMgrUI>     appMgr  ( iface );
00019 
00020   if( !appMgr.isValid() || !propMgr.isValid() ) {
00021     std::cout << "Fatal error while creating the ApplicationMgr " << std::endl;
00022     return 1;
00023   }
00024 
00025   // Get the input configuration file from arguments
00026   std:: string opts = (argc>1) ? argv[1] : "jobOptions.txt";
00027 
00028   propMgr->setProperty( "JobOptionsPath", opts ).ignore();
00029 
00030   if( opts.substr( opts.length() - 3, 3 ) == ".py" ) {
00031     propMgr->setProperty( "EvtSel",         "NONE" ).ignore();
00032     propMgr->setProperty( "JobOptionsType", "NONE" ).ignore();
00033     propMgr->setProperty( "DLLs",           "['GaudiPython']" ).ignore();
00034     propMgr->setProperty( "Runable",        "PythonScriptingSvc" ).ignore();
00035   }
00036 
00037   // Run the application manager and process events
00038   StatusCode sc = appMgr->run();
00039   IntegerProperty returnCode("ReturnCode", 0);
00040   propMgr->getProperty(&returnCode).ignore();
00041   // Release Application Manager
00042   iface->release();
00043   // All done - exit
00044   if (sc.isFailure() && returnCode.value() == 0) {
00045     // propagate a valid error code in case of failure
00046     returnCode.setValue(1);
00047   }
00048   return returnCode.value();
00049 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Wed Feb 9 16:24:55 2011 for Gaudi Framework, version v22r0 by Doxygen version 1.6.2 written by Dimitri van Heesch, © 1997-2004