| # Gaudi Framework, version v22r2 |

Home |  | Generated: Tue May 10 2011

Functions

# 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.

                                                             {
      IInterface* iface = Gaudi::createApplicationMgr();
      SmartIF<IProperty>     propMgr ( iface );
      SmartIF<IAppMgrUI>     appMgr  ( iface );

      if( !appMgr.isValid() || !propMgr.isValid() ) {
        std::cout << "Fatal error while creating the ApplicationMgr " << std::endl;
        return 1;
      }

      // Get the input configuration file from arguments
      std:: string opts = (argc>1) ? argv[1] : "jobOptions.txt";

      propMgr->setProperty( "JobOptionsPath", opts ).ignore();

      if( opts.substr( opts.length() - 3, 3 ) == ".py" ) {
        propMgr->setProperty( "EvtSel",         "NONE" ).ignore();
        propMgr->setProperty( "JobOptionsType", "NONE" ).ignore();
        propMgr->setProperty( "DLLs",           "['GaudiPython']" ).ignore();
        propMgr->setProperty( "Runable",        "PythonScriptingSvc" ).ignore();
      }

      // Run the application manager and process events
      StatusCode sc = appMgr->run();
      IntegerProperty returnCode("ReturnCode", 0);
      propMgr->getProperty(&returnCode).ignore();
      // Release Application Manager
      iface->release();
      // All done - exit
      if (sc.isFailure() && returnCode.value() == 0) {
        // propagate a valid error code in case of failure
        returnCode.setValue(1);
      }
      return returnCode.value();
    }

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines