The Gaudi Framework  v30r3 (a5ef0a68)
GaudiMain.cpp File Reference
#include "GaudiKernel/Bootstrap.h"
#include "GaudiKernel/IAppMgrUI.h"
#include "GaudiKernel/IProperty.h"
#include "GaudiKernel/Property.h"
#include "GaudiKernel/SmartIF.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 14 of file GaudiMain.cpp.

15 {
17  SmartIF<IAppMgrUI> appMgr( iface );
18  auto propMgr = appMgr.as<IProperty>();
19 
20  if ( !appMgr || !propMgr ) {
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.compare( opts.length() - 3, 3, ".py" ) == 0 ) {
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  Gaudi::Property<int> returnCode( "ReturnCode", 0 );
40  propMgr->getProperty( &returnCode ).ignore();
41  // Release Application Manager
42  propMgr.reset();
43  appMgr.reset();
44  // All done - exit
45  if ( sc.isFailure() && returnCode == 0 ) {
46  // propagate a valid error code in case of failure
47  returnCode.setValue( 1 );
48  }
49  return returnCode.value();
50 }
Implementation of property with value of concrete type.
Definition: Property.h:381
list argv
Definition: gaudirun.py:235
T endl(T...args)
bool isFailure() const
Definition: StatusCode.h:139
STL class.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
Definition of the basic interface.
Definition: IInterface.h:277
T length(T...args)
appMgr
Definition: IOTest.py:94
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:20
T compare(T...args)
GAUDI_API IAppMgrUI * createApplicationMgr(const std::string &dllname, const std::string &factname)