| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GaudiMain.cpp
Go to the documentation of this file.
1 // $Id: GaudiMain.cpp,v 1.4 2006/09/13 15:25:15 hmd Exp $
2 //------------------------------------------------------------------------------
3 //
4 // Description: Main Program for Gaudi applications
5 //
6 //------------------------------------------------------------------------------
7 #include "GaudiKernel/SmartIF.h"
8 #include "GaudiKernel/Bootstrap.h"
9 #include "GaudiKernel/IAppMgrUI.h"
10 #include "GaudiKernel/IProperty.h"
11 #include "GaudiKernel/Property.h"
12 #include "GaudiKernel/StatusCode.h"
13 #include <iostream>
14
15 extern "C" GAUDI_API int GaudiMain(int argc,char **argv) {
16 IInterface* iface = Gaudi::createApplicationMgr();
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 }