| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- File List
- File Members

# 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/StatusCode.h"
    00012 #include <iostream>
    00013
    00014 extern "C" int GaudiMain(int argc,char **argv) {
    00015   IInterface* iface = Gaudi::createApplicationMgr();
    00016   SmartIF<IProperty>     propMgr ( IID_IProperty, iface );
    00017   SmartIF<IAppMgrUI>     appMgr  ( IID_IAppMgrUI, iface );
    00018
    00019   if( !appMgr.isValid() || !propMgr.isValid() ) {
    00020     std::cout << "Fatal error while creating the ApplicationMgr " << std::endl;
    00021     return 1;
    00022   }
    00023
    00024   // Get the input configuration file from arguments
    00025   std:: string opts = (argc>1) ? argv[1] : "jobOptions.txt";
    00026
    00027   propMgr->setProperty( "JobOptionsPath", opts ).ignore();
    00028
    00029   if( opts.substr( opts.length() - 3, 3 ) == ".py" ) {
    00030     propMgr->setProperty( "EvtSel",         "NONE" ).ignore();
    00031     propMgr->setProperty( "JobOptionsType", "NONE" ).ignore();
    00032     propMgr->setProperty( "DLLs",           "['GaudiPython']" ).ignore();
    00033     propMgr->setProperty( "Runable",        "PythonScriptingSvc" ).ignore();
    00034   }
    00035
    00036   // Run the application manager and process events
    00037   StatusCode sc=appMgr->run();
    00038   // Release Application Manager
    00039   iface->release();
    00040   // All done - exit
    00041   return (sc.isSuccess())?0:1;
    00042 }