Commits

Anonymous committed 5c6aa16

updates for boost 1.48 filesystem v3

  • Participants

Comments (0)

Files changed (366)

GaudiKernel/AlgFactory.h

+// $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/AlgFactory.h,v 1.10 2008/10/09 21:00:37 marcocle Exp $
+#ifndef GAUDIKERNEL_ALGFACTORY_H
+#define GAUDIKERNEL_ALGFACTORY_H
+
+#include "GaudiKernel/Kernel.h"
+#include "Reflex/PluginService.h"
+#include "RVersion.h"
+
+// The following is needed to be backward compatible with the old factories of Gaudi. Otherwise the components
+// having the constructor/destructor protected will not be working
+
+class IAlgorithm;
+class ISvcLocator;
+
+template <typename T> class AlgFactory {
+public:
+  static IAlgorithm* create(const std::string& name, ISvcLocator *svcloc) {
+    return new T(name, svcloc );
+  }
+};
+
+namespace {
+  template < typename P > class Factory<P, IAlgorithm*(std::string, ISvcLocator*)> {
+  public:
+#if ROOT_VERSION_CODE < ROOT_VERSION(5,21,6)
+    static void* Func( void*, const std::vector<void*>& arg, void*) {
+      return AlgFactory<P>::create(*(std::string*)(arg[0]), (ISvcLocator*)(arg[1]));
+    }
+#else
+    static void Func( void *retaddr, void*, const std::vector<void*>& arg, void*) {
+      *(IAlgorithm**) retaddr = AlgFactory<P>::create(*(std::string*)(arg[0]), (ISvcLocator*)(arg[1]));
+    }
+#endif
+  };
+}
+
+// Macros to declare component factories
+#define DECLARE_ALGORITHM_FACTORY(x)          PLUGINSVC_FACTORY(x,IAlgorithm*(std::string, ISvcLocator*))
+#define DECLARE_NAMED_ALGORITHM_FACTORY(x,n)  PLUGINSVC_FACTORY_WITH_ID(x,std::string(#n), IAlgorithm*(std::string, ISvcLocator*))
+
+#define DECLARE_NAMESPACE_ALGORITHM_FACTORY(n,x)  using n::x; PLUGINSVC_FACTORY(x,IAlgorithm*(std::string, ISvcLocator*))
+#define DECLARE_ALGORITHM(x)  /*dummy*/
+#define DECLARE_NAMESPACE_ALGORITHM(n,x) /*dummy*/
+
+#endif // GAUDIKERNEL_ALGFACTORY_H

GaudiKernel/AlgTool.h

