| # Gaudi Framework, version v21r11 |

Home |  | Generated: 30 Sep 2010

# GaudiMain.cpp File Reference

`#include "GaudiKernel/SmartIF.h"`
`#include "GaudiKernel/Bootstrap.h"`
`#include "GaudiKernel/IAppMgrUI.h"`
`#include "GaudiKernel/IProperty.h"`
`#include "GaudiKernel/Property.h"`
`#include "GaudiKernel/StatusCode.h"`
`#include <iostream>`

Include dependency graph for GaudiMain.cpp:

Go to the source code of this file.

## Functions
GAUDI_API int | GaudiMain (int argc, char **argv)

## Function Documentation

GAUDI_API int GaudiMain | ( | int | argc,
|  | char ** | argv |
| ) |  |  |

Definition at line 15 of file GaudiMain.cpp.

    00015                                                          {
    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 }