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>
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
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
00038 StatusCode sc = appMgr->run();
00039 IntegerProperty returnCode("ReturnCode", 0);
00040 propMgr->getProperty(&returnCode).ignore();
00041
00042 iface->release();
00043
00044 if (sc.isFailure() && returnCode.value() == 0) {
00045
00046 returnCode.setValue(1);
00047 }
00048 return returnCode.value();
00049 }