+#ifndef GAUDIKERNEL_ALGTOOL_H
+#define GAUDIKERNEL_ALGTOOL_H
+// ============================================================================
+// Include files
+#include "GaudiKernel/IAlgTool.h"
+#include "GaudiKernel/IProperty.h"
+#include "GaudiKernel/IService.h"
+#include "GaudiKernel/ISvcLocator.h"
+#include "GaudiKernel/IMessageSvc.h"
+#include "GaudiKernel/IToolSvc.h"
+#include "GaudiKernel/PropertyMgr.h"
+#include "GaudiKernel/IAuditorSvc.h"
+#include "GaudiKernel/IMonitorSvc.h"
+#include "GaudiKernel/IStateful.h"
+
+#include <vector>
+#include <list>
+
+// Forward declarations
+
+/** @class AlgTool AlgTool.h GaudiKernel/AlgTool.h
+ *
+ *  Base class from which all the concrete tool classes
+ *  should be derived. Specific methods for doing something
+ *  useful should be implemented in the concrete tools.
+ *  Sub-types of this class could implement an additional
+ *  interface for behavior common to sets of concrete tools
+ *  (for example vertexers).
+ *
+ *  @author Gloria Corti
+ *  @author Pere Mato
+ */
+class GAUDI_API AlgTool: public implements3<IAlgTool, IProperty, IStateful> {
+  friend class ToolSvc;
+public:
+
+  /// Query for a given interface
+  virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvUnknown);
+
+  /// Retrieve full identifying name of the concrete tool object.
+  virtual const std::string& name() const;
+
+  /// Retrieve type (concrete class) of the sub-algtool.
+  virtual const std::string& type() const;
+
+  /// Retrieve parent of the sub-algtool.
+  virtual const IInterface*  parent() const;
+
+  // State machine implementation
+  virtual StatusCode configure() { return StatusCode::SUCCESS; }
+  virtual StatusCode initialize();
+  virtual StatusCode start();
+  virtual StatusCode stop();
+  virtual StatusCode finalize();
+  virtual StatusCode terminate() { return StatusCode::SUCCESS; }
+  virtual StatusCode reinitialize();
+  virtual StatusCode restart();
+  virtual Gaudi::StateMachine::State FSMState() const { return m_state; }
+  virtual Gaudi::StateMachine::State targetFSMState() const { return m_targetState; }
+
+  /// Initialize AlgTool
+  virtual StatusCode sysInitialize();
+
+  /// Start AlgTool
+  virtual StatusCode sysStart();
+
+  /// Stop AlgTool
+  virtual StatusCode sysStop();
+
+  /// Finalize AlgTool
+  virtual StatusCode sysFinalize();
+
+  /// Initialize AlgTool
+  virtual StatusCode sysReinitialize();
+
+  /// Start AlgTool
+  virtual StatusCode sysRestart();
+
+  /// Default implementations for IProperty interface.
+  virtual StatusCode setProperty( const Property&    p );
+  virtual StatusCode setProperty( const std::string& s );
+  virtual StatusCode setProperty( const std::string& n, const std::string& v);
+  virtual StatusCode getProperty(Property* p) const;
+  virtual const Property& getProperty( const std::string& name) const;
+  virtual StatusCode getProperty( const std::string& n, std::string& v ) const;
+  virtual const std::vector<Property*>& getProperties( ) const;
+
+  inline PropertyMgr * getPropertyMgr() { return m_propertyMgr; }
+
+public:
+
+  /** set the property form the value
+   *
+   *  @code
+   *
+   *  std::vector<double> data = ... ;
+   *  setProperty( "Data" , data ) ;
+   *
+   *  std::map<std::string,double> cuts = ... ;
+   *  setProperty( "Cuts" , cuts ) ;
+   *
+   *  std::map<std::string,std::string> dict = ... ;
+   *  setProperty( "Dictionary" , dict ) ;
+   *
+   *  @endcode
+   *
+   *  Note: the interface IProperty allows setting of the properties either
+   *        directly from other properties or from strings only
+   *
+   *  This is very convenient in resetting of the default
+   *  properties in the derived classes.
+   *  E.g. without this method one needs to convert
+   *  everything into strings to use IProperty::setProperty
+   *
+   *  @code
+   *
+   *    setProperty ( "OutputLevel" , "1"    ) ;
+   *    setProperty ( "Enable"      , "True" ) ;
+   *    setProperty ( "ErrorMax"    , "10"   ) ;
+   *
+   *  @endcode
+   *
+   *  For simple cases it is more or less ok, but for complicated properties
+   *  it is just ugly..
+   *
+   *  @param name      name of the property
+   *  @param value     value of the property
+   *  @see Gaudi::Utils::setProperty
+   *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
+   *  @date 2007-05-13
+   */
+  template <class TYPE>
+  StatusCode setProperty
+  ( const std::string& name  ,
+    const TYPE&        value )
+  { return Gaudi::Utils::setProperty ( m_propertyMgr , name , value ) ; }
+
+
+  /** Standard Constructor.
+   *  @param type the concrete class of the sub-algtool
+   *  @param name the full name of the concrete sub-algtool
+   *  @param parent the parent of the concrete sub-algtool
+   */
+  AlgTool( const std::string& type,
+           const std::string& name,
+           const IInterface* parent);
+
+  /// Retrieve pointer to service locator.
+  ISvcLocator* serviceLocator()  const;
+
+  /// shortcut for the method service locator
+  ISvcLocator* svcLoc()  const { return serviceLocator() ; }
+
+  /// Retrieve pointer to message service.
+  IMessageSvc* msgSvc() const;
+
+  /// The standard ToolSvc service, Return a pointer to the service if present
+  IToolSvc* toolSvc() const;
+
+  /** Method for setting declared properties to the values specified in the
+   *  jobOptions via the job option service. This method is called by the
+   *  ToolSvc after creating the concrete tool, before passing it to the
+   *  requesting parent and does not need to be called explicitly.
+   */
+  StatusCode setProperties();
+
+  /** Access a service by name,
+   *  creating it if it doesn't already exist.
+   */
+  template <class T>
+  StatusCode service
+  ( const std::string& name, T*& svc, bool createIf = true ) const {
+    return service_i(name, createIf, T::interfaceID(), (void**)&svc);
+  }
+
+  /** Access a service by name, type creating it if it doesn't already exist.
+   */
+  template <class T>
+  StatusCode service( const std::string& type, const std::string& name, T*& svc) const {
+    return service_i(type, name, T::interfaceID(), (void**)&svc);
+  }
+
+  /// Return a pointer to the service identified by name (or "type/name")
+  SmartIF<IService> service(const std::string& name, const bool createIf = true, const bool quiet = false) const;
+
+  /// declare interface
+  void declInterface( const InterfaceID&, void*);
+
+  template <class I> class declareInterface {
+  public:
+    template <class T> declareInterface(T* tool) {
+      tool->declInterface( I::interfaceID(), (I*)tool);
+    }
+  };
+  // ==========================================================================
+  /** Declare the named property
+   *
+   *  @code
+   *
+   *  MyTool ( const std::string& type   ,
+   *           const std::string& name   ,
+   *           const IInterface*  parent )
+   *     : AlgTool  ( type , name , pSvc )
+   *     , m_property1   ( ... )
+   *     , m_property2   ( ... )
+   *   {
+   *     // declare the property
+   *     declareProperty( "Property1" , m_property1 , "Doc fro property #1" ) ;
+   *
+   *     // declare the property and attach the handler  to it
+   *     declareProperty( "Property2" , m_property2 , "Doc for property #2" )
+   *        -> declareUpdateHandler( &MyAlg::handler_2 ) ;
+   *
+   *   }
+   *  @endcode
+   *
+   *  @see PropertyMgr
+   *  @see PropertyMgr::declareProperty
+   *
+   *  @param name the property name
+   *  @param property the property itself,
+   *  @param doc      the documentation string
+   *  @return the actual property objects
+   */
+  template <class T>
+  Property* declareProperty
+  ( const std::string& name         ,
+    T&                 property     ,
+    const std::string& doc = "none" ) const
+  {
+    return m_propertyMgr -> declareProperty ( name , property , doc ) ;
+  }
+  /// Declare remote named properties
+  Property* declareRemoteProperty
+  ( const std::string& name       ,
+    IProperty*         rsvc       ,
+    const std::string& rname = "" ) const
+  {
+    return m_propertyMgr-> declareRemoteProperty ( name , rsvc , rname ) ;
+  }
+  // ==========================================================================
+  /// Access the auditor service
+  IAuditorSvc* auditorSvc() const;
+
+  /** @brief Access the monitor service
+   *
+   *   @attention Note that this method will return a NULL pointer if no monitor service is
+   *              configured to be present. You must take this possibility into account when
+   *              using the pointer
+   *   @return Pointer to the Monitor service
+   *   @retval NULL No monitor service is present
+   *   @retval non-NULL A monitor service is present and available to be used
+   */
+  inline IMonitorSvc* monitorSvc() const
+  {
+    // If not already located try to locate it without forcing a creation
+    if ( !m_pMonitorSvc ){
+      service_i( m_monitorSvcName, false,
+                 IMonitorSvc::interfaceID(), pp_cast<void>(&m_pMonitorSvc) ).ignore();
+    }
+    return m_pMonitorSvc;
+  }
+
+  /** Declare monitoring information
+      @param name Monitoring information name known to the external system
+      @param var  Monitoring Listener address (the item to monitor...)
+      @param desc Textual description of the information being monitored
+  */
+  template <class T>
+  void declareInfo( const std::string& name,
+                    const T& var,
+                    const std::string& desc ) const
+  {
+    IMonitorSvc* mS = monitorSvc();
+    if ( mS ) mS->declareInfo(name, var, desc, this);
+  }
+
+  /** Declare monitoring information (special case)
+      @param name Monitoring information name known to the external system
+      @param format Format information
+      @param var  Monitoring Listener address
+      @param size Monitoring Listener address size
+      @param desc Textual description of the information being monitored
+  */
+  void declareInfo( const std::string& name,
+                    const std::string& format,
+                    const void* var,
+                    int size,
+                    const std::string& desc ) const
+  {
+    IMonitorSvc* mS = monitorSvc();
+    if ( mS ) mS->declareInfo(name, format, var, size, desc, this);
+  }
+
+protected:
+
+  /// get tool's output level
+  int           outputLevel () const { return (int)m_outputLevel ; }
+
+  /// Accessor for the Message level property
+  IntegerProperty & outputLevelProperty() { return m_outputLevel; }
+
+  /** callback for output level property */
+  void initOutputLevel(Property& prop);
+
+
+
+protected:
+
+  // Standard destructor.
+  virtual ~AlgTool();
+
+private:
+  typedef std::list<std::pair<InterfaceID,void*> >  InterfaceList;
+  IntegerProperty      m_outputLevel;      ///< AlgTool output level
+  std::string          m_type;             ///< AlgTool type (concrete class name)
+  const std::string    m_name;             ///< AlgTool full name
+  const IInterface*    m_parent;           ///< AlgTool parent
+  mutable ISvcLocator* m_svcLocator;       ///< Pointer to Service Locator service
+  mutable IMessageSvc* m_messageSvc;       ///< Message service
+  mutable IToolSvc*    m_ptoolSvc;         ///< Tool service
+  mutable IMonitorSvc* m_pMonitorSvc;      ///< Online Monitoring Service
+  std::string          m_monitorSvcName;   ///< Name to use for Monitor Service
+  PropertyMgr*         m_propertyMgr;      ///< Property Manager
+  InterfaceList        m_interfaceList;    ///< Interface list
+  std::string          m_threadID;         ///< Thread Id for Alg Tool
+
+  /** implementation of service method */
+  StatusCode service_i(const std::string& algName,
+                       bool createIf,
+                       const InterfaceID& iid,
+                       void** ppSvc) const;
+  StatusCode service_i(const std::string& svcType,
+                       const std::string& svcName,
+                       const InterfaceID& iid,
+                       void** ppS) const;
+
+  mutable IAuditorSvc*      m_pAuditorSvc; ///< Auditor Service
+
+  BooleanProperty m_auditInit;
+  bool         m_auditorInitialize;///< flag for auditors in "initialize()"
+  bool         m_auditorStart;     ///< flag for auditors in "start()"
+  bool         m_auditorStop;      ///< flag for auditors in "stop()"
+  bool         m_auditorFinalize;  ///< flag for auditors in "finalize()"
+  bool         m_auditorReinitialize;///< flag for auditors in "reinitialize()"
+  bool         m_auditorRestart;     ///< flag for auditors in "restart()"
+
+  Gaudi::StateMachine::State m_state;            ///< state of the Tool
+  Gaudi::StateMachine::State m_targetState;      ///< state of the Tool
+};
+
+#endif // GAUDIKERNEL_ALGTOOL_H

GaudiKernel/AlgToolHistory.h

+// $Id: AlgToolHistory.h,v 1.1 2006/11/09 10:24:04 mato Exp $
+
+#ifndef GAUDIKERNEL_ALGTOOLHISTORY_H
+#define GAUDIKERNEL_ALGTOOLHISTORY_H
+
+#include "GaudiKernel/HistoryObj.h"
+#include "GaudiKernel/IVersHistoryObj.h"
+
+class Property;
+class AlgTool;
+class JobHistory;
+
+#include <string>
+#include <vector>
+
+/** @class AlgToolHistory AlgToolHistory.h
+ *
+ *  AlgToolHistory class definition
+ *
+ *  @author: Charles Leggett
+ *
+ */
+
+class GAUDI_API AlgToolHistory: public HistoryObj, public IVersHistoryObj {
+
+private:  // data
+
+  // Algtool full type.
+  std::string m_type;
+
+  // Algtool version.
+  std::string m_version;
+
+  // Algtool name.
+  std::string m_name;
+
+  // Pointer to the algtool
+  const AlgTool *m_tool;
+
+  // Properties.
+  PropertyList m_properties;
+
+  // Link to jobHistory
+  const JobHistory *m_jobHistory;
+
+public:
+
+  AlgToolHistory(const AlgTool& alg, const JobHistory* job);
+
+  AlgToolHistory(const std::string& algVersion,
+		 const std::string& algName,
+		 const std::string& algType,
+		 const AlgTool* tool,
+		 const PropertyList& props,
+		 const JobHistory* job);
+
+  // Destructor.
+  virtual ~AlgToolHistory() {};
+
+  // Class IDs
+  virtual const CLID& clID() const { return classID(); }
+  static const CLID& classID();
+
+ // Return the algtool type.
+  const std::string& algtool_type() const { return m_type; }
+
+  // Return the algtool version.
+  const std::string& algtool_version() const { return m_version; }
+
+  // Return the algtool name.
+  const std::string& algtool_name() const { return m_name; }
+
+  // Pointer to the algtool
+  const AlgTool* algtool_instance() const { return m_tool; }
+
+  // Return the algorithm properties.
+  const PropertyList& properties() const { return m_properties; }
+
+  void dump(std::ostream &, const bool isXML=false, int indent=0) const;
+
+  const std::string& name() const { return algtool_name(); }
+  const std::string& type() const { return algtool_type(); }
+  const std::string& version() const { return algtool_version(); }
+
+
+};
+
+// Output stream.
+GAUDI_API std::ostream& operator<<(std::ostream& lhs, const AlgToolHistory& rhs);
+
+#endif
+

GaudiKernel/Algorithm.h

+// $Id: Algorithm.h,v 1.34 2008/06/02 14:20:38 marcocle Exp $
+// ============================================================================
+#ifndef GAUDIKERNEL_ALGORITHM_H
+#define GAUDIKERNEL_ALGORITHM_H
+// ============================================================================
+// Include files
+// ============================================================================
+#include "GaudiKernel/IProperty.h"
+#include "GaudiKernel/IAlgorithm.h"
+#include "GaudiKernel/IService.h"
+#include "GaudiKernel/PropertyMgr.h"
+#include "GaudiKernel/ISvcLocator.h"
+#include "GaudiKernel/IMessageSvc.h"
+#include "GaudiKernel/IStateful.h"
+
+#include <string>
+#include <vector>
+
+// Extra include files (forward declarations should be sufficient)
+#include "GaudiKernel/IDataProviderSvc.h"
+#include "GaudiKernel/IHistogramSvc.h"
+#include "GaudiKernel/IConversionSvc.h"
+#include "GaudiKernel/INTupleSvc.h"
+#include "GaudiKernel/IChronoStatSvc.h"
+#include "GaudiKernel/IRndmGenSvc.h"
+#include "GaudiKernel/IAuditorSvc.h"
+#include "GaudiKernel/IToolSvc.h"
+#include "GaudiKernel/IMonitorSvc.h"
+#include "GaudiKernel/IExceptionSvc.h"
+#include "GaudiKernel/IAlgContextSvc.h"
+#include "GaudiKernel/Property.h"
+
+#ifndef PACKAGE_VERSION
+#define PACKAGE_VERSION "unknown"
+#endif
+
+/** @class Algorithm Algorithm.h GaudiKernel/Algorithm.h
+ *
+ *  Base class from which all concrete algorithm classes should
+ *  be derived.
+ *
+ *  In order for a concrete algorithm class to do anything
+ *  useful the methods initialize(), execute() and finalize()
+ *  should be overridden.
+ *
+ *  The base class provides utility methods for accessing
+ *  standard services (event data service etc.); for declaring
+ *  properties which may be configured by the job options
+ *  service; and for creating sub algorithms.
+ *  The only base class functionality which may be used in the
+ *  constructor of a concrete algorithm is the declaration of
+ *  member variables as properties. All other functionality,
+ *  i.e. the use of services and the creation of sub-algorithms,
+ *  may be used only in initialize() and afterwards (see the
+ *  Gaudi user guide).
+ *
+ *  @author Paul Maley
+ *  @author Pere Mato
+ *  @author David Quarrie
+ *  @date   1998
+ */
+class GAUDI_API Algorithm: public implements3<IAlgorithm, IProperty, IStateful> {
+public:
+
+  /** Constructor
+   *  @param name    The algorithm object's name
+   *  @param svcloc  A pointer to a service location service
+   */
+  Algorithm( const std::string& name, ISvcLocator *svcloc,
+             const std::string& version=PACKAGE_VERSION );
+  /// Destructor
+  virtual ~Algorithm();
+
+  /** Reinitialization method invoked by the framework. This method is responsible
+   *  for any reinitialization required by the framework itself.
+   *  It will in turn invoke the reinitialize() method of the derived algorithm,
+   * and of any sub-algorithms which it creates.
+   */
+  virtual StatusCode sysStart();
+
+  /** Initialization method invoked by the framework. This method is responsible
+   *  for any bookkeeping of initialization required by the framework itself.
+   *  It will in turn invoke the initialize() method of the derived algorithm,
+   * and of any sub-algorithms which it creates.
+   */
+  virtual StatusCode sysInitialize();
+
+
+  /** Reinitialization method invoked by the framework. This method is responsible
+   *  for any reinitialization required by the framework itself.
+   *  It will in turn invoke the reinitialize() method of the derived algorithm,
+   * and of any sub-algorithms which it creates.
+   */
+  virtual StatusCode sysReinitialize();
+
+  /** Restart method invoked by the framework.
+      It will in turn invoke the restart() method of the derived algorithm,
+      and of any sub-algorithms which it creates.
+  */
+  virtual StatusCode sysRestart();
+
+  /** The actions to be performed by the algorithm on an event. This method is
+   * invoked once per event for top level algorithms by the application
+   *  manager.
+   *  This method invokes execute() method.
+   *  For sub-algorithms either the sysExecute() method or execute() method
+   *  must be EXPLICITLY invoked by  the parent algorithm.
+   */
+  virtual StatusCode sysExecute();
+
+  /** System stop. This method invokes the stop() method of a concrete
+      algorithm and the stop() methods of all of that algorithm's sub algorithms.
+  */
+  virtual StatusCode sysStop();
+
+  /** System finalization. This method invokes the finalize() method of a
+   *  concrete algorithm and the finalize() methods of all of that algorithm's
+   *  sub algorithms.
+   */
+  virtual StatusCode sysFinalize();
+
+  /** beginRun method invoked by the framework. This method is responsible
+      for any beginRun actions required by the framework itself.
+      It will in turn invoke the beginRun() method of the derived algorithm,
+      and of any sub-algorithms which it creates.
+  */
+  virtual StatusCode sysBeginRun( );
+
+  /** endRun method invoked by the framework. This method is responsible
+      for any endRun actions required by the framework itself.
+      It will in turn invoke the endRun() method of the derived algorithm,
+      and of any sub-algorithms which it creates.
+  */
+  virtual StatusCode sysEndRun( );
+
+  /** The identifying name of the algorithm object. This is the name of a
+   *  particular instantiation of an algorithm object as opposed to the name
+   *  of the algorithm itself, e.g. "LinearTrackFit" may be the name of a
+   *  concrete algorithm class,
+   *  whereas "ApproxTrackFit" and "BestTrackFit" may be two instantiations
+   *  of the class configured to find tracks with different fit criteria.
+   */
+  virtual const std::string& name() const;
+
+  virtual const std::string& version() const;
+
+  /// Dummy implementation of IStateful::configure() method
+  virtual StatusCode configure () { return StatusCode::SUCCESS ; }
+  /// Dummy implementation of IStateful::terminate() method
+  virtual StatusCode terminate () { return StatusCode::SUCCESS ; }
+
+  /// the default (empty) implementation of IStateful::initialize() method
+  virtual StatusCode initialize () { return StatusCode::SUCCESS ; }
+  /// the default (empty) implementation of IStateful::start() method
+  virtual StatusCode start () { return StatusCode::SUCCESS ; }
+  /// the default (empty) implementation of IStateful::stop() method
+  virtual StatusCode stop () { return StatusCode::SUCCESS ; }
+  /// the default (empty) implementation of IStateful::finalize() method
+  virtual StatusCode finalize   () { return StatusCode::SUCCESS ; }
+
+  /// the default (empty) implementation of IStateful::reinitialize() method
+  virtual StatusCode reinitialize ();
+  /// the default (empty) implementation of IStateful::restart() method
+  virtual StatusCode restart ();
+
+  /// Has this algorithm been executed since the last reset?
+  virtual bool isExecuted( ) const;
+
+  /// Set the executed flag to the specified state
+  virtual void setExecuted( bool state );
+
+  /** Reset the executed state of the Algorithm for the duration
+   *  of the current event.
+   */
+  virtual void resetExecuted( );
+
+  /** Algorithm begin run. This method is called at the beginning
+   *  of the event loop.
+   */
+  virtual StatusCode beginRun();
+
+  /// Algorithm end run. This method is called at the end of the event loop
+  virtual StatusCode endRun();
+
+  /// returns the current state of the algorithm
+  virtual Gaudi::StateMachine::State FSMState() const { return m_state; }
+
+  /// returns the state the algorithm will be in after the ongoing transition
+  virtual Gaudi::StateMachine::State targetFSMState() const { return m_targetState; }
+
+  /// Is this algorithm enabled or disabled?
+  virtual bool isEnabled( ) const;
+
+  /// Did this algorithm pass or fail its filter criterion for the last event?
+  virtual bool filterPassed( ) const;
+
+  /// Set the filter passed flag to the specified state
+  virtual void setFilterPassed( bool state );
+
+  /// Access a service by name, creating it if it doesn't already exist.
+  template <class T>
+  StatusCode service
+  ( const std::string& name, T*& psvc, bool createIf = true ) const {
+    return service_i(name, createIf, T::interfaceID(), (void**)&psvc);
+  }
+
+  /// Access a service by name and type, creating it if it doesn't already exist.
+  template <class T>
+  StatusCode service( const std::string& svcType, const std::string& svcName,
+                      T*& psvc) const {
+    return service_i(svcType, svcName, T::interfaceID(), (void**)&psvc);
+  }
+
+  /// Return a pointer to the service identified by name (or "type/name")
+  SmartIF<IService> service(const std::string& name, const bool createIf = true, const bool quiet = false) const;
+
+  /// Set the output level for current algorithm
+  void setOutputLevel( int level );
+
+  /** The standard auditor service.May not be invoked before sysInitialize()
+   *  has been invoked.
+   */
+  SmartIF<IAuditorSvc>& auditorSvc() const;
+
+  /** The standard Chrono & Stat service,
+   *  Return a pointer to the service if present
+   */
+  SmartIF<IChronoStatSvc>& chronoSvc() const;
+  /// Obsoleted name, kept due to the backwards compatibility
+  SmartIF<IChronoStatSvc>& chronoStatService() const;
+
+  /** The standard detector data service.
+   *  May not be invoked before sysInitialize() has been invoked.
+   */
+  SmartIF<IDataProviderSvc>& detSvc() const;
+
+  /// Obsoleted name, kept due to the backwards compatibility
+  SmartIF<IDataProviderSvc>& detDataService() const;
+
+  /** The standard detector data persistency conversion service.
+   *  May not be invoked before sysInitialize() has been invoked.
+   */
+  SmartIF<IConversionSvc>& detCnvSvc() const;
+
+  /// Obsoleted name, kept due to the backwards compatibility
+  SmartIF<IConversionSvc>& detDataCnvService() const;
+
+  /** The standard event data service.
+   *  May not be invoked before sysInitialize() has been invoked.
+   */
+  SmartIF<IDataProviderSvc>& eventSvc() const;
+  /// shortcut for  method eventSvc
+  SmartIF<IDataProviderSvc>& evtSvc  () const { return eventSvc() ; }
+  /// Obsoleted name, kept due to the backwards compatibility
+  SmartIF<IDataProviderSvc>& eventDataService() const;
+
+  /** The standard event data persistency conversion service.
+   *  May not be invoked before sysInitialize() has been invoked.
+   */
+  SmartIF<IConversionSvc>&   eventCnvSvc() const;
+  /// Obsoleted name, kept due to the backwards compatibility
+  SmartIF<IConversionSvc>&   eventDataCnvService() const;
+
+  /** The standard histogram service.
+   *  May not be invoked before sysInitialize() has been invoked.
+   */
+  SmartIF<IHistogramSvc>& histoSvc() const;
+  /// Obsoleted name, kept due to the backwards compatibility
+  SmartIF<IHistogramSvc>& histogramDataService() const;
+
+  /** The standard message service.
+   *  Returns a pointer to the standard message service.
+   *  May not be invoked before sysInitialize() has been invoked.
+   */
+  SmartIF<IMessageSvc>&      msgSvc() const;
+
+  /// Obsoleted name, kept due to the backwards compatibility
+  SmartIF<IMessageSvc>&      messageService() const;
+
+  /** The standard N tuple service.
+   *  Returns a pointer to the N tuple service if present.
+   */
+  SmartIF<INTupleSvc>& ntupleSvc() const;
+
+  /// Obsoleted name, kept due to the backwards compatibility
+  SmartIF<INTupleSvc>& ntupleService() const;
+
+  /** AIDA-based NTuple service
+   *  Returns a pointer to the AIDATuple service if present.
+   */
+  // SmartIF<IAIDATupleSvc>& atupleSvc() const;
+
+
+  /** The standard RandomGen service,
+   *  Return a pointer to the service if present
+   */
+  SmartIF<IRndmGenSvc>& randSvc() const;
+
+  /// The standard ToolSvc service, Return a pointer to the service if present
+  SmartIF<IToolSvc>& toolSvc() const;
+
+  /// Get the exception Service
+  SmartIF<IExceptionSvc>& exceptionSvc() const;
+
+  /// get Algorithm Context Service 
+  SmartIF<IAlgContextSvc>& contextSvc() const ;
+  
+  /** The standard service locator.
+   *  Returns a pointer to the service locator service.
+   *  This service may be used by an algorithm to request
+   *  any services it requires in addition to those provided by default.
+   */
+  SmartIF<ISvcLocator>& serviceLocator() const;
+  /// shortcut for method serviceLocator
+  SmartIF<ISvcLocator>& svcLoc        () const { return serviceLocator() ; }
+
+  /// register for Algorithm Context Service? 
+  bool registerContext() const { return m_registerContext ; }
+  
+  /** Create a sub algorithm.
+   *  A call to this method creates a child algorithm object.
+   *  Note that the returned pointer is to Algorithm
+   *  (as opposed to IAlgorithm), and thus the methods of IProperty
+   *  are also available for the direct setting of the sub-algorithm's
+   *  properties. Using this mechanism instead of creating daughter
+   *  algorithms directly via the new operator is prefered since then
+   *  the framework may take care of all of the necessary book-keeping.
+   *  @param type The concrete algorithm class of the sub algorithm
+   *  @param name The name to be given to the sub algorithm
+   *  @param pSubAlg Set to point to the newly created algorithm object
+   */
+  StatusCode createSubAlgorithm( const std::string& type,
+                                 const std::string& name, Algorithm*& pSubAlg );
+
+  /// List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms
+  std::vector<Algorithm*>* subAlgorithms() const;
+
+  /// Implementation of IProperty::setProperty
+  virtual StatusCode setProperty( const Property& p );
+  /// Implementation of IProperty::setProperty
+  virtual StatusCode setProperty( const std::string& s );
+  /// Implementation of IProperty::setProperty
+  virtual StatusCode setProperty( const std::string& n, const std::string& v);
+  /// Implementation of IProperty::getProperty
+  virtual StatusCode getProperty(Property* p) const;
+  /// Implementation of IProperty::getProperty
+  virtual const Property& getProperty( const std::string& name) const;
+  /// Implementation of IProperty::getProperty
+  virtual StatusCode getProperty( const std::string& n, std::string& v ) const;
+  /// Implementation of IProperty::getProperties
+  virtual const std::vector<Property*>& getProperties( ) const;
+
+  /** Set the algorithm's properties.
+   *  This method requests the job options service
+   *  to set the values of any declared properties.
+   *  The method is invoked from within sysInitialize() by the framework
+   *  and does not need to be explicitly
+   *  called by a concrete algorithm.
+   */
+  StatusCode setProperties();
+  // ==========================================================================
+  /** Declare the named property
+   *
+   *
+   *  @code
+   *
+   *  MyAlg ( const std::string& name ,
+   *          ISvcLocator*       pSvc )
+   *     : Algorithm ( name , pSvc )
+   *     , m_property1   ( ... )
+   *     , m_property2   ( ... )
+   *   {
+   *     // declare the property
+   *     declareProperty( "Property1" , m_property1 , "Doc fro property #1" ) ;
+   *
+   *     // declare the property and attach the handler  to it
+   *     declareProperty( "Property2" , m_property2 , "Doc for property #2" )
+   *        -> declareUpdateHandler( &MyAlg::handler_2 ) ;
+   *
+   *   }
+   *  @endcode
+   *
+   *  @see PropertyMgr
+   *  @see PropertyMgr::declareProperty
+   *
+   *  @param name the property name
+   *  @param property the property itself,
+   *  @param doc      the documentation string
+   *  @return the actual property objects
+   */
+  template <class T>
+  Property* declareProperty
+  ( const std::string& name              ,
+    T&                 property          ,
+    const std::string& doc      = "none" ) const
+  {
+    return m_propertyMgr->declareProperty(name, property, doc);
+  }
+  // ==========================================================================
+  /// Declare remote named properties
+  Property* declareRemoteProperty
+  ( const std::string& name       ,
+    IProperty*         rsvc       ,
+    const std::string& rname = "" ) const
+  {
+    return m_propertyMgr -> declareRemoteProperty ( name , rsvc , rname );
+  }
+  // ==========================================================================
+  /** @brief Access the monitor service
+   *
+   *   @attention Note that this method will return a NULL pointer if no monitor service is
+   *              configured to be present. You must take this possibility into account when
+   *              using the pointer
+   *   @return Pointer to the Monitor service
+   *   @retval NULL No monitor service is present
+   *   @retval non-NULL A monitor service is present and available to be used
+   */
+  inline SmartIF<IMonitorSvc>& monitorSvc() const
+  {
+    // If not already located try to locate it without forcing a creation
+    if ( !m_pMonitorSvc.isValid() ){
+      m_pMonitorSvc = service(m_monitorSvcName, false, true); // do not create and be quiet
+    }
+    return m_pMonitorSvc;
+  }
+
+  /** Declare monitoring information
+      @param name Monitoring information name known to the external system
+      @param var  Monitoring Listener address (the item to monitor...)
+      @param desc Textual description of the information being monitored
+  */
+  template <class T>
+  void declareInfo( const std::string& name,
+                    const T& var,
+                    const std::string& desc ) const
+  {
+    IMonitorSvc* mS = monitorSvc().get();
+    if ( mS ) mS->declareInfo(name, var, desc, this);
+  }
+
+  /** Declare monitoring information (special case)
+      @param name Monitoring information name known to the external system
+      @param format Format information
+      @param var  Monitoring Listener address
+      @param size Monitoring Listener address size
+      @param desc Textual description of the information being monitored
+  */
+  void declareInfo( const std::string& name,
+                    const std::string& format,
+                    const void* var,
+                    int size,
+                    const std::string& desc ) const
+  {
+    IMonitorSvc* mS = monitorSvc().get();
+    if ( mS ) mS->declareInfo(name, format, var, size, desc, this);
+  }
+
+  // ==========================================================================
+public:
+  // ==========================================================================
+  /** set the property form the value
+   *
+   *  @code
+   *
+   *  std::vector<double> data = ... ;
+   *
+   *  setProperty( "Data" , data ) ;
+   *
+   *  std::map<std::string,double> cuts = ... ;
+   *  setProperty( "Cuts" , cuts ) ;
+   *
+   *  std::map<std::string,std::string> dict = ... ;
+   *  setProperty( "Dictionary" , dict ) ;
+   *
+   *  @endcode
+   *
+   *  Note: the interface IProperty allows setting of the properties either
+   *        directly from other properties or from strings only
+   *
+   *  This is very convenient in resetting of the default
+   *  properties in the derived classes.
+   *  E.g. without this method one needs to convert
+   *  everything into strings to use IProperty::setProperty
+   *
+   *  @code
+   *
+   *    setProperty ( "OutputLevel" , "1"    ) ;
+   *    setProperty ( "Enable"      , "True" ) ;
+   *    setProperty ( "ErrorMax"    , "10"   ) ;
+   *
+   *  @endcode
+   *
+   *  For simple cases it is more or less ok, but for complicated properties
+   *  it is just ugly..
+   *
+   *  @param name      name of the property
+   *  @param value     value of the property
+   *  @see Gaudi::Utils::setProperty
+   *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
+   *  @date 2007-05-13
+   */
+  template <class TYPE>
+  StatusCode setProperty
+  ( const std::string& name  ,
+    const TYPE&        value )
+  { return Gaudi::Utils::setProperty ( m_propertyMgr , name , value ) ; }
+  // ==========================================================================
+protected:
+
+  /// Has the Algorithm already been initialized?
+  bool isInitialized( ) const { return Gaudi::StateMachine::INITIALIZED == m_state; }
+
+  /// Has the Algorithm already been finalized?
+  bool isFinalized( ) const { return Gaudi::StateMachine::CONFIGURED == m_state; }
+
+  /// retrieve the Algorithm output level
+  int  outputLevel() const { return (int)m_outputLevel ; }
+
+  /// Accessor for the Message level property
+  IntegerProperty & outputLevelProperty() { return m_outputLevel; }
+
+  /// callback for output level property
+  void initOutputLevel(Property& prop);
+
+
+private:
+
+  std::string m_name;            ///< Algorithm's name for identification
+  std::string m_version;         ///< Algorithm's version
+  std::vector<Algorithm *>* m_subAlgms; ///< Sub algorithms
+
+  mutable SmartIF<IMessageSvc>      m_MS;       ///< Message service
+  mutable SmartIF<IDataProviderSvc> m_EDS;      ///< Event data service
+  mutable SmartIF<IConversionSvc>   m_ECS;      ///< Event conversion service
+  mutable SmartIF<IDataProviderSvc> m_DDS;      ///< Detector data service
+  mutable SmartIF<IConversionSvc>   m_DCS;      ///< Detector conversion service
+  mutable SmartIF<IHistogramSvc>    m_HDS;      ///< Histogram data service
+  mutable SmartIF<INTupleSvc>       m_NTS;      ///< N tuple service
+  //  mutable SmartIF<IAIDATupleSvc>    m_ATS;      ///< AIDA tuple service
+  mutable SmartIF<IChronoStatSvc>   m_CSS;      ///< Chrono & Stat Service
+  mutable SmartIF<IRndmGenSvc>      m_RGS;      ///< Random Number Generator Service
+  mutable SmartIF<IExceptionSvc>    m_EXS;      ///< Exception Handler Service
+  mutable SmartIF<IAuditorSvc>      m_pAuditorSvc; ///< Auditor Service
+  mutable SmartIF<IToolSvc>         m_ptoolSvc;    ///< ToolSvc Service
+  mutable SmartIF<IMonitorSvc>      m_pMonitorSvc; ///< Online Monitoring Service
+  mutable SmartIF<IAlgContextSvc>   m_contextSvc ; ///< Algorithm Context Service
+  bool  m_registerContext ; ///< flag to register for Algorithm Context Service 
+  std::string               m_monitorSvcName; ///< Name to use for Monitor Service
+  SmartIF<ISvcLocator>  m_pSvcLocator;      ///< Pointer to service locator service
+  PropertyMgr* m_propertyMgr;      ///< For management of properties
+  IntegerProperty m_outputLevel;   ///< Algorithm output level
+  int          m_errorMax;         ///< Algorithm Max number of errors
+  int          m_errorCount;       ///< Algorithm error counter
+  BooleanProperty m_auditInit;     ///< global flag for auditors
+  bool         m_auditorInitialize;///< flag for auditors in "initialize()"
+  bool         m_auditorReinitialize;///< flag for auditors in "Reinitialize()"
+  bool         m_auditorRestart;   ///< flag for auditors in "Restart()"
+  bool         m_auditorExecute;   ///< flag for auditors in "execute()"
+  bool         m_auditorFinalize;  ///< flag for auditors in "finalize()"
+  bool         m_auditorBeginRun;  ///< flag for auditors in "beginRun()"
+  bool         m_auditorEndRun;    ///< flag for auditors in "endRun()"
+  bool         m_auditorStart;///< flag for auditors in "initialize()"
+  bool         m_auditorStop;///< flag for auditors in "Reinitialize()"
+  bool         m_filterPassed;     ///< Filter passed flag
+  bool         m_isEnabled;        ///< Algorithm is enabled flag
+  bool         m_isExecuted;       ///< Algorithm is executed flag
+  Gaudi::StateMachine::State m_state;            ///< Algorithm has been initialized flag
+  Gaudi::StateMachine::State m_targetState;      ///< Algorithm has been initialized flag
+  bool         m_isFinalized;      ///< Algorithm has been finalized flag
+
+  /// implementation of service method
+  StatusCode service_i(const std::string& svcName,
+                       bool createIf,
+                       const InterfaceID& iid,
+                       void** ppSvc) const;
+  StatusCode service_i(const std::string& svcType,
+                       const std::string& svcName,
+                       const InterfaceID& iid,
+                       void** ppSvc) const;
+
+  /// Private Copy constructor: NO COPY ALLOWED
+  Algorithm(const Algorithm& a);
+
+  /// Private assignment operator: NO ASSIGNMENT ALLOWED
+  Algorithm& operator=(const Algorithm& rhs);
+};
+
+#endif //GAUDIKERNEL_ALGORITHM_H

GaudiKernel/AlgorithmHistory.h

+// $Id: AlgorithmHistory.h,v 1.1 2006/11/09 10:24:04 mato Exp $
+
+#ifndef GAUDIKERNEL_ALGORITHMHISTORY_H
+#define GAUDIKERNEL_ALGORITHMHISTORY_H
+
+// An object of this class carries the history information
+// which is specific to a Gaudi algorithm.
+
+#include "GaudiKernel/HistoryObj.h"
+#include "GaudiKernel/IVersHistoryObj.h"
+
+#include <iosfwd>
+#include <string>
+#include <typeinfo>
+#include <vector>
+
+class Algorithm;
+class Property;
+class JobHistory;
+
+/** @class AlgorithmHistory AlgorithmHistory.h
+ *
+ *  AlgorithmHistory class definition
+ *
+ *  @author: Charles Leggett
+ *
+ */
+
+class GAUDI_API AlgorithmHistory: public HistoryObj, public IVersHistoryObj {
+
+public:  // typedefs
+
+  // List of subalgorithm histories. This may change.
+  typedef std::vector<const AlgorithmHistory*> HistoryList;
+
+private:  // data
+
+  // Algorithm full type.
+  std::string m_algorithm_type;
+
+  // Algorithm version.
+  std::string m_algorithm_version;
+
+  // Algorithm name.
+  std::string m_algorithm_name;
+
+  // Algorithm
+  const Algorithm* m_algorithm;
+
+  // Properties.
+  PropertyList m_properties;
+
+  // Subalgorithm histories.
+  HistoryList m_subalgorithm_histories;
+
+  // Link to jobHistory
+  const JobHistory *m_jobHistory;
+
+public:  // functions
+
+  // Constructor from the algorithm.
+  explicit AlgorithmHistory(const Algorithm& alg, const JobHistory* job);
+
+  // All-fields Constructor for persistency
+  explicit AlgorithmHistory(const std::string& algVersion,
+			    const std::string& algName,
+			    const std::string& algType,
+			    const PropertyList& props,
+			    const HistoryList& subHists);
+  // Destructor.
+  virtual ~AlgorithmHistory();
+
+  // Class IDs
+  virtual const CLID& clID() const { return classID(); }
+  static const CLID& classID();
+
+  // Return the algorithm type.
+  const std::string& algorithm_type() const { return m_algorithm_type; }
+
+  // Return the algorithm version.
+  const std::string& algorithm_version() const { return m_algorithm_version; }
+
+  // Return the algorithm name.
+  const std::string& algorithm_name() const { return m_algorithm_name; }
+
+  // The actual algorithm
+  const Algorithm* algorithm() const { return m_algorithm; }
+
+  // Return the algorithm properties.
+  const PropertyList& properties() const { return m_properties; }
+
+  // Return the subalgorithm histories.
+  const HistoryList& subalgorithm_histories() const
+    { return m_subalgorithm_histories; }
+
+  // Return the jobHistory
+  const JobHistory* jobHistory() const { return m_jobHistory; }
+
+
+  void dump(std::ostream &, const bool isXML=false, int indent=0) const;
+
+  const std::string& name() const { return algorithm_name(); }
+  const std::string& type() const { return algorithm_type(); }
+  const std::string& version() const { return algorithm_version(); }
+
+};
+
+// Output stream.
+GAUDI_API std::ostream& operator<<(std::ostream& lhs, const AlgorithmHistory& rhs);
+
+#endif

GaudiKernel/Allocator.h

+// $Id: Allocator.h,v 1.1 2006/02/14 15:01:12 hmd Exp $
+// ============================================================================
+// CVS tag $Name:  $, version $Revision: 1.1 $
+// ============================================================================
+/** @file
+ *  Allocator
+ *  The file is copied form Geant4 project
+ *  @date 2006-02-10
+ */
+// ============================================================================
+
+//
+// ********************************************************************
+// * DISCLAIMER                                                       *
+// *                                                                  *
+// * The following disclaimer summarizes all the specific disclaimers *
+// * of contributors to this software. The specific disclaimers,which *
+// * govern, are listed with their locations in:                      *
+// *   http://cern.ch/geant4/license                                  *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.                                                             *
+// *                                                                  *
+// * This  code  implementation is the  intellectual property  of the *
+// * GEANT4 collaboration.                                            *
+// * By copying,  distributing  or modifying the Program (or any work *
+// * based  on  the Program)  you indicate  your  acceptance of  this *
+// * statement, and all its terms.                                    *
+// ********************************************************************
+//
+//
+// ------------------------------------------------------------
+// GEANT 4 class header file
+//
+// Class Description:
+//
+// A class for fast allocation of objects to the heap through a pool of
+// chunks organised as linked list. It's meant to be used by associating
+// it to the object to be allocated and defining for it new and delete
+// operators via MallocSingle() and FreeSingle() methods.
+
+//      ---------------- G4Allocator ----------------
+//
+// Author: G.Cosmo (CERN), November 2000
+// ------------------------------------------------------------
+
+// ============================================================================
+#ifndef GAUDIKERNEL_Allocator_h
+#define GAUDIKERNEL_Allocator_h 1
+// ============================================================================
+// Incldue files
+// ============================================================================
+// STD & STL
+// ============================================================================
+#include <cstddef>
+// ============================================================================
+// GaudiKernel
+// ============================================================================
+#include "GaudiKernel/AllocatorPool.h"
+// ============================================================================
+
+
+namespace GaudiUtils
+{
+  /** @class Allocator Allocator.h GaudiKernel/Allocator.h
+   *  Allocator.
+   *  The class is imported from Geant4 project
+   *  @date 2006-02-10
+   */
+  template <class Type>
+  class Allocator
+  {
+  public:  // with description
+
+    /// Constructor
+    Allocator() throw();
+    /// destructor
+    ~Allocator() throw();
+
+    /** Malloc and Free methods to be used when overloading
+     *  new and delete operators in the client &lt;Type&gt; object
+     */
+    inline Type* MallocSingle();
+    inline void FreeSingle(Type* anElement);
+
+    /** Returns allocated storage to the free store, resets
+     *  allocator and page sizes.
+     *  Note: contents in memory are lost using this call !
+     */
+    inline void ResetStorage();
+
+    /// Returns the size of the total memory allocated
+    inline size_t GetAllocatedSize() const;
+
+  public:  // without description
+
+    // This public section includes standard methods and types
+    // required if the allocator is to be used as alternative
+    // allocator for STL containers.
+    // NOTE: the code below is a trivial implementation to make
+    //       this class an STL compliant allocator.
+    //       It is anyhow NOT recommended to use this class as
+    //       alternative allocator for STL containers !
+
+    typedef Type value_type;
+    typedef size_t size_type;
+    typedef ptrdiff_t difference_type;
+    typedef Type* pointer;
+    typedef const Type* const_pointer;
+    typedef Type& reference;
+    typedef const Type& const_reference;
+
+    /// Copy constructor
+    template <class U> Allocator
+    (const Allocator<U>& right) throw()
+      : mem(right.mem) {}
+
+    /// Returns the address of values
+    pointer address(reference r) const { return &r; }
+    const_pointer address(const_reference r) const { return &r; }
+
+    /// Allocates space for n elements of type Type, but does not initialise
+    pointer allocate(size_type n, void* hint = 0)
+    {
+      // Allocates space for n elements of type Type, but does not initialise
+      //
+      Type* mem_alloc = 0;
+      if (n == 1)
+        mem_alloc = MallocSingle();
+      else
+        mem_alloc = static_cast<Type*>(::operator new(n*sizeof(Type)));
+      return mem_alloc;
+    }
+
+    /// Deallocates n elements of type Type, but doesn't destroy
+    void deallocate(pointer p, size_type n)
+    {
+      // Deallocates n elements of type Type, but doesn't destroy
+      //
+      if (n == 1)
+        FreeSingle(p);
+      else
+        ::operator delete((void*)p);
+      return;
+    }
+
+    /// Initialises *p by val
+    void construct(pointer p, const Type& val) { new((void*)p) Type(val); }
+    /// Destroy *p but doesn't deallocate
+    void destroy(pointer p) { p->~Type(); }
+
+    /// Returns the maximum number of elements that can be allocated
+    size_type max_size() const throw()
+    {
+      // Returns the maximum number of elements that can be allocated
+      //
+      return 2147483647/sizeof(Type);
+    }
+
+    // Rebind allocator to type U
+    template <class U>
+    struct rebind { typedef Allocator<U> other; };
+
+  private:
+
+    GaudiUtils::AllocatorPool mem;
+    // Pool of elements of sizeof(Type)
+  };
+
+} // end of the namespace GaudiUtils
+
+// ------------------------------------------------------------
+// Inline implementation
+// ------------------------------------------------------------
+
+// Initialization of the static pool
+//
+// template <class Type> G4AllocatorPool G4Allocator<Type>::mem(sizeof(Type));
+
+// ************************************************************
+// G4Allocator constructor
+// ************************************************************
+//
+template <class Type>
+GaudiUtils::Allocator<Type>::Allocator() throw()
+  : mem(sizeof(Type))
+{
+}
+
+// ************************************************************
+// G4Allocator destructor
+// ************************************************************
+//
+template <class Type>
+GaudiUtils::Allocator<Type>::~Allocator() throw()
+{
+}
+
+// ************************************************************
+// MallocSingle
+// ************************************************************
+//
+template <class Type>
+Type* GaudiUtils::Allocator<Type>::MallocSingle()
+{
+  return static_cast<Type*>(mem.Alloc());
+}
+
+// ************************************************************
+// FreeSingle
+// ************************************************************
+//
+template <class Type>
+void GaudiUtils::Allocator<Type>::FreeSingle(Type* anElement)
+{
+  mem.Free(anElement);
+  return;
+}
+
+// ************************************************************
+// ResetStorage
+// ************************************************************
+//
+template <class Type>
+void GaudiUtils::Allocator<Type>::ResetStorage()
+{
+  // Clear all allocated storage and return it to the free store
+  //
+  mem.Reset();
+  return;
+}
+
+// ************************************************************
+// GetAllocatedSize
+// ************************************************************
+//
+template <class Type>
+size_t GaudiUtils::Allocator<Type>::GetAllocatedSize() const
+{
+  return mem.Size();
+}
+
+// ************************************************************
+// operator==
+// ************************************************************
+//
+template <class T1, class T2>
+bool operator==
+(const GaudiUtils::Allocator<T1>&,
+ const GaudiUtils::Allocator<T2>&) throw()
+{
+  return true;
+}
+
+// ************************************************************
+// operator!=
+// ************************************************************
+//
+template <class T1, class T2>
+bool operator!=
+(const GaudiUtils::Allocator<T1>&,
+ const GaudiUtils::Allocator<T2>&) throw()
+{
+  return false;
+}
+
+// ============================================================================
+// The END
+// ============================================================================
+#endif
+// ============================================================================
+

GaudiKernel/AllocatorPool.h

+// $Id: AllocatorPool.h,v 1.3 2007/05/24 14:39:11 hmd Exp $
+// ============================================================================
+// CVS tag $Name:  $, version $Revision: 1.3 $
+// ============================================================================
+/** @file
+ *  Allocator pool.
+ *  Class is imported from Geant4 project
+ *  @date 2006-02-14
+ */
+// ============================================================================
+
+//
+// ********************************************************************
+// * DISCLAIMER                                                       *
+// *                                                                  *
+// * The following disclaimer summarizes all the specific disclaimers *
+// * of contributors to this software. The specific disclaimers,which *
+// * govern, are listed with their locations in:                      *
+// *   http://cern.ch/geant4/license                                  *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.                                                             *
+// *                                                                  *
+// * This  code  implementation is the  intellectual property  of the *
+// * GEANT4 collaboration.                                            *
+// * By copying,  distributing  or modifying the Program (or any work *
+// * based  on  the Program)  you indicate  your  acceptance of  this *
+// * statement, and all its terms.                                    *
+// ********************************************************************
+//
+// -------------------------------------------------------------------
+//      GEANT 4 class header file
+//
+// Class description:
+//
+// Class implementing a memory pool for fast allocation and deallocation
+// of memory chunks.  The size of the chunks for small allocated objects
+// is fixed to 1Kb and takes into account of memory alignment; for large
+// objects it is set to 10 times the object's size.
+// The implementation is derived from: B.Stroustrup, The C++ Programming
+// Language, Third Edition.
+
+//           -------------- G4AllocatorPool ----------------
+//
+// Author: G.Cosmo (CERN), November 2000
+// -------------------------------------------------------------------
+
+#ifndef GAUDIKERNEL_AllocatorPool_h
+#define GAUDIKERNEL_AllocatorPool_h 1
+
+#include "GaudiKernel/Kernel.h"
+
+namespace GaudiUtils
+{
+  /** @class AllocatorPool AllocatorPool.h GaudiKernel/AllocatorPool.h
+   *
+   *  Allocator pool.
+   *  Class is imported from Geant4 project
+   *
+   *  @date 2006-02-14
+   */
+  class GAUDI_API AllocatorPool
+  {
+  public:
+
+    /// Create a pool of elements of size n
+    explicit AllocatorPool( unsigned int n=0 );
+    /// Destructor. Return storage to the free store
+    ~AllocatorPool();
+    /// Copy constructor
+    AllocatorPool(const AllocatorPool& right);
+    /// Allocate one element
+    inline void* Alloc();
+    /// Return an element back to the pool
+    inline void  Free( void* b );
+    /// Return storage size
+    inline unsigned int  Size() const;
+    /// Return storage to the free store
+    void  Reset();
+
+  private:
+
+    /// Private equality operator
+    AllocatorPool& operator= (const AllocatorPool& right);
+
+  private:
+
+    struct PoolLink
+    {
+      PoolLink* next;
+    };
+    class PoolChunk
+    {
+    public:
+      explicit PoolChunk(unsigned int sz)
+        : size(sz), mem(new char[size]), next(0) {;}
+      ~PoolChunk() { delete [] mem; }
+      const unsigned int size;
+      char* mem;
+      PoolChunk* next;
+    };
+
+    /// Make pool larger
+    void Grow();
+
+  private:
+
+    const unsigned int esize;
+    const unsigned int csize;
+    PoolChunk* chunks;
+    PoolLink* head;
+    int nchunks;
+  };
+
+} // end of namespace GaudiUtils
+
+
+
+// ************************************************************
+// Alloc
+// ************************************************************
+//
+inline void*
+GaudiUtils::AllocatorPool::Alloc()
+{
+  if ( head==0 ) { Grow(); }
+  PoolLink* p = head;  // return first element
+  head = p->next;
+  return p;
+}
+
+// ************************************************************
+// Free
+// ************************************************************
+//
+inline void
+GaudiUtils::AllocatorPool::Free( void* b )
+{
+  PoolLink* p = static_cast<PoolLink*>(b);
+  p->next = head;        // put b back as first element
+  head = p;
+}
+
+// ************************************************************
+// Size
+// ************************************************************
+//
+inline unsigned int
+GaudiUtils::AllocatorPool::Size() const
+{
+  return nchunks*csize;
+}
+
+
+// ============================================================================
+// The END
+// ============================================================================
+#endif
+// ============================================================================
+

GaudiKernel/AppReturnCode.h

+/**
+ * Helper functions to set/get the application return code.
+ *
+ * @author Marco Clemencic
+ */
+#ifndef APPRETURNCODE_H_