All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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.

15  {
17  SmartIF<IProperty> propMgr ( iface );
18  SmartIF<IAppMgrUI> appMgr ( iface );
19 
20  if( !appMgr.isValid() || !propMgr.isValid() ) {
21  std::cout << "Fatal error while creating the ApplicationMgr " << std::endl;
22  return 1;
23  }
24 
25  // Get the input configuration file from arguments
26  std:: string opts = (argc>1) ? argv[1] : "jobOptions.txt";
27 
28  propMgr->setProperty( "JobOptionsPath", opts ).ignore();
29 
30  if( opts.substr( opts.length() - 3, 3 ) == ".py" ) {
31  propMgr->setProperty( "EvtSel", "NONE" ).ignore();
32  propMgr->setProperty( "JobOptionsType", "NONE" ).ignore();
33  propMgr->setProperty( "DLLs", "['GaudiPython']" ).ignore();
34  propMgr->setProperty( "Runable", "PythonScriptingSvc" ).ignore();
35  }
36 
37  // Run the application manager and process events
38  StatusCode sc = appMgr->run();
39  IntegerProperty returnCode("ReturnCode", 0);
40  propMgr->getProperty(&returnCode).ignore();
41  // Release Application Manager
42  iface->release();
43  // All done - exit
44  if (sc.isFailure() && returnCode.value() == 0) {
45  // propagate a valid error code in case of failure
46  returnCode.setValue(1);
47  }
48  return returnCode.value();
49 }
GAUDI_API long argc()
Number of arguments passed to the commandline (==numCmdLineArgs()); just to match argv call...
Definition: System.cpp:526
list argv
Definition: gaudirun.py:192
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
dictionary opts
Definition: ana.py:111
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Definition of the basic interface.
Definition: IInterface.h:160
virtual unsigned long release()=0
Release Interface instance.
tuple appMgr
Definition: IOTest.py:83
GAUDI_API IAppMgrUI * createApplicationMgr(const std::string &dllname, const std::string &factname)