| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Types | Private Attributes

# ApplicationMgr Class Reference

The Application Manager class. More...

`#include <ApplicationMgr.h>`

Inheritance diagram for ApplicationMgr:
[legend]
Collaboration diagram for ApplicationMgr:
[legend]

List of all members.

## Public Types
typedef std::list< std::pair < IService *, int > > | ListSvc
typedef std::list< std::string > | ListName
typedef std::vector< std::string > | VectorName
## Public Member Functions
| ApplicationMgr (IInterface *=0)
virtual | ~ApplicationMgr ()
virtual StatusCode | queryInterface (const InterfaceID &iid, void **pinterface)
virtual StatusCode | run ()
virtual StatusCode | configure ()
virtual StatusCode | terminate ()
virtual StatusCode | initialize ()
virtual StatusCode | start ()
virtual StatusCode | stop ()
virtual StatusCode | finalize ()
virtual StatusCode | nextEvent (int maxevt)
virtual const std::string & | name () const
| This is needed to avoid ambiguous calls to name()
virtual StatusCode | executeEvent (void *par)
| implementation of IEventProcessor::executeEvent(void*)
virtual StatusCode | executeRun (int evtmax)
| implementation of IEventProcessor::executeRun(int)
virtual StatusCode | stopRun ()
| implementation of IEventProcessor::stopRun()
virtual Gaudi::StateMachine::State | FSMState () const
virtual Gaudi::StateMachine::State | targetFSMState () const
virtual StatusCode | reinitialize ()
virtual StatusCode | restart ()
virtual StatusCode | sysInitialize ()
virtual StatusCode | sysStart ()
virtual StatusCode | sysStop ()
virtual StatusCode | sysFinalize ()
virtual StatusCode | sysReinitialize ()
virtual StatusCode | sysRestart ()
void | SIGoHandler (Property &theProp)
void | SIExitHandler (Property &theProp)
template<class I >
SmartIF< IComponentManager > & | getManager ()
SmartIF< ISvcManager > & | svcManager ()
SmartIF< IAlgManager > & | algManager ()
virtual SmartIF< ISvcLocator > & | serviceLocator () const
| Needed to locate the message service.
Property handlers
void | evtLoopPropertyHandler (Property &theProp)
StatusCode | decodeExtSvcNameList ()
StatusCode | decodeCreateSvcNameList ()
void | createSvcNameListHandler (Property &)
void | extSvcNameListHandler (Property &theProp)
StatusCode | decodeMultiThreadSvcNameList ()
void | multiThreadSvcNameListHandler (Property &theProp)
StatusCode | decodeDllNameList ()
void | dllNameListHandler (Property &theProp)
void | reflexDebugPropertyHandler (Property &theProp)
void | initLoopCheckHndlr (Property &)
## Protected Types
typedef std::map< unsigned long, SmartIF < IComponentManager > > | ManagersMap
| Typedef for the map of component managers, the key is the "id" field of the basic InterfaceID of the managed components.
## Protected Member Functions
StatusCode | declareMultiSvcType (const std::string &name, const std::string &type)
| declare one or more copies of svc type/name as determined by NoOfThreads
StatusCode | addMultiSvc (const Gaudi::Utils::TypeNameString &typeName, int prio)
| add one or more copies of svc type/name as determined by NoOfThreads
void | setServiceManager (ISvcManager *)
StatusCode | i_startup ()
| Internal startup routine.
StatusCode | GoToState (Gaudi::StateMachine::State state, bool ignoreFailures=false)
| Reach a state from current state (whichever it is) going through the correct transitions.
## Protected Attributes
ManagersMap | m_managers
| Map of known component managers.
StringArrayProperty | m_declaredManagers
| Property to declare the list of known managers.
SmartIF< ISvcManager > | m_svcManager
| Cached pointer to the manager of services.
SmartIF< IAlgManager > | m_algManager
| Cached pointer to the manager of algorithms.
DLLClassManager * | m_classManager
| Reference to the class manager.
SmartIF< ISvcLocator > | m_svcLocator
| Reference to its own service locator.
IntegerProperty | m_SIGo
| For SI's "Go" command via callback.
IntegerProperty | m_SIExit
| For SI's "Exit" command via callback.
StringArrayProperty | m_topAlgNameList
| List of top level algorithms names.
StringArrayProperty | m_outStreamNameList
| List of output stream names.
StringProperty | m_outStreamType
| Output stream type (obsolete?)
StringProperty | m_messageSvcType
| MessageSvc type.
StringProperty | m_jobOptionsSvcType
| JobOptionsSvc type.
ListSvc | m_topSvcList
| List of top level services.
ListName | m_topSvcNameList
| List of top level services names.
std::string | m_name
| Name.
Gaudi::StateMachine::State | m_state
| Internal State.
Gaudi::StateMachine::State | m_targetState
| Internal State.
VectorName | m_defServices
| Vector default services names.
VectorName | m_svcMapping
| Default mapping of services.
VectorName | m_svcOptMapping
| Default mapping of services.
PropertyMgr * | m_propertyMgr
| Reference to Property Manager.
SmartIF< IMessageSvc > | m_messageSvc
| Reference to the message service.
SmartIF< IRunable > | m_runable
| Reference to the runable object.
SmartIF< IEventProcessor > | m_processingMgr
| Reference to processing manager object.
SmartIF< IJobOptionsSvc > | m_jobOptionsSvc
| Reference to JobOption service.
int | m_evtMax
| Number of events to be processed.
StringArrayProperty | m_extSvcNameList
| List of external services names.
BooleanProperty | m_extSvcCreates
| LHCb or ATLAS defn of "ExtSvc".
StringArrayProperty | m_multiThreadSvcNameList
| List of external services names for which we want a copy per evt thread.
int | m_noOfEvtThreads
| no of multiThreadSvc copies
StringArrayProperty | m_dllNameList
| List of DDL's names.
std::string | m_jobOptionsType
| Source type (e.g. dbase, file...)
std::string | m_jobOptionsPath
| The "file" to look for properties.
std::string | m_runableType
| Runable type.
std::string | m_eventLoopMgr
| Processing manager type.
std::string | m_evtsel
| Event selection.
std::string | m_histPersName
| CGL: Name of the Hist Pers Svc.
int | m_outputLevel
| Message output level.
std::string | m_appName
| The name of the application.
std::string | m_appVersion
| The version of the application.
bool | m_actHistory
| Activate HistorySvc.
bool | m_codeCheck
| Activate StatusCode checking.
IntegerProperty | m_reflexDebugLevel
| Debug level for the reflex plugin system.
StringArrayProperty | m_createSvcNameList
BooleanProperty | m_auditTools
| Defaults for auditors.
BooleanProperty | m_auditSvcs
BooleanProperty | m_auditAlgs
std::map< std::string, std::string > | m_environment
| Environment variables to set.
BooleanProperty | m_loopCheck
| For ServiceMgr initialization loop checking.
BooleanProperty | m_stopOnSignal
| Property to enable/disable the "stop on signal" service (enabled by default).
BooleanProperty | m_stalledEventMonitoring
| Property to enable/disable the monitoring and reporting of stalled events (enabled by default).
bool | m_propertiesPrint
| flag to activate the printout of properties
IntegerProperty | m_returnCode
| Property to record the error conditions occurring during the running.
## Private Types
typedef CommonMessaging < implements4< IAppMgrUI, IEventProcessor, IService, IStateful > > | base_class
| Typedef to this class.
## Private Attributes
std::vector< std::string > | m_okDlls
| names of successfully loaded dlls

## Detailed Description

The Application Manager class.

The main purpose of the Application Manager is to steer any data processing application. This includes all data processing applications for LHCb data in all stages: simulation, reconstruction, analysis, high level triggers, etc. Specific implementations of the ApplicationMgr will be developed to cope with the different environments (on-line, off-line, interactive, batch, etc.).

Author:
  Pere Mato

Definition at line 47 of file ApplicationMgr.h.

## Member Typedef Documentation

typedef CommonMessaging<implements4<IAppMgrUI, IEventProcessor, IService, IStateful> > ApplicationMgr::base_class`[private]`

Typedef to this class.

Reimplemented from CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > >.

Definition at line 54 of file ApplicationMgr.h.

typedef std::list<std::string> ApplicationMgr::ListName

Definition at line 57 of file ApplicationMgr.h.

typedef std::list<std::pair<IService*,int> > ApplicationMgr::ListSvc

Definition at line 56 of file ApplicationMgr.h.

typedef std::map<unsigned long, SmartIF<IComponentManager> > ApplicationMgr::ManagersMap`[protected]`

Typedef for the map of component managers, the key is the "id" field of the basic InterfaceID of the managed components.

Definition at line 184 of file ApplicationMgr.h.

typedef std::vector<std::string> ApplicationMgr::VectorName

Definition at line 58 of file ApplicationMgr.h.

## Constructor & Destructor Documentation

ApplicationMgr::ApplicationMgr | ( | IInterface * | = `0` ) |

Definition at line 54 of file ApplicationMgr.cpp.

                                             : base_class() {
      // IInterface initialization
      addRef(); // Initial count set to 1

      // Initialize two basic services: messagesvc & joboptions
      m_messageSvc        = 0;
      m_jobOptionsSvc     = 0;

      // Instantiate component managers
      m_managers[IService::interfaceID().id()] = new ServiceManager(this);
      m_managers[IAlgorithm::interfaceID().id()] = new AlgorithmManager(this);

      m_svcLocator = svcManager();

      // Instantiate internal services
      // SvcLocator/Factory HAS to be already instantiated
      m_classManager = new DLLClassManager(this);
      m_propertyMgr  = new PropertyMgr(this);

      m_name  = "ApplicationMgr";
      m_state = Gaudi::StateMachine::OFFLINE;
      m_targetState = Gaudi::StateMachine::OFFLINE;

      m_propertyMgr->declareProperty("Go",            m_SIGo = 0 );
      m_propertyMgr->declareProperty("Exit",          m_SIExit = 0 );
      m_propertyMgr->declareProperty("Dlls",          m_dllNameList );
      m_propertyMgr->declareProperty("ExtSvc",        m_extSvcNameList );
      m_propertyMgr->declareProperty("CreateSvc",     m_createSvcNameList );
      m_propertyMgr->declareProperty("ExtSvcCreates", m_extSvcCreates=true );

      m_propertyMgr->declareProperty("SvcMapping",    m_svcMapping );
      m_propertyMgr->declareProperty("SvcOptMapping", m_svcOptMapping );

      m_propertyMgr->declareProperty("TopAlg",        m_topAlgNameList );
      m_propertyMgr->declareProperty("OutStream",     m_outStreamNameList );
      m_propertyMgr->declareProperty("OutStreamType", m_outStreamType = "OutputStream" );
      m_propertyMgr->declareProperty("MessageSvcType",m_messageSvcType= "MessageSvc" );
      m_propertyMgr->declareProperty("JobOptionsSvcType",
                                     m_jobOptionsSvcType = "JobOptionsSvc" );
      m_propertyMgr->declareProperty( s_runable,      m_runableType   = "AppMgrRunable");
      m_propertyMgr->declareProperty( s_eventloop,    m_eventLoopMgr  = "EventLoopMgr");

      m_propertyMgr->declareProperty("HistogramPersistency", m_histPersName="NONE");

      // Declare Job Options Service properties and set default
      m_propertyMgr->declareProperty("JobOptionsType", m_jobOptionsType = "FILE");
      m_propertyMgr->declareProperty("JobOptionsPath", m_jobOptionsPath = "");
      m_propertyMgr->declareProperty("EvtMax",         m_evtMax = -1);
      m_propertyMgr->declareProperty("EvtSel",         m_evtsel );
      m_propertyMgr->declareProperty("OutputLevel",    m_outputLevel = MSG::INFO);

      m_propertyMgr->declareProperty("MultiThreadExtSvc", m_multiThreadSvcNameList);
      m_propertyMgr->declareProperty("NoOfThreads",    m_noOfEvtThreads = 0);
      m_propertyMgr->declareProperty("AppName",        m_appName = "ApplicationMgr");
      m_propertyMgr->declareProperty("AppVersion",     m_appVersion = "");

      m_propertyMgr->declareProperty("AuditTools",      m_auditTools = false);
      m_propertyMgr->declareProperty("AuditServices",   m_auditSvcs = false);
      m_propertyMgr->declareProperty("AuditAlgorithms", m_auditAlgs = false);

      m_propertyMgr->declareProperty("ActivateHistory", m_actHistory = false);
      m_propertyMgr->declareProperty("StatusCodeCheck", m_codeCheck = false);

      m_propertyMgr->declareProperty("Environment",    m_environment);

      // ServiceMgr Initialization loop checking
      m_propertyMgr->declareProperty("InitializationLoopCheck", m_loopCheck = true)
        ->declareUpdateHandler(&ApplicationMgr::initLoopCheckHndlr, this);
      svcManager()->setLoopCheckEnabled(m_loopCheck);

      // Flag to activate the printout of properties
      m_propertyMgr->declareProperty
        ( "PropertiesPrint",
          m_propertiesPrint = false,
          "Flag to activate the printout of properties" );

      m_propertyMgr->declareProperty("ReflexPluginDebugLevel", m_reflexDebugLevel = 0 );

      m_propertyMgr->declareProperty("StopOnSignal", m_stopOnSignal = false,
          "Flag to enable/disable the signal handler that schedule a stop of the event loop");

      m_propertyMgr->declareProperty("StalledEventMonitoring", m_stalledEventMonitoring = false,
          "Flag to enable/disable the monitoring and reporting of stalled events");

      m_propertyMgr->declareProperty("ReturnCode", m_returnCode = 0,
          "Return code of the application. Set internally in case of error conditions.");

      // Add action handlers to the appropriate properties
      m_SIGo.declareUpdateHandler  ( &ApplicationMgr::SIGoHandler         , this );
      m_SIExit.declareUpdateHandler( &ApplicationMgr::SIExitHandler       , this );
      m_topAlgNameList.declareUpdateHandler(&ApplicationMgr::evtLoopPropertyHandler, this);
      m_outStreamNameList.declareUpdateHandler(&ApplicationMgr::evtLoopPropertyHandler, this);
      m_outStreamType.declareUpdateHandler(&ApplicationMgr::evtLoopPropertyHandler, this);
      m_reflexDebugLevel.declareUpdateHandler(&ApplicationMgr::reflexDebugPropertyHandler, this);
      m_svcMapping.push_back("EvtDataSvc/EventDataSvc");
      m_svcMapping.push_back("DetDataSvc/DetectorDataSvc");
      m_svcMapping.push_back("HistogramSvc/HistogramDataSvc");
      m_svcMapping.push_back("HbookCnv::PersSvc/HbookHistSvc");
      m_svcMapping.push_back("RootHistCnv::PersSvc/RootHistSvc");
      m_svcMapping.push_back("EvtPersistencySvc/EventPersistencySvc");
      m_svcMapping.push_back("DetPersistencySvc/DetectorPersistencySvc");
      m_svcMapping.push_back("HistogramPersistencySvc/HistogramPersistencySvc");
    }

ApplicationMgr::~ApplicationMgr | ( | ) | `[virtual]`

Definition at line 161 of file ApplicationMgr.cpp.

                                    {
      if( m_classManager ) m_classManager->release();
      if( m_propertyMgr ) m_propertyMgr->release();
      if( m_messageSvc ) m_messageSvc->release();
      if( m_jobOptionsSvc ) m_jobOptionsSvc->release();
    }

## Member Function Documentation

StatusCode ApplicationMgr::addMultiSvc | ( | const Gaudi::Utils::TypeNameString & | typeName,
|  | int | prio
| ) |  | `[protected]`

add one or more copies of svc type/name as determined by NoOfThreads

Definition at line 1162 of file ApplicationMgr.cpp.

                                                     {
      using Gaudi::Utils::TypeNameString;
      StatusCode result = StatusCode::SUCCESS;
      MsgStream log( m_messageSvc, m_name );
      if (0 == m_noOfEvtThreads) {
        result = svcManager()->addService(typeName, prio);
        // result = svcManager()->addService(name, type, prio); // CHECKME???
        if( result.isFailure() ) {
          log << MSG::ERROR << "addMultiSvc: Cannot add service "
              << typeName.type() << "/" << typeName.name() << endmsg;
        } else {
          ON_VERBOSE
            log << MSG::VERBOSE << "addMultiSvc: added service "
                << typeName.type() << "/" << typeName.name() << endmsg;
        }
      } else {
        for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) {
          const std::string &type = typeName.type();
          std::string thrName(typeName.name() + getGaudiThreadIDfromID(iCopy));
          result = svcManager()->addService(TypeNameString(thrName, type), prio);
          if( result.isFailure() ) {
            log << MSG::ERROR << "addMultiSvc: Cannot add service "
                << type << "/" << thrName << endmsg;
          } else {
            ON_VERBOSE
              log << MSG::VERBOSE << "addMultiSvc: added service "
                  << type << "/" << thrName << endmsg;
          }
        }
      }
      return result;
    }

SmartIF<IAlgManager>& ApplicationMgr::algManager | ( | ) | `[inline]`

Definition at line 149 of file ApplicationMgr.h.

                                                {
        // Cache the casted pointer to IAlgManager
        if (!m_algManager) {
          m_algManager = getManager<IAlgorithm>();
        }
        return m_algManager;
      }

StatusCode ApplicationMgr::configure | ( | ) | `[virtual]`

Definition at line 303 of file ApplicationMgr.cpp.

                                         {
      // Check if the state is compatible with the transition
      MsgStream tlog( m_messageSvc, name() );
      if( Gaudi::StateMachine::CONFIGURED == m_state ) {
        tlog << MSG::INFO << "Already Configured" << endmsg;
        return StatusCode::SUCCESS;
      }
      else if( Gaudi::StateMachine::OFFLINE != m_state ) {
        tlog << MSG::FATAL
             << "configure: Invalid state \""  << m_state << "\"" << endmsg;
        return StatusCode::FAILURE;
      }
      m_targetState = Gaudi::StateMachine::CONFIGURED;

      StatusCode  sc;
      sc = i_startup();
      if ( !sc.isSuccess() )    {
        return sc;
      }

      MsgStream log( m_messageSvc, name() );

      // Get my own options using the Job options service
      if (log.level() <= MSG::DEBUG)
        log << MSG::DEBUG << "Getting my own properties" << endmsg;
      sc = m_jobOptionsSvc->setMyProperties( name(), m_propertyMgr );
      if( !sc.isSuccess() ) {
        log << MSG::WARNING << "Problems getting my properties from JobOptionsSvc"
            << endmsg;
        return sc;
      }

      // Check current outputLevel to eventually inform the MessageSvc
      if( m_outputLevel != MSG::NIL && !m_appName.empty() ) {
        assert(m_messageSvc != 0);
        m_messageSvc->setOutputLevel( name(), m_outputLevel );
        // Print a welcome message
        log << MSG::ALWAYS
            << std::endl
            << "=================================================================="
            << "=================================================================="
            << std::endl
            << "                                "
            << "                   Welcome to " << m_appName;

        if( "" != m_appVersion ) {
          log << MSG::ALWAYS << " version " << m_appVersion;
        }
        else {
          log << MSG::ALWAYS
              << "(GaudiCoreSvc "
              << "v" << GAUDICORESVC_MAJOR_VERSION
              << "r" << GAUDICORESVC_MINOR_VERSION
    #if GAUDICORESVC_PATCH_VERSION
              << "p" << GAUDICORESVC_PATCH_VERSION
    #endif
              << ")";
        }

        // Add the host name and current time to the message
        log << MSG::ALWAYS
            << std::endl
            << "                                "
            << "          running on " << System::hostName()
            << " on " << Gaudi::Time::current().format(true) << std::endl
            << "=================================================================="
            << "=================================================================="
            << endmsg;
      }

      // print all own properties if the options "PropertiesPrint" is set to true
      if ( m_propertiesPrint )
      {
        typedef std::vector<Property*> Properties;
        const Properties& properties = m_propertyMgr->getProperties() ;
        log << MSG::ALWAYS
            << "List of ALL properties of "
            << System::typeinfoName ( typeid( *this ) ) << "/" << this->name()
            << "  #properties = " << properties.size() << endmsg ;
        for ( Properties::const_iterator property = properties.begin() ;
              properties.end() != property ; ++property )
        { log << "Property ['Name': Value] = " << ( **property) << endmsg ; }
      }

      // Check if StatusCode need to be checked
      if (m_codeCheck) {
        StatusCode::enableChecking();
        sc = addMultiSvc("StatusCodeSvc", -9999);
        if ( sc.isFailure() ) {
          log << MSG::FATAL << "Error adding StatusCodeSvc for multiple threads" << endmsg;
          return StatusCode::FAILURE;
        }
      } else {
        StatusCode::disableChecking();
      }

      // set the requested environment variables
      std::map<std::string,std::string>::iterator var;
      for ( var = m_environment.begin(); var != m_environment.end(); ++var ) {
        const std::string &name  = var->first;
        const std::string &value = var->second;
        std::string old = System::getEnv(name.c_str());
        const MSG::Level lvl = (!old.empty() && (old != "UNKNOWN" ))
            ? MSG::WARNING
            : MSG::DEBUG;
        if (UNLIKELY(m_outputLevel <= lvl))
          log << lvl << "Setting " << name << " = " << value << endmsg;
        System::setEnv(name,value);
      }

      //Declare Service Types
      VectorName::const_iterator j;
      for(j=m_svcMapping.begin(); j != m_svcMapping.end(); ++j)  {
        Gaudi::Utils::TypeNameString itm(*j);
        if ( declareMultiSvcType(itm.name(), itm.type()).isFailure() )  {
          log << MSG::ERROR << "configure: declaring svc type:'" << *j << "' failed." << endmsg;
          return StatusCode::FAILURE;
        }
      }
      for(j=m_svcOptMapping.begin(); j != m_svcOptMapping.end(); ++j)  {
        Gaudi::Utils::TypeNameString itm(*j);
        if ( declareMultiSvcType(itm.name(), itm.type()).isFailure() )  {
          log << MSG::ERROR << "configure: declaring svc type:'" << *j << "' failed." << endmsg;
          return StatusCode::FAILURE;
        }
      }

      //--------------------------------------------------------------------------
      // Declare other Services and Algorithms by loading DLL's
      sc = decodeDllNameList( );
      if ( sc.isFailure( ) ) {
        log << MSG::ERROR << "Failure loading declared DLL's" << endmsg;
        return sc;
      }

      //--------------------------------------------------------------------------
      // Deal with the services explicitely declared by the user.
      sc = decodeExtSvcNameList();
      if ( sc.isFailure( ) ) {
        log << MSG::ERROR << "Failure during external service association" << endmsg;
        return sc;
      }

      sc = decodeMultiThreadSvcNameList( );
      if ( sc.isFailure( ) ) {
        log << MSG::ERROR << "Failure during multi thread service creation"
            << endmsg;
        return sc;
      }

      sc = decodeCreateSvcNameList();
      if ( sc.isFailure( ) ) {
        log << MSG::ERROR << "Failure during external service creation" << endmsg;
        return sc;
      }

      //--------------------------------------------------------------------------
      // Retrieve intrinsic services. If needed configure them.
      //--------------------------------------------------------------------------
      Gaudi::Utils::TypeNameString evtloop_item(m_eventLoopMgr);
      sc = addMultiSvc(evtloop_item, 100);
      if( !sc.isSuccess() )  {
        log << MSG::FATAL << "Error adding :" << m_eventLoopMgr << endmsg;
        return sc;
      }

      if (m_noOfEvtThreads == 0) {
        m_runable = m_svcLocator->service(m_runableType);
        if( !m_runable.isValid() )  {
          log << MSG::FATAL
              << "Error retrieving Runable:" << m_runableType
              << "\n Check option ApplicationMgr." << s_runable << endmsg;
          return sc;
        }
        m_processingMgr = m_svcLocator->service(evtloop_item);
        if( !m_processingMgr.isValid() )  {
          log << MSG::FATAL
              << "Error retrieving Processing manager:" << m_eventLoopMgr
              << "\n Check option ApplicationMgr." << s_eventloop
              << "\n No events will be processed." << endmsg;
          return sc;
        }
      }

      // Establish Update Handlers for ExtSvc and DLLs Properties
      m_extSvcNameList.declareUpdateHandler (&ApplicationMgr::extSvcNameListHandler,
                                             this);
      m_createSvcNameList.declareUpdateHandler (&ApplicationMgr::createSvcNameListHandler,
                                             this);
      m_multiThreadSvcNameList.declareUpdateHandler
        (&ApplicationMgr::multiThreadSvcNameListHandler, this);
      m_dllNameList.declareUpdateHandler (&ApplicationMgr::dllNameListHandler,
                                          this );

      if (m_actHistory) {
        // Create HistorySvc with a priority to ensure it's initialized last, finalized first
        sc = svcManager()->addService("HistorySvc",std::numeric_limits<int>::max());
        if ( sc.isFailure() ) {
          log << MSG::FATAL << "Error adding HistorySvc" << endmsg;
          return StatusCode::FAILURE;
        }

        if (m_noOfEvtThreads > 0) {
          sc = addMultiSvc("HistorySvc",std::numeric_limits<int>::max());
          if ( sc.isFailure() ) {
            log << MSG::FATAL << "Error adding HistorySvc for multiple threads"
                << endmsg;
            return StatusCode::FAILURE;
          }
        }
      }

      log << MSG::INFO << "Application Manager Configured successfully" << endmsg;
      m_state = m_targetState;
      return StatusCode::SUCCESS;
    }

void ApplicationMgr::createSvcNameListHandler | ( | Property & | ) |

Definition at line 1011 of file ApplicationMgr.cpp.

                                                                           {
      if ( !(decodeCreateSvcNameList()).isSuccess() ) {
        throw GaudiException("Failed to create ext services",
                             "MinimalEventLoopMgr::createSvcNameListHandler",
                             StatusCode::FAILURE);
      }
    }

StatusCode ApplicationMgr::declareMultiSvcType | ( | const std::string & | name,
|  | const std::string & | type
| ) |  | `[protected]`

declare one or more copies of svc type/name as determined by NoOfThreads

Definition at line 1129 of file ApplicationMgr.cpp.

                                                                          {
      StatusCode result = StatusCode::SUCCESS;
      MsgStream log( m_messageSvc, m_name );
      if (0 == m_noOfEvtThreads) {
        result = svcManager()->declareSvcType(name, type);
        if( result.isFailure() ) {
          log << MSG::ERROR << "declareMultiSvcType: Cannot declare service "
              << type << "/" << name << endmsg;
        } else {
          ON_VERBOSE
            log << MSG::VERBOSE << "declareMultiSvcType: declared service "
                << type << "/" << name << endmsg;
        }
      } else {
        for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) {
          std::string thrName(name + getGaudiThreadIDfromID(iCopy));
          result = svcManager()->declareSvcType(thrName, type);
          if( result.isFailure() ) {
            log << MSG::ERROR << "declareMultiSvcType: Cannot declare service "
                << type << "/" << thrName << endmsg;
          } else {
            ON_VERBOSE
              log << MSG::VERBOSE << "declareMultiSvcType: declared service "
                  << type << "/" << thrName << endmsg;
          }
        }
      }
      return result;
    }

StatusCode ApplicationMgr::decodeCreateSvcNameList | ( | ) |

Definition at line 1021 of file ApplicationMgr.cpp.

                                                       {
      StatusCode result = StatusCode::SUCCESS;
      const std::vector<std::string>& theNames = m_createSvcNameList.value( );
      VectorName::const_iterator it(theNames.begin());
      VectorName::const_iterator et(theNames.end());
      while(result.isSuccess() && it != et) {
        Gaudi::Utils::TypeNameString item(*it++);
        if( (result = svcManager()->addService(item, 10) ).isFailure()) {
          MsgStream log( m_messageSvc, m_name );
          log << MSG::ERROR << "decodeCreateSvcNameList: Cannot create service "
              << item.type() << "/" << item.name() << endmsg;
        } else {
          ON_DEBUG {
            MsgStream log( m_messageSvc, m_name );
            log << MSG::DEBUG << "decodeCreateSvcNameList: Created service "
                << item.type() << "/" << item.name() << endmsg;
          }
        }
      }
      return result;
    }

StatusCode ApplicationMgr::decodeDllNameList | ( | ) |

Definition at line 1210 of file ApplicationMgr.cpp.

                                                 {

      MsgStream log( m_messageSvc, m_name );
      StatusCode result = StatusCode::SUCCESS;

      // Clean up multiple entries from DLL list
      // -------------------------------------------------------------------------
      std::vector<std::string> newList;
      std::map<std::string,unsigned int> dllInList, duplicateList;
      {for ( std::vector<std::string>::const_iterator it = m_dllNameList.value().begin();
            it != m_dllNameList.value().end(); ++it ) {
        if ( 0 == dllInList[*it] ) {
          newList.push_back(*it);        // first instance of this module
        } else { ++duplicateList[*it]; } // module listed multiple times
        ++dllInList[*it];                // increment count for this module
      }}
      //m_dllNameList = newList; // update primary list to new, filtered list (do not use the
                                 // property itself otherwise we get called again infinitely)
      // List modules that were in there twice..
      ON_DEBUG if ( !duplicateList.empty() ) {
        log << MSG::DEBUG << "Removed duplicate entries for modules : ";
        for ( std::map<std::string,unsigned int>::const_iterator it = duplicateList.begin();
              it != duplicateList.end(); ++it ) {
          log << it->first << "(" << 1+it->second << ")";
          if ( it != --duplicateList.end() ) log << ", ";
        }
        log << endmsg;
      }
      // -------------------------------------------------------------------------

      const std::vector<std::string>& theNames = newList;

      // only load the new dlls or previously failed dlls
      ON_DEBUG log << MSG::DEBUG << "Loading declared DLL's" << endmsg;

      std::vector<std::string> successNames, failNames;
      std::vector<std::string>::const_iterator it;

      for (it = theNames.begin(); it != theNames.end(); it++) {
        if (std::find (m_okDlls.rbegin(), m_okDlls.rend(), *it) == m_okDlls.rend()){
          // found a new module name
          StatusCode status = m_classManager->loadModule( (*it) );
          if( status.isFailure() ) {
            failNames.push_back(*it);
            result = StatusCode::FAILURE;
          }
          else {
            successNames.push_back(*it);
          }
        }
      }

      // report back to the user and store the names of the succesfully loaded dlls
      if ( !successNames.empty() ) {
        log << MSG::INFO << "Successfully loaded modules : ";
        for (it = successNames.begin(); it != successNames.end(); it++) {
          log<< (*it);
          if( (it+1) != successNames.end())  log << ", ";
          // save name
          m_okDlls.push_back( *it );
        }
        log << endmsg;
      }

      if ( result == StatusCode::FAILURE ) {
        log << MSG::WARNING << "Failed to load modules: ";
        for (it = failNames.begin(); it != failNames.end(); it++) {
          log<< (*it);
          if( (it+1) != failNames.end())  log << ", ";
        }
        log << endmsg;
      }
      return result;
    }

StatusCode ApplicationMgr::decodeExtSvcNameList | ( | ) |

Definition at line 1057 of file ApplicationMgr.cpp.

                                                     {
      StatusCode result = StatusCode::SUCCESS;

      std::vector<std::string> theNames = m_extSvcNameList.value( );

      VectorName::const_iterator it(theNames.begin());
      VectorName::const_iterator et(theNames.end());
      while(result.isSuccess() && it != et) {
        Gaudi::Utils::TypeNameString item(*it++);
        if (m_extSvcCreates == true) {
          if ( (result = svcManager()->addService(item, 10)).isFailure()) {
            MsgStream log( m_messageSvc, m_name );
            log << MSG::ERROR << "decodeExtSvcNameList: Cannot create service "
                << item.type() << "/" << item.name() << endmsg;
          }
        } else {
          if( ( result = svcManager()->declareSvcType(item.name(),
                                                      item.type()) ).isFailure()) {
            MsgStream log( m_messageSvc, m_name );
            log << MSG::ERROR << "decodeExtSvcNameList: Cannot declare service "
                << item.type() << "/" << item.name() << endmsg;
          }
        }
      }
      return result;
    }

StatusCode ApplicationMgr::decodeMultiThreadSvcNameList | ( | ) |

Definition at line 1099 of file ApplicationMgr.cpp.

                                                             {
      StatusCode result = StatusCode::SUCCESS;
      const std::vector<std::string>& theNames = m_multiThreadSvcNameList.value( );
      for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) {
        for (VectorName::const_iterator it = theNames.begin();
             it != theNames.end();
             ++it) {
          Gaudi::Utils::TypeNameString item(*it);
          result = addMultiSvc(item, 10);
          //FIXME SHOULD CLONE?
          if( result.isFailure() ) {
            MsgStream log( m_messageSvc, m_name );
            log << MSG::ERROR
                << "decodeMultiThreadSvcNameList: Cannot create service "
                << item.type() << "/" << item.name() << endmsg;
          } else {
            ON_VERBOSE {
              MsgStream log( m_messageSvc, m_name );
              log << MSG::VERBOSE
                  << "decodeMultiThreadSvcNameList: created service "
                  << item.type() << "/" << item.name() << endmsg;
            }
          }
        }
      }
      return result;
    }

void ApplicationMgr::dllNameListHandler | ( | Property & | theProp ) |

Definition at line 1199 of file ApplicationMgr.cpp.

                                                                     {
      if ( !(decodeDllNameList( )).isSuccess() ) {
        throw GaudiException("Failed to load DLLs.",
                             "MinimalEventLoopMgr::dllNameListHandler",
                             StatusCode::FAILURE);
      }
    }

void ApplicationMgr::evtLoopPropertyHandler | ( | Property & | theProp ) |

Definition at line 999 of file ApplicationMgr.cpp.

                                                             {
      if ( m_processingMgr.isValid() )    {
        SmartIF<IProperty> props(m_processingMgr);
        if ( props.isValid() )    {
          props->setProperty( p ).ignore();
        }
      }
    }

StatusCode ApplicationMgr::executeEvent | ( | void * | par ) | `[virtual]`

implementation of IEventProcessor::executeEvent(void*)

Definition at line 873 of file ApplicationMgr.cpp.

                                                        {
      MsgStream log( m_messageSvc, name() );
      if( m_state == Gaudi::StateMachine::RUNNING ) {
        if ( m_processingMgr.isValid() )    {
          return m_processingMgr->executeEvent(par);
        }
      }
      log << MSG::FATAL << "executeEvent: Invalid state \"" << FSMState() << "\""
          <<endmsg;
      return StatusCode::FAILURE;
    }

StatusCode ApplicationMgr::executeRun | ( | int | evtmax ) | `[virtual]`

implementation of IEventProcessor::executeRun(int)

Definition at line 888 of file ApplicationMgr.cpp.

                                                       {
      MsgStream log( m_messageSvc, name() );
      if( m_state == Gaudi::StateMachine::RUNNING ) {
        if ( m_processingMgr.isValid() )    {
          return m_processingMgr->executeRun(evtmax);
        }
        log << MSG::WARNING << "No EventLoop Manager specified " << endmsg;
        return StatusCode::SUCCESS;
      }
      log << MSG::FATAL << "executeRun: Invalid state \"" << FSMState() << "\""
          << endmsg;
      return StatusCode::FAILURE;
    }

void ApplicationMgr::extSvcNameListHandler | ( | Property & | theProp ) |

Definition at line 1046 of file ApplicationMgr.cpp.

                                                                        {
      if ( !(decodeExtSvcNameList( )).isSuccess() ) {
        throw GaudiException("Failed to declare ext services",
                             "MinimalEventLoopMgr::extSvcNameListHandler",
                             StatusCode::FAILURE);
      }
    }

StatusCode ApplicationMgr::finalize | ( | ) | `[virtual]`

Definition at line 669 of file ApplicationMgr.cpp.

                                        {
      MsgStream log( m_messageSvc, name() );
      if( m_state == Gaudi::StateMachine::CONFIGURED ) {
        log << MSG::INFO << "Already Finalized" << endmsg;
        return StatusCode::SUCCESS;
      }
      else if( m_state != Gaudi::StateMachine::INITIALIZED ) {
        log << MSG::FATAL << "finalize: Invalid state \"" << m_state << "\""
            << endmsg;
        return StatusCode::FAILURE;
      }
      m_targetState = Gaudi::StateMachine::CONFIGURED;

      // disable message suppression in finalize
      m_svcLocator->service<IProperty>("MessageSvc")->setProperty(BooleanProperty("enableSuppression", false)).ignore();

      // Finalize independently managed Algorithms
      StatusCode sc = algManager()->finalize();
      if (sc.isFailure()) {
        log << MSG::WARNING << "Failed to finalize an algorithm." << endmsg;
        m_returnCode = Gaudi::ReturnCode::FinalizationFailure;
      }

      // Finalize all Services
      sc = svcManager()->finalize();
      if (sc.isFailure()) {
        log << MSG::WARNING << "Failed to finalize a service." << endmsg;
        m_returnCode = Gaudi::ReturnCode::FinalizationFailure;
      }

      //svcManager()->removeService( (IService*) m_processingMgr.get() );
      //svcManager()->removeService( (IService*) m_runable.get() );

      if (m_codeCheck) {
        StatusCode::disableChecking();
      }

      if (sc.isSuccess()) {
        log << MSG::INFO << "Application Manager Finalized successfully" << endmsg;
      } else {
        log << MSG::ERROR << "Application Manager failed to finalize" << endmsg;
      }

      m_state = m_targetState;
      return sc;
    }

Gaudi::StateMachine::State ApplicationMgr::FSMState | ( | ) | const`[virtual]`

Definition at line 924 of file ApplicationMgr.cpp.

                                                           {
      return m_state;
    }

template<class I >

SmartIF<IComponentManager>& ApplicationMgr::getManager | ( | ) | `[inline]`

Definition at line 137 of file ApplicationMgr.h.

                                               {
        return m_managers[I::interfaceID().id()];
      }

StatusCode ApplicationMgr::GoToState | ( | Gaudi::StateMachine::State | state,
|  | bool | ignoreFailures = `false`
| ) |  | `[protected]`

Reach a state from current state (whichever it is) going through the correct transitions.

By default, if a transition fails, the chain is interrupted, but the behavior can be changed with the parameter "gnoreFailures"

Definition at line 776 of file ApplicationMgr.cpp.

                                                                                          {
      StatusCode sc = StatusCode(StatusCode::SUCCESS,true);

      switch (state) {

      case Gaudi::StateMachine::OFFLINE:
        switch (m_state) {
        case Gaudi::StateMachine::OFFLINE    : return StatusCode::SUCCESS; break;
        case Gaudi::StateMachine::CONFIGURED : return terminate(); break;
        default: // Gaudi::StateMachine::INITIALIZED or Gaudi::StateMachine::RUNNING
          sc = GoToState(Gaudi::StateMachine::CONFIGURED);
          if (sc.isSuccess()) {
            return terminate();
          } break;
        } break;

      case Gaudi::StateMachine::CONFIGURED:
        switch (m_state) {
        case Gaudi::StateMachine::CONFIGURED  : return StatusCode::SUCCESS; break;
        case Gaudi::StateMachine::OFFLINE     : return configure(); break;
        case Gaudi::StateMachine::INITIALIZED : return finalize(); break;
        default: // Gaudi::StateMachine::RUNNING
          sc = GoToState(Gaudi::StateMachine::INITIALIZED);
          if (sc.isSuccess()) {
            return finalize();
          } break;
        } break;

      case Gaudi::StateMachine::INITIALIZED:
        switch (m_state) {
        case Gaudi::StateMachine::INITIALIZED : return StatusCode::SUCCESS; break;
        case Gaudi::StateMachine::CONFIGURED  : return initialize(); break;
        case Gaudi::StateMachine::RUNNING     : return stop(); break;
        default: // Gaudi::StateMachine::OFFLINE
          sc = GoToState(Gaudi::StateMachine::CONFIGURED);
          if (sc.isSuccess()) {
            return initialize();
          } break;
        } break;

      case Gaudi::StateMachine::RUNNING:
        switch (m_state) {
        case Gaudi::StateMachine::RUNNING     : return StatusCode::SUCCESS; break;
        case Gaudi::StateMachine::INITIALIZED : return start(); break;
        default: // Gaudi::StateMachine::OFFLINE or Gaudi::StateMachine::CONFIGURED
          sc = GoToState(Gaudi::StateMachine::INITIALIZED);
          if (sc.isSuccess()) {
            return start();
          } break;
        } break;

      }

      // If I get here, there has been a problem in the recursion

      if (ignoreFailures){
        // force the new state
        m_state = state;
        return StatusCode::SUCCESS;
      }

      return sc;
    }

StatusCode ApplicationMgr::i_startup | ( | ) | `[protected]`

Internal startup routine.

Definition at line 209 of file ApplicationMgr.cpp.

                                         {
      StatusCode  sc;

      // declare factories in current module
      m_classManager->loadModule("").ignore();

      // Create the Message service
      SmartIF<IService> msgsvc = svcManager()->createService(Gaudi::Utils::TypeNameString("MessageSvc", m_messageSvcType));
      if( !msgsvc.isValid() )  {
        fatal() << "Error creating MessageSvc of type " << m_messageSvcType << endmsg;
        return sc;
      }
      // Create the Job Options service
      SmartIF<IService> jobsvc = svcManager()->createService(Gaudi::Utils::TypeNameString("JobOptionsSvc", m_jobOptionsSvcType));
      if( !jobsvc.isValid() )   {
        fatal() << "Error creating JobOptionsSvc" << endmsg;
        return sc;
      }

      SmartIF<IProperty> jobOptsIProp(jobsvc);
      if ( !jobOptsIProp.isValid() )   {
        fatal() << "Error locating JobOptionsSvc" << endmsg;
        return sc;
      }
      sc = jobOptsIProp->setProperty( StringProperty("TYPE", m_jobOptionsType) );
      if( !sc.isSuccess() )   {
        fatal() << "Error setting TYPE option in JobOptionsSvc" << endmsg;
        return sc;
      }

      if ( m_jobOptionsPath != "") {         // The command line takes precedence
        sc = jobOptsIProp->setProperty( StringProperty("PATH", m_jobOptionsPath) );
        if( !sc.isSuccess() )   {
          fatal() << "Error setting PATH option in JobOptionsSvc" << endmsg;
          return sc;
        }
      }
      else if ( isEnvSet("JOBOPTPATH") ) {// Otherwise the Environment JOBOPTPATH
        sc = jobOptsIProp->setProperty (StringProperty("PATH",
                                                       getEnv("JOBOPTPATH")));
        if( !sc.isSuccess() )   {
          fatal()
               << "Error setting PATH option in JobOptionsSvc from env"
               << endmsg;
          return sc;
        }
      }
      else {                                   // Otherwise the default
        sc = jobOptsIProp->setProperty (StringProperty("PATH",
                                                       "../options/job.opts"));
        if( !sc.isSuccess() )   {
          fatal()
               << "Error setting PATH option in JobOptionsSvc to default"
               << endmsg;
          return sc;
        }
      }
      jobOptsIProp->release();

      // Sets my default the Output Level of the Message service to be
      // the same as this
      SmartIF<IProperty> msgSvcIProp(msgsvc);
      msgSvcIProp->setProperty( IntegerProperty("OutputLevel", m_outputLevel)).ignore();
      msgSvcIProp->release();

      sc = jobsvc->sysInitialize();
      if( !sc.isSuccess() )   {
        fatal() << "Error initializing JobOptionsSvc" << endmsg;
        return sc;
      }
      sc = msgsvc->sysInitialize();
      if( !sc.isSuccess() )  {
        fatal() << "Error initializing MessageSvc" << endmsg;
        return sc;
      }

      // Get the useful interface from Message and JobOptions services
      m_messageSvc = m_svcLocator->service("MessageSvc");
      if( !m_messageSvc.isValid() )  {
        fatal() << "Error retrieving MessageSvc." << endmsg;
        return sc;
      }
      m_jobOptionsSvc = m_svcLocator->service("JobOptionsSvc");
      if( !m_jobOptionsSvc.isValid() )  {
        fatal() << "Error retrieving JobOptionsSvc." << endmsg;
        return sc;
      }

      return sc;
    }

StatusCode ApplicationMgr::initialize | ( | ) | `[virtual]`

Definition at line 524 of file ApplicationMgr.cpp.

                                          {

      MsgStream log( m_messageSvc, name() );
      StatusCode sc;

      // I cannot add these services in configure() because they are coming from GaudiUtils
      // and it messes up genconf when rebuilding it.
      if (m_stopOnSignal) {
        // Instantiate the service that schedules a stop when a signal is received
        std::string svcname("Gaudi::Utils::StopSignalHandler");
        sc = svcManager()->addService(svcname);
        if ( sc.isFailure() ) {
          log << MSG::INFO << "Cannot instantiate " << svcname << "signals will be ignored" << endmsg;
        }
      }

      if (m_stalledEventMonitoring) {
        // Instantiate the service that schedules a stop when a signal is received
        std::string svcname("StalledEventMonitor");
        sc = svcManager()->addService(svcname);
        if ( sc.isFailure() ) {
          log << MSG::INFO << "Cannot instantiate " << svcname << "signals will be ignored" << endmsg;
        }
      }

      if( m_state == Gaudi::StateMachine::INITIALIZED ) {
        log << MSG::INFO << "Already Initialized!" << endmsg;
        return StatusCode::SUCCESS;
      }
      else if( m_state != Gaudi::StateMachine::CONFIGURED ) {
        log << MSG::FATAL
             << "initialize: Invalid state \""  << m_state << "\"" << endmsg;
        return StatusCode::FAILURE;
      }
      m_targetState = Gaudi::StateMachine::INITIALIZED;

      //--------------------------------------------------------------------------
      // Initialize the list of top Services
      //--------------------------------------------------------------------------
      sc = svcManager()->initialize();
      if( !sc.isSuccess() ) return sc;

      //--------------------------------------------------------------------------
      // Final steps: Inform user and change internal state
      //--------------------------------------------------------------------------
      log << MSG::INFO << "Application Manager Initialized successfully"  << endmsg;
      m_state = m_targetState;

      return sc;
    }

void ApplicationMgr::initLoopCheckHndlr | ( | Property & | ) |

Definition at line 1302 of file ApplicationMgr.cpp.

                                                     {
      svcManager()->setLoopCheckEnabled(m_loopCheck);
    }

void ApplicationMgr::multiThreadSvcNameListHandler | ( | Property & | theProp ) |

Definition at line 1087 of file ApplicationMgr.cpp.

                                                                                {
      if ( !(decodeMultiThreadSvcNameList( )).isSuccess() ) {
        throw GaudiException("Failed to create copies of mt services",
                             "MinimalEventLoopMgr::multiThreadSvcNameListHandler",
                             StatusCode::FAILURE);
      }

    }

const std::string & ApplicationMgr::name | ( | ) | const`[virtual]`

This is needed to avoid ambiguous calls to name()

Implements CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > >.

Definition at line 919 of file ApplicationMgr.cpp.

                                                {
      return m_name;
    }

StatusCode ApplicationMgr::nextEvent | ( | int | maxevt ) | `[virtual]`

Definition at line 612 of file ApplicationMgr.cpp.

                                                      {
      if( m_state != Gaudi::StateMachine::RUNNING ) {
        MsgStream log( m_messageSvc, name() );
        log << MSG::FATAL << "nextEvent: Invalid state \"" << m_state << "\""
            << endmsg;
        return StatusCode::FAILURE;
      }
      if (!m_processingMgr.isValid())   {
        MsgStream log( m_messageSvc, name() );
        log << MSG::FATAL << "No event processing manager specified. Check option:"
            << s_eventloop << endmsg;
        return StatusCode::FAILURE;
      }
      return m_processingMgr->nextEvent(maxevt);
    }

StatusCode ApplicationMgr::queryInterface | ( | const InterfaceID & | iid,
|  | void ** | pinterface
| ) |  | `[virtual]`

Definition at line 172 of file ApplicationMgr.cpp.

    {
      if ( 0 == ppvi ) { return StatusCode::FAILURE ; }

      // try to find own/direct interfaces:
      StatusCode sc = base_class::queryInterface(iid,ppvi);
      if (sc.isSuccess()) return sc;

      // find indirect interfaces :
      if      ( ISvcLocator     ::interfaceID() . versionMatch ( iid ) )
      { return serviceLocator()-> queryInterface ( iid , ppvi ) ; }
      else if ( ISvcManager     ::interfaceID() . versionMatch ( iid ) )
      { return svcManager()    -> queryInterface ( iid , ppvi ) ; }
      else if ( IAlgManager     ::interfaceID() . versionMatch ( iid ) )
      { return algManager()    -> queryInterface ( iid , ppvi ) ; }
      else if ( IClassManager   ::interfaceID() . versionMatch ( iid ) )
      { return m_classManager  -> queryInterface ( iid , ppvi ) ; }
      else if ( IProperty       ::interfaceID() . versionMatch ( iid ) )
      { return m_propertyMgr   -> queryInterface ( iid , ppvi ) ; }
      else if ( IMessageSvc     ::interfaceID() . versionMatch ( iid ) )
      {
        *ppvi = reinterpret_cast<void*>(m_messageSvc.get());
        if (m_messageSvc) {
          m_messageSvc->addRef();
        }
        // Note that 0 can be a valid IMessageSvc pointer value (when used for
        // MsgStream).
        return StatusCode::SUCCESS;
      }
      *ppvi = 0;
      return StatusCode::FAILURE;
    }

void ApplicationMgr::reflexDebugPropertyHandler | ( | Property & | theProp ) |

Definition at line 1288 of file ApplicationMgr.cpp.

    {
      // Setup debug level for Reflex plugin system
      MsgStream log (m_messageSvc, name());
      log << MSG::INFO
          << "Updating ROOT::Reflex::PluginService::SetDebug(level) to level="
          << (int)m_reflexDebugLevel
          << endmsg;
      ROOT::Reflex::PluginService::SetDebug(m_reflexDebugLevel);
    }

StatusCode ApplicationMgr::reinitialize | ( | ) | `[virtual]`

Definition at line 936 of file ApplicationMgr.cpp.

                                            {
      StatusCode retval = StatusCode::SUCCESS;
      StatusCode sc;
      if ( m_state < Gaudi::StateMachine::INITIALIZED ) {
        throw GaudiException("Cannot reinitialize application if not INITIALIZED or RUNNING",
                             "ApplicationMgr::reinitialize", StatusCode::FAILURE);
      }
      if ( m_state == Gaudi::StateMachine::RUNNING ) {
        retval = GoToState(Gaudi::StateMachine::INITIALIZED);
      }
      sc = svcManager()->reinitialize();
      if (sc.isFailure()) retval = sc;
      sc = algManager()->reinitialize();
      if (sc.isFailure()) retval = sc;
      return retval;
    }

StatusCode ApplicationMgr::restart | ( | ) | `[virtual]`

Definition at line 956 of file ApplicationMgr.cpp.

                                       {
      StatusCode retval = StatusCode::SUCCESS;
      StatusCode sc;
      if ( m_state != Gaudi::StateMachine::RUNNING ) {
        throw GaudiException("Cannot restart application if not RUNNING",
                             "ApplicationMgr::restart", StatusCode::FAILURE);
      }
      sc = svcManager()->restart();
      if (sc.isFailure()) retval = sc;
      sc = algManager()->restart();
      if (sc.isFailure()) retval = sc;
      return retval;
    }

StatusCode ApplicationMgr::run | ( | ) | `[virtual]`

Definition at line 843 of file ApplicationMgr.cpp.

                                   {
      StatusCode sc = StatusCode::SUCCESS;

      sc = GoToState(Gaudi::StateMachine::RUNNING);
      if ( sc.isSuccess() ) {
        MsgStream log(m_messageSvc, name());
        if ( m_runable != 0 ) { // loop over the events
          sc = m_runable->run();
          if ( !sc.isSuccess() ) {
            log << MSG::FATAL << "Application execution failed. Ending the job."
                << endmsg;
          }
        } else {
          log << MSG::FATAL << "Application has no runable object. Check option:"
              << s_runable << endmsg;
        }
      }
      if (sc.isSuccess()) { // try to close cleanly
        sc = GoToState(Gaudi::StateMachine::OFFLINE);
      }
      // either the runable failed of the stut-down
      if (sc.isFailure()) { // try to close anyway (but keep the StatusCode unchanged)
        GoToState(Gaudi::StateMachine::OFFLINE,true).ignore();
      }
      return sc;
    }

virtual SmartIF<ISvcLocator>& ApplicationMgr::serviceLocator | ( | ) | const`[inline, virtual]`

Needed to locate the message service.

Implements CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > >.

Definition at line 158 of file ApplicationMgr.h.

                                                           {
        return m_svcLocator;
      }

void ApplicationMgr::setServiceManager | ( | ISvcManager * | ) | `[inline, protected]`

Definition at line 171 of file ApplicationMgr.h.

    {}

void ApplicationMgr::SIExitHandler | ( | Property & | theProp ) |

Definition at line 989 of file ApplicationMgr.cpp.

                                                  {
      StatusCode status;
      status = finalize();
      status = terminate();
      ::exit( 0 );
    }

void ApplicationMgr::SIGoHandler | ( | Property & | theProp ) |

Definition at line 973 of file ApplicationMgr.cpp.

                                                {

      MsgStream log (m_messageSvc, name());
      StatusCode sc;

      // Re-initialize everything
      sc = reinitialize();
      // Execute a number of events
      executeRun(m_evtMax);

      return;
    }

StatusCode ApplicationMgr::start | ( | ) | `[virtual]`

Definition at line 578 of file ApplicationMgr.cpp.

                                     {

      MsgStream log( m_messageSvc, name() );
      StatusCode sc;

      if( m_state == Gaudi::StateMachine::RUNNING ) {
        log << MSG::INFO << "Already Initialized!" << endmsg;
        return StatusCode::SUCCESS;
      }
      else if( m_state != Gaudi::StateMachine::INITIALIZED ) {
        log << MSG::FATAL
             << "start: Invalid state \""  << m_state << "\"" << endmsg;
        return StatusCode::FAILURE;
      }
      m_targetState = Gaudi::StateMachine::RUNNING;

      //--------------------------------------------------------------------------
      // Initialize the list of top Services
      //--------------------------------------------------------------------------
      sc = svcManager()->start();
      if( !sc.isSuccess() ) return sc;

      //--------------------------------------------------------------------------
      // Final steps: Inform user and change internal state
      //--------------------------------------------------------------------------
      log << MSG::INFO << "Application Manager Started successfully"  << endmsg;
      m_state = m_targetState;

      return sc;
    }

StatusCode ApplicationMgr::stop | ( | ) | `[virtual]`

Definition at line 631 of file ApplicationMgr.cpp.

                                    {

      MsgStream log( m_messageSvc, name() );
      StatusCode sc;

      if( m_state == Gaudi::StateMachine::INITIALIZED ) {
        log << MSG::INFO << "Already Initialized!" << endmsg;
        return StatusCode::SUCCESS;
      }
      else if( m_state != Gaudi::StateMachine::RUNNING ) {
        log << MSG::FATAL
             << "stop: Invalid state \""  << m_state << "\"" << endmsg;
        return StatusCode::FAILURE;
      }
      m_targetState = Gaudi::StateMachine::INITIALIZED;

      // Stop independently managed Algorithms
      sc = algManager()->stop();
      if( !sc.isSuccess() ) return sc;

      //--------------------------------------------------------------------------
      // Stop the list of top Services
      //--------------------------------------------------------------------------
      sc = svcManager()->stop();
      if( !sc.isSuccess() ) return sc;

      //--------------------------------------------------------------------------
      // Final steps: Inform user and change internal state
      //--------------------------------------------------------------------------
      log << MSG::INFO << "Application Manager Stopped successfully"  << endmsg;
      m_state = m_targetState;

      return sc;
    }

StatusCode ApplicationMgr::stopRun | ( | ) | `[virtual]`

implementation of IEventProcessor::stopRun()

Definition at line 905 of file ApplicationMgr.cpp.

                                          {
      MsgStream log( m_messageSvc, name() );
      if( m_state == Gaudi::StateMachine::RUNNING ) {
        if ( m_processingMgr.isValid() )    {
          return m_processingMgr->stopRun();
        }
        log << MSG::WARNING << "No EventLoop Manager specified " << endmsg;
        return StatusCode::SUCCESS;
      }
      log << MSG::FATAL << "stopRun: Invalid state \"" << FSMState() << "\""
          << endmsg;
      return StatusCode::FAILURE;
    }

SmartIF<ISvcManager>& ApplicationMgr::svcManager | ( | ) | `[inline]`

Definition at line 141 of file ApplicationMgr.h.

                                                {
        // Cache the casted pointer to ISvcManager
        if (!m_svcManager) {
          m_svcManager = getManager<IService>();
        }
        return m_svcManager;
      }

virtual StatusCode ApplicationMgr::sysFinalize | ( | ) | `[inline, virtual]`

Definition at line 110 of file ApplicationMgr.h.

    { return StatusCode::SUCCESS; }

virtual StatusCode ApplicationMgr::sysInitialize | ( | ) | `[inline, virtual]`

Definition at line 104 of file ApplicationMgr.h.

    { return StatusCode::SUCCESS; }

virtual StatusCode ApplicationMgr::sysReinitialize | ( | ) | `[inline, virtual]`

Definition at line 112 of file ApplicationMgr.h.

    { return StatusCode::SUCCESS; }

virtual StatusCode ApplicationMgr::sysRestart | ( | ) | `[inline, virtual]`

Definition at line 114 of file ApplicationMgr.h.

    { return StatusCode::SUCCESS; }

virtual StatusCode ApplicationMgr::sysStart | ( | ) | `[inline, virtual]`

Definition at line 106 of file ApplicationMgr.h.

    { return StatusCode::SUCCESS; }

virtual StatusCode ApplicationMgr::sysStop | ( | ) | `[inline, virtual]`

Definition at line 108 of file ApplicationMgr.h.

    { return StatusCode::SUCCESS; }

Gaudi::StateMachine::State ApplicationMgr::targetFSMState | ( | ) | const`[virtual]`

Definition at line 928 of file ApplicationMgr.cpp.

                                                                 {
      return m_targetState;
    }

StatusCode ApplicationMgr::terminate | ( | ) | `[virtual]`

Definition at line 719 of file ApplicationMgr.cpp.

                                         {
      MsgStream log( m_messageSvc, name() );

      if( m_state == Gaudi::StateMachine::OFFLINE ) {
        log << MSG::INFO << "Already Offline" << endmsg;
        return StatusCode::SUCCESS;
      }
      else if( m_state != Gaudi::StateMachine::CONFIGURED ) {
        log << MSG::FATAL << "terminate: Invalid state \"" << m_state << "\""
            << endmsg;
        return StatusCode::FAILURE;
      }
      // release all Services
      m_targetState = Gaudi::StateMachine::OFFLINE;

      if (m_returnCode.value() == Gaudi::ReturnCode::Success) {
        log << MSG::INFO << "Application Manager Terminated successfully" << endmsg;
      } else {
        log << MSG::ERROR << "Application Manager Terminated with error code " << m_returnCode.value() << endmsg;
      }

      { // Force a disable the auditing of finalize for MessageSvc
        SmartIF<IProperty> prop(m_messageSvc);
        if (prop.isValid()) {
          prop->setProperty(BooleanProperty("AuditFinalize", false)).ignore();
        }
      }
      { // Force a disable the auditing of finalize for JobOptionsSvc
        SmartIF<IProperty> prop(m_jobOptionsSvc);
        if (prop.isValid()) {
          prop->setProperty(BooleanProperty("AuditFinalize", false)).ignore();
        }
      }

      // finalize MessageSvc
      SmartIF<IService> svc(m_messageSvc);
      if ( !svc.isValid() ) {
        log << MSG::ERROR << "Could not get the IService interface of the MessageSvc" << endmsg;
      } else {
        svc->sysFinalize().ignore();
      }

      // finalize JobOptionsSvc
      svc = m_jobOptionsSvc;
      if ( !svc.isValid() ) {
        log << MSG::ERROR << "Could not get the IService interface of the JobOptionsSvc" << endmsg;
      } else {
        svc->sysFinalize().ignore();
      }

      m_state = m_targetState;
      return StatusCode::SUCCESS;
    }

## Member Data Documentation

bool ApplicationMgr::m_actHistory`[protected]`

Activate HistorySvc.

Definition at line 251 of file ApplicationMgr.h.

SmartIF<IAlgManager> ApplicationMgr::m_algManager`[protected]`

Cached pointer to the manager of algorithms.

Definition at line 196 of file ApplicationMgr.h.

std::string ApplicationMgr::m_appName`[protected]`

The name of the application.

Definition at line 249 of file ApplicationMgr.h.

std::string ApplicationMgr::m_appVersion`[protected]`

The version of the application.

Definition at line 250 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_auditAlgs`[protected]`

Definition at line 260 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_auditSvcs`[protected]`

Definition at line 259 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_auditTools`[protected]`

Defaults for auditors.

Definition at line 258 of file ApplicationMgr.h.

DLLClassManager* ApplicationMgr::m_classManager`[protected]`

Reference to the class manager.

Definition at line 200 of file ApplicationMgr.h.

bool ApplicationMgr::m_codeCheck`[protected]`

Activate StatusCode checking.

Definition at line 252 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_createSvcNameList`[protected]`

Definition at line 255 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_declaredManagers`[protected]`

Property to declare the list of known managers.

Definition at line 190 of file ApplicationMgr.h.

VectorName ApplicationMgr::m_defServices`[protected]`

Vector default services names.

Definition at line 219 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_dllNameList`[protected]`

List of DDL's names.

Definition at line 241 of file ApplicationMgr.h.

std::map<std::string,std::string> ApplicationMgr::m_environment`[protected]`

Environment variables to set.

Definition at line 262 of file ApplicationMgr.h.

std::string ApplicationMgr::m_eventLoopMgr`[protected]`

Processing manager type.

Definition at line 245 of file ApplicationMgr.h.

int ApplicationMgr::m_evtMax`[protected]`

Number of events to be processed.

Definition at line 233 of file ApplicationMgr.h.

std::string ApplicationMgr::m_evtsel`[protected]`

Event selection.

Definition at line 246 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_extSvcCreates`[protected]`

LHCb or ATLAS defn of "ExtSvc".

Definition at line 235 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_extSvcNameList`[protected]`

List of external services names.

Definition at line 234 of file ApplicationMgr.h.

std::string ApplicationMgr::m_histPersName`[protected]`

CGL: Name of the Hist Pers Svc.

Definition at line 247 of file ApplicationMgr.h.

std::string ApplicationMgr::m_jobOptionsPath`[protected]`

The "file" to look for properties.

Definition at line 243 of file ApplicationMgr.h.

SmartIF<IJobOptionsSvc> ApplicationMgr::m_jobOptionsSvc`[protected]`

Reference to JobOption service.

Definition at line 227 of file ApplicationMgr.h.

StringProperty ApplicationMgr::m_jobOptionsSvcType`[protected]`

JobOptionsSvc type.

Definition at line 209 of file ApplicationMgr.h.

std::string ApplicationMgr::m_jobOptionsType`[protected]`

Source type (e.g. dbase, file...)

Definition at line 242 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_loopCheck`[protected]`

For ServiceMgr initialization loop checking.

Definition at line 265 of file ApplicationMgr.h.

ManagersMap ApplicationMgr::m_managers`[protected]`

Map of known component managers.

It contains (at least) the managers for IService and IAlgorithm. IAlgTool and IAuditor are not mandatory (but a missing manager for IAlgTool will probably not allow any job to run).

Definition at line 188 of file ApplicationMgr.h.

SmartIF<IMessageSvc> ApplicationMgr::m_messageSvc`[protected]`

Reference to the message service.

Definition at line 224 of file ApplicationMgr.h.

StringProperty ApplicationMgr::m_messageSvcType`[protected]`

MessageSvc type.

Definition at line 208 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_multiThreadSvcNameList`[protected]`

List of external services names for which we want a copy per evt thread.

Definition at line 238 of file ApplicationMgr.h.

std::string ApplicationMgr::m_name`[protected]`

Name.

Definition at line 215 of file ApplicationMgr.h.

int ApplicationMgr::m_noOfEvtThreads`[protected]`

no of multiThreadSvc copies

Definition at line 239 of file ApplicationMgr.h.

std::vector<std::string> ApplicationMgr::m_okDlls`[private]`

names of successfully loaded dlls

Definition at line 282 of file ApplicationMgr.h.

int ApplicationMgr::m_outputLevel`[protected]`

Message output level.

Definition at line 248 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_outStreamNameList`[protected]`

List of output stream names.

Definition at line 206 of file ApplicationMgr.h.

StringProperty ApplicationMgr::m_outStreamType`[protected]`

Output stream type (obsolete?)

Definition at line 207 of file ApplicationMgr.h.

SmartIF<IEventProcessor> ApplicationMgr::m_processingMgr`[protected]`

Reference to processing manager object.

Definition at line 226 of file ApplicationMgr.h.

bool ApplicationMgr::m_propertiesPrint`[protected]`

flag to activate the printout of properties

Definition at line 276 of file ApplicationMgr.h.

PropertyMgr* ApplicationMgr::m_propertyMgr`[protected]`

Reference to Property Manager.

Definition at line 223 of file ApplicationMgr.h.

IntegerProperty ApplicationMgr::m_reflexDebugLevel`[protected]`

Debug level for the reflex plugin system.

Definition at line 253 of file ApplicationMgr.h.

IntegerProperty ApplicationMgr::m_returnCode`[protected]`

Property to record the error conditions occurring during the running.

Definition at line 279 of file ApplicationMgr.h.

SmartIF<IRunable> ApplicationMgr::m_runable`[protected]`

Reference to the runable object.

Definition at line 225 of file ApplicationMgr.h.

std::string ApplicationMgr::m_runableType`[protected]`

Runable type.

Definition at line 244 of file ApplicationMgr.h.

IntegerProperty ApplicationMgr::m_SIExit`[protected]`

For SI's "Exit" command via callback.

Definition at line 204 of file ApplicationMgr.h.

IntegerProperty ApplicationMgr::m_SIGo`[protected]`

For SI's "Go" command via callback.

Definition at line 203 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_stalledEventMonitoring`[protected]`

Property to enable/disable the monitoring and reporting of stalled events (enabled by default).

See also:
  StalledEventMonitor

Definition at line 273 of file ApplicationMgr.h.

Gaudi::StateMachine::State ApplicationMgr::m_state`[protected]`

Internal State.

Definition at line 216 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_stopOnSignal`[protected]`

Property to enable/disable the "stop on signal" service (enabled by default).

See also:
  Gaudi::Utils::StopSignalHandler

Definition at line 269 of file ApplicationMgr.h.

SmartIF<ISvcLocator> ApplicationMgr::m_svcLocator`[mutable, protected]`

Reference to its own service locator.

Definition at line 201 of file ApplicationMgr.h.

SmartIF<ISvcManager> ApplicationMgr::m_svcManager`[protected]`

Cached pointer to the manager of services.

Definition at line 193 of file ApplicationMgr.h.

VectorName ApplicationMgr::m_svcMapping`[protected]`

Default mapping of services.

Definition at line 220 of file ApplicationMgr.h.

VectorName ApplicationMgr::m_svcOptMapping`[protected]`

Default mapping of services.

Definition at line 221 of file ApplicationMgr.h.

Gaudi::StateMachine::State ApplicationMgr::m_targetState`[protected]`

Internal State.

Definition at line 217 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_topAlgNameList`[protected]`

List of top level algorithms names.

Definition at line 205 of file ApplicationMgr.h.

ListSvc ApplicationMgr::m_topSvcList`[protected]`

List of top level services.

Definition at line 212 of file ApplicationMgr.h.

ListName ApplicationMgr::m_topSvcNameList`[protected]`

List of top level services names.

Definition at line 213 of file ApplicationMgr.h.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiCoreSvc/src/ApplicationMgr/ApplicationMgr.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiCoreSvc/src/ApplicationMgr/ApplicationMgr.cpp

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