Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:38

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #ifndef GAUDIKERNEL_IALGORITHM_H
0012 #define GAUDIKERNEL_IALGORITHM_H
0013 
0014 // Include files
0015 #include "GaudiKernel/INamedInterface.h"
0016 #include "GaudiKernel/IStateful.h"
0017 #include <string>
0018 
0019 class IAlgTool;
0020 class AlgResourcePool;
0021 class AlgExecState;
0022 class EventContext;
0023 
0024 namespace Gaudi {
0025   class StringKey;
0026 }
0027 
0028 /** @class IAlgorithm IAlgorithm.h GaudiKernel/IAlgorithm.h
0029 
0030     The IAlgorithm is the interface implemented by the Algorithm base class.
0031     Concrete algorithms, derived from the Algorithm base class are controlled
0032     via this interface.
0033 
0034     @author Paul Maley
0035     @author D.Quarrie
0036     @author Marco Clemencic
0037 */
0038 class GAUDI_API IAlgorithm : virtual public extend_interfaces<INamedInterface, IStateful> {
0039 public:
0040   friend AlgResourcePool;
0041 
0042   /// InterfaceID
0043   DeclareInterfaceID( IAlgorithm, 7, 0 );
0044 
0045   /** The version of the algorithm
0046    */
0047   virtual const std::string& version() const = 0;
0048 
0049   /** The type of the algorithm
0050    */
0051   virtual const std::string& type() const           = 0;
0052   virtual void               setType( std::string ) = 0;
0053 
0054   /** StringKey rep of name
0055    */
0056   virtual const Gaudi::StringKey& nameKey() const = 0;
0057 
0058   /** The index of the algorithm
0059    */
0060   virtual unsigned int index() const = 0;
0061 
0062   /** Specify if the algorithm is clonable
0063    */
0064   virtual bool isClonable() const { return false; }
0065 
0066   /** Cardinality (Maximum number of clones that can exist)
0067    *  special value 0 means that algorithm is reentrant
0068    */
0069   virtual unsigned int cardinality() const = 0;
0070 
0071   /** Named, non thread-safe resources used during event processing
0072    */
0073   virtual const std::vector<std::string>& neededResources() const = 0;
0074 
0075   /** The action to be performed by the algorithm on an event. This method is
0076       invoked once per event for top level algorithms by the application manager.
0077   */
0078   virtual StatusCode execute( const EventContext& ) const = 0;
0079 
0080   /// check if the algorithm is initialized properly
0081   virtual bool isInitialized() const = 0;
0082   /// check if the algorithm is finalized properly
0083   virtual bool isFinalized() const = 0;
0084 
0085   /** Initialization method invoked by the framework. This method is responsible
0086       for any bookkeeping of initialization required by the framework itself.
0087       It will in turn invoke the initialize() method of the derived algorithm,
0088       and of any sub-algorithms which it creates.
0089   */
0090   virtual StatusCode sysInitialize() = 0;
0091 
0092   /** Startup method invoked by the framework. This method is responsible
0093       for any bookkeeping of initialization required by the framework itself.
0094       It will in turn invoke the start() method of the derived algorithm,
0095       and of any sub-algorithms which it creates.
0096   */
0097   virtual StatusCode sysStart() = 0;
0098 
0099   /** Re-initialization method invoked by the framework. This method is responsible
0100       for any re-initialization required by the framework itself.
0101       It will in turn invoke the reinitialize() method of the derived algorithm,
0102       and of any sub-algorithms which it creates.
0103   */
0104   virtual StatusCode sysReinitialize() = 0;
0105 
0106   /** Re-start method invoked by the framework. This method is responsible
0107       for any re-start required by the framework itself.
0108       It will in turn invoke the restart() method of the derived algorithm,
0109       and of any sub-algorithms which it creates.
0110   */
0111   virtual StatusCode sysRestart() = 0;
0112 
0113 /// sysExecute changed to accept the EventContext as argument
0114 #define GAUDI_SYSEXECUTE_WITHCONTEXT 1
0115 
0116   /// System execution. This method invokes the execute() method of a concrete algorithm
0117   virtual StatusCode sysExecute( const EventContext& ) = 0;
0118 
0119   /** System stop. This method invokes the stop() method of a concrete
0120       algorithm and the stop() methods of all of that algorithm's sub algorithms.
0121   */
0122   virtual StatusCode sysStop() = 0;
0123 
0124   /** System finalization. This method invokes the finalize() method of a concrete
0125       algorithm and the finalize() methods of all of that algorithm's sub algorithms.
0126   */
0127   virtual StatusCode sysFinalize() = 0;
0128 
0129   /// reference to AlgExecState of Alg
0130   virtual AlgExecState& execState( const EventContext& ctx ) const = 0;
0131 
0132   /// Is this algorithm enabled or disabled?
0133   virtual bool isEnabled() const = 0;
0134 
0135   /// Are we a Sequence?
0136   virtual bool isSequence() const = 0;
0137 
0138   /// Produce string represention of the control flow expression.
0139   virtual std::ostream& toControlFlowExpression( std::ostream& os ) const = 0;
0140 
0141   /// Set instantiation index of Alg
0142   virtual void setIndex( const unsigned int& idx ) = 0;
0143 
0144   virtual bool isReEntrant() const = 0;
0145 };
0146 
0147 #endif // GAUDIKERNEL_IALGORITHM_H