OutputStream Class Reference

A small to stream Data I/O. More...

#include <src/PersistencySvc/OutputStream.h>

Inheritance diagram for OutputStream:
Collaboration diagram for OutputStream:

Public Types

typedef std::vector< DataStoreItem * > Items
 
typedef std::vector< std::string > ItemNames
 
typedef std::map< Algorithm *, ItemsAlgDependentItems
 
typedef std::map< std::string, ItemNamesAlgDependentItemNames
 
- Public Types inherited from Algorithm
typedef Gaudi::PluginService::Factory< IAlgorithm *, const std::string &, ISvcLocator * > Factory
 
typedef Gaudi::PluginService::Factory< IAlgorithm *, const std::string &, ISvcLocator * > Factory
 
- Public Types inherited from implements3< IAlgorithm, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3< IAlgorithm, IProperty, IStatefulextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces3< IAlgorithm, IProperty, IStatefulextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IAlgorithm, IProperty, IStateful >
typedef mpl::fold< typename IAlgorithm::iid::iids::type, typename mpl::fold< typename IProperty::iid::iids::type, typename IStateful::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type, mpl::insert< mpl::_1, mpl::_2 > >::type ext_iids
 MPL set of interfaces extended by this one. More...
 
typedef mpl::fold< typename IAlgorithm::iid::iids::type, typename mpl::fold< typename IProperty::iid::iids::type, typename IStateful::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type, mpl::insert< mpl::_1, mpl::_2 > >::type ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status {
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR,
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR
}
 Return status. More...
 
enum  Status {
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR,
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR
}
 Return status. More...
 
typedef Gaudi::InterfaceId< IInterface, 0, 0 > iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
typedef Gaudi::InterfaceId< IInterface, 0, 0 > iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 

Public Member Functions

 OutputStream (const std::string &name, ISvcLocator *pSvcLocator)
 Standard algorithm Constructor. More...
 
virtual ~OutputStream ()
 Standard Destructor. More...
 
virtual StatusCode initialize ()
 Initialize OutputStream. More...
 
virtual StatusCode finalize ()
 Terminate OutputStream. More...
 
virtual StatusCode execute ()
 Working entry point. More...
 
virtual StatusCode connectConversionSvc ()
 
virtual bool collect (IRegistry *dir, int level)
 Store agent's classback. More...
 
virtual StatusCode collectObjects ()
 Collect all objects to be written to the output stream. More...
 
void clearItems (Items &itms)
 Clear item list. More...
 
void addItem (Items &itms, const std::string &descriptor)
 Add item to output streamer list. More...
 
void clearSelection ()
 Clear list of selected objects. More...
 
IDataSelectorselectedObjects ()
 Return the list of selected objects. More...
 
- Public Member Functions inherited from Algorithm
 Algorithm (const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
 Constructor. More...
 
virtual ~Algorithm ()
 Destructor. More...
 
virtual StatusCode sysStart ()
 Reinitialization method invoked by the framework. More...
 
virtual StatusCode sysInitialize ()
 Initialization method invoked by the framework. More...
 
virtual StatusCode sysReinitialize ()
 Reinitialization method invoked by the framework. More...
 
virtual StatusCode sysRestart ()
 Restart method invoked by the framework. More...
 
virtual StatusCode sysExecute ()
 The actions to be performed by the algorithm on an event. More...
 
virtual StatusCode sysStop ()
 System stop. More...
 
virtual StatusCode sysFinalize ()
 System finalization. More...
 
virtual StatusCode sysBeginRun ()
 beginRun method invoked by the framework. More...
 
virtual StatusCode sysEndRun ()
 endRun method invoked by the framework. More...
 
virtual const std::string & name () const
 The identifying name of the algorithm object. More...
 
virtual const std::string & version () const
 The version of the algorithm. More...
 
virtual StatusCode configure ()
 Dummy implementation of IStateful::configure() method. More...
 
virtual StatusCode terminate ()
 Dummy implementation of IStateful::terminate() method. More...
 
virtual StatusCode start ()
 the default (empty) implementation of IStateful::start() method More...
 
virtual StatusCode stop ()
 the default (empty) implementation of IStateful::stop() method More...
 
virtual StatusCode reinitialize ()
 the default (empty) implementation of IStateful::reinitialize() method More...
 
virtual StatusCode restart ()
 the default (empty) implementation of IStateful::restart() method More...
 
virtual bool isExecuted () const
 Has this algorithm been executed since the last reset? More...
 
virtual void setExecuted (bool state)
 Set the executed flag to the specified state. More...
 
virtual void resetExecuted ()
 Reset the executed state of the Algorithm for the duration of the current event. More...
 
virtual StatusCode beginRun ()
 Algorithm begin run. More...
 
virtual StatusCode endRun ()
 Algorithm end run. This method is called at the end of the event loop. More...
 
virtual Gaudi::StateMachine::State FSMState () const
 returns the current state of the algorithm More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 returns the state the algorithm will be in after the ongoing transition More...
 
virtual bool isEnabled () const
 Is this algorithm enabled or disabled? More...
 
virtual bool filterPassed () const
 Did this algorithm pass or fail its filter criterion for the last event? More...
 
virtual void setFilterPassed (bool state)
 Set the filter passed flag to the specified state. More...
 
int errorCount () const
 Get the number of failures of the algorithm. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
SmartIF< IServiceservice (const std::string &name, const bool createIf=true, const bool quiet=false) const
 Return a pointer to the service identified by name (or "type/name") More...
 
void setOutputLevel (int level)
 Set the output level for current algorithm. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
SmartIF< IChronoStatSvc > & chronoSvc () const
 The standard Chrono & Stat service, Return a pointer to the service if present. More...
 
SmartIF< IChronoStatSvc > & chronoStatService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IDataProviderSvc > & detSvc () const
 The standard detector data service. More...
 
SmartIF< IDataProviderSvc > & detDataService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IConversionSvc > & detCnvSvc () const
 The standard detector data persistency conversion service. More...
 
SmartIF< IConversionSvc > & detDataCnvService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IDataProviderSvc > & eventSvc () const
 The standard event data service. More...
 
SmartIF< IDataProviderSvc > & evtSvc () const
 shortcut for method eventSvc More...
 
SmartIF< IDataProviderSvc > & eventDataService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IConversionSvc > & eventCnvSvc () const
 The standard event data persistency conversion service. More...
 
SmartIF< IConversionSvc > & eventDataCnvService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IHistogramSvc > & histoSvc () const
 The standard histogram service. More...
 
SmartIF< IHistogramSvc > & histogramDataService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
SmartIF< IMessageSvc > & messageService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< INTupleSvc > & ntupleSvc () const
 The standard N tuple service. More...
 
SmartIF< INTupleSvc > & ntupleService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IRndmGenSvc > & randSvc () const
 AIDA-based NTuple service Returns a pointer to the AIDATuple service if present. More...
 
SmartIF< IToolSvc > & toolSvc () const
 The standard ToolSvc service, Return a pointer to the service if present. More...
 
SmartIF< IExceptionSvc > & exceptionSvc () const
 Get the exception Service. More...
 
SmartIF< IAlgContextSvc > & contextSvc () const
 get Algorithm Context Service More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 The standard service locator. More...
 
SmartIF< ISvcLocator > & svcLoc () const
 shortcut for method serviceLocator More...
 
bool registerContext () const
 register for Algorithm Context Service? More...
 
StatusCode createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg)
 Create a sub algorithm. More...
 
std::vector< Algorithm * > * subAlgorithms () const
 List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms. More...
 
virtual StatusCode setProperty (const Property &p)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode setProperty (const std::string &s)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode getProperty (Property *p) const
 Implementation of IProperty::getProperty. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Implementation of IProperty::getProperty. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Implementation of IProperty::getProperty. More...
 
virtual const std::vector< Property * > & getProperties () const
 Implementation of IProperty::getProperties. More...
 
virtual bool hasProperty (const std::string &name) const
 Implementation of IProperty::hasProperty. More...
 
StatusCode setProperties ()
 Set the algorithm's properties. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IMonitorSvc > & monitorSvc () const
 Access the monitor service. More...
 
template<class T >
void declareInfo (const std::string &name, const T &var, const std::string &desc) const
 Declare monitoring information. More...
 
void declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const
 Declare monitoring information (special case) More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Algorithm (const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
 Constructor. More...
 
virtual ~Algorithm ()
 Destructor. More...
 
virtual StatusCode sysStart ()
 Reinitialization method invoked by the framework. More...
 
virtual StatusCode sysInitialize ()
 Initialization method invoked by the framework. More...
 
virtual StatusCode sysReinitialize ()
 Reinitialization method invoked by the framework. More...
 
virtual StatusCode sysRestart ()
 Restart method invoked by the framework. More...
 
virtual StatusCode sysExecute ()
 The actions to be performed by the algorithm on an event. More...
 
virtual StatusCode sysStop ()
 System stop. More...
 
virtual StatusCode sysFinalize ()
 System finalization. More...
 
virtual StatusCode sysBeginRun ()
 beginRun method invoked by the framework. More...
 
virtual StatusCode sysEndRun ()
 endRun method invoked by the framework. More...
 
virtual const std::string & name () const
 The identifying name of the algorithm object. More...
 
virtual const std::string & version () const
 The version of the algorithm. More...
 
virtual StatusCode configure ()
 Dummy implementation of IStateful::configure() method. More...
 
virtual StatusCode terminate ()
 Dummy implementation of IStateful::terminate() method. More...
 
virtual StatusCode start ()
 the default (empty) implementation of IStateful::start() method More...
 
virtual StatusCode stop ()
 the default (empty) implementation of IStateful::stop() method More...
 
virtual StatusCode reinitialize ()
 the default (empty) implementation of IStateful::reinitialize() method More...
 
virtual StatusCode restart ()
 the default (empty) implementation of IStateful::restart() method More...
 
virtual bool isExecuted () const
 Has this algorithm been executed since the last reset? More...
 
virtual void setExecuted (bool state)
 Set the executed flag to the specified state. More...
 
virtual void resetExecuted ()
 Reset the executed state of the Algorithm for the duration of the current event. More...
 
virtual StatusCode beginRun ()
 Algorithm begin run. More...
 
virtual StatusCode endRun ()
 Algorithm end run. This method is called at the end of the event loop. More...
 
virtual Gaudi::StateMachine::State FSMState () const
 returns the current state of the algorithm More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 returns the state the algorithm will be in after the ongoing transition More...
 
virtual bool isEnabled () const
 Is this algorithm enabled or disabled? More...
 
virtual bool filterPassed () const
 Did this algorithm pass or fail its filter criterion for the last event? More...
 
virtual void setFilterPassed (bool state)
 Set the filter passed flag to the specified state. More...
 
int errorCount () const
 Get the number of failures of the algorithm. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
SmartIF< IServiceservice (const std::string &name, const bool createIf=true, const bool quiet=false) const
 Return a pointer to the service identified by name (or "type/name") More...
 
void setOutputLevel (int level)
 Set the output level for current algorithm. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
SmartIF< IChronoStatSvc > & chronoSvc () const
 The standard Chrono & Stat service, Return a pointer to the service if present. More...
 
SmartIF< IChronoStatSvc > & chronoStatService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IDataProviderSvc > & detSvc () const
 The standard detector data service. More...
 
SmartIF< IDataProviderSvc > & detDataService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IConversionSvc > & detCnvSvc () const
 The standard detector data persistency conversion service. More...
 
SmartIF< IConversionSvc > & detDataCnvService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IDataProviderSvc > & eventSvc () const
 The standard event data service. More...
 
SmartIF< IDataProviderSvc > & evtSvc () const
 shortcut for method eventSvc More...
 
SmartIF< IDataProviderSvc > & eventDataService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IConversionSvc > & eventCnvSvc () const
 The standard event data persistency conversion service. More...
 
SmartIF< IConversionSvc > & eventDataCnvService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IHistogramSvc > & histoSvc () const
 The standard histogram service. More...
 
SmartIF< IHistogramSvc > & histogramDataService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
SmartIF< IMessageSvc > & messageService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< INTupleSvc > & ntupleSvc () const
 The standard N tuple service. More...
 
SmartIF< INTupleSvc > & ntupleService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IRndmGenSvc > & randSvc () const
 AIDA-based NTuple service Returns a pointer to the AIDATuple service if present. More...
 
SmartIF< IToolSvc > & toolSvc () const
 The standard ToolSvc service, Return a pointer to the service if present. More...
 
SmartIF< IExceptionSvc > & exceptionSvc () const
 Get the exception Service. More...
 
SmartIF< IAlgContextSvc > & contextSvc () const
 get Algorithm Context Service More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 The standard service locator. More...
 
SmartIF< ISvcLocator > & svcLoc () const
 shortcut for method serviceLocator More...
 
bool registerContext () const
 register for Algorithm Context Service? More...
 
StatusCode createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg)
 Create a sub algorithm. More...
 
std::vector< Algorithm * > * subAlgorithms () const
 List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms. More...
 
virtual StatusCode setProperty (const Property &p)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode setProperty (const std::string &s)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode getProperty (Property *p) const
 Implementation of IProperty::getProperty. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Implementation of IProperty::getProperty. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Implementation of IProperty::getProperty. More...
 
virtual const std::vector< Property * > & getProperties () const
 Implementation of IProperty::getProperties. More...
 
virtual bool hasProperty (const std::string &name) const
 Implementation of IProperty::hasProperty. More...
 
StatusCode setProperties ()
 Set the algorithm's properties. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IMonitorSvc > & monitorSvc () const
 Access the monitor service. More...
 
template<class T >
void declareInfo (const std::string &name, const T &var, const std::string &desc) const
 Declare monitoring information. More...
 
void declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const
 Declare monitoring information (special case) More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
- Public Member Functions inherited from extend_interfaces3< IAlgorithm, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IAlgorithm
 DeclareInterfaceID (IAlgorithm, 4, 0)
 InterfaceID. More...
 
 DeclareInterfaceID (IAlgorithm, 4, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 1)
 InterfaceID. More...
 
 DeclareInterfaceID (IProperty, 2, 1)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 

Protected Member Functions

StatusCode decodeAcceptAlgs ()
 Decode list of Algorithms that this stream accepts. More...
 
void acceptAlgsHandler (Property &theProp)
 Handler for AcceptAlgs Property. More...
 
StatusCode decodeRequireAlgs ()
 Decode list of Algorithms that this stream requires. More...
 
void requireAlgsHandler (Property &theProp)
 Handler for RequireAlgs Property. More...
 
StatusCode decodeVetoAlgs ()
 Decode list of Algorithms that this stream is vetoed by. More...
 
void vetoAlgsHandler (Property &theProp)
 Handler for VetoAlgs Property. More...
 
AlgorithmdecodeAlgorithm (const std::string &theName)
 Decode a single algorithm name. More...
 
StatusCode decodeAlgorithms (StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs)
 Decode specified list of Algorithms. More...
 
bool isEventAccepted () const
 Test whether this event should be output. More...
 
DataStoreItemfindItem (const std::string &path)
 Find single item identified by its path (exact match) More...
 
virtual StatusCode writeObjects ()
 Select the different objects and write them to file. More...
 
virtual bool hasInput () const
 Tell if the instance has been configured with input items or not. More...
 
- Protected Member Functions inherited from Algorithm
bool isInitialized () const
 Has the Algorithm already been initialized? More...
 
bool isFinalized () const
 Has the Algorithm already been finalized? More...
 
int outputLevel () const
 retrieve the Algorithm output level More...
 
IntegerPropertyoutputLevelProperty ()
 Accessor for the Message level property. More...
 
void initOutputLevel (Property &prop)
 callback for output level property More...
 
bool isInitialized () const
 Has the Algorithm already been initialized? More...
 
bool isFinalized () const
 Has the Algorithm already been finalized? More...
 
int outputLevel () const
 retrieve the Algorithm output level More...
 
IntegerPropertyoutputLevelProperty ()
 Accessor for the Message level property. More...
 
void initOutputLevel (Property &prop)
 callback for output level property More...
 

Protected Attributes

SmartIF< IIncidentSvcm_incidentSvc
 Reference to the incident service. More...
 
bool m_doPreLoad
 Flag indicating whether data pre-loading should be performed. More...
 
bool m_doPreLoadOpt
 Flag indicating whether optional items should be preloaded. More...
 
bool m_verifyItems
 Flag to indicate that item consistency should be checked. More...
 
std::string m_storeName
 Name of the service managing the data store. More...
 
std::string m_persName
 Name of the persistency service capable to write data from the store. More...
 
std::string m_output
 Name of the output file specification. More...
 
std::string m_outputName
 Name of the output file. More...
 
std::string m_outputType
 Output type: NEW(NEW,CREATE,WRITE,RECREATE), UPDATE) More...
 
OutputStreamAgentm_agent
 Keep reference of agent. More...
 
SmartIF< IDataProviderSvcm_pDataProvider
 Keep reference to the data provider service. More...
 
SmartIF< IDataManagerSvcm_pDataManager
 Keep reference to the data manager service. More...
 
SmartIF< IConversionSvcm_pConversionSvc
 Keep reference to the data conversion service. More...
 
DataStoreItemm_currentItem
 Keep track of the current item. More...
 
ItemNames m_itemNames
 Vector of item names. More...
 
Items m_itemList
 Vector of items to be saved to this stream. More...
 
ItemNames m_optItemNames
 Vector of item names. More...
 
Items m_optItemList
 Vector of optional items to be saved to this stream. More...
 
AlgDependentItemNames m_algDependentItemList
 Mapping between algorithm names, and a list of items for which, if the algorithm in question accepted the event, they should be also stored. More...
 
AlgDependentItems m_algDependentItems
 Items to be saved for specific algorithms. More...
 
IDataSelector m_objects
 Collection of objects being selected. More...
 
int m_events
 Number of events written to this output stream. More...
 
StringArrayProperty m_acceptNames
 Vector of names of Algorithms that this stream accepts. More...
 
StringArrayProperty m_requireNames
 Vector of names of Algorithms that this stream requires. More...
 
StringArrayProperty m_vetoNames
 Vector of names of Algorithms that this stream is vetoed by. More...
 
std::vector< Algorithm * > * m_acceptAlgs
 Vector of Algorithms that this stream accepts. More...
 
std::vector< Algorithm * > * m_requireAlgs
 Vector of Algorithms that this stream requires. More...
 
std::vector< Algorithm * > * m_vetoAlgs
 Vector of Algorithms that this stream is vetoed by. More...
 
bool m_fireIncidents
 should I fire incidents for writing opening/closing etc? More...
 

Additional Inherited Members

- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 

Detailed Description

A small to stream Data I/O.

Author: M.Frank author R. Lambert Version: 1.0

Definition at line 27 of file OutputStream.h.

Member Typedef Documentation

typedef std::map< std::string, ItemNames > OutputStream::AlgDependentItemNames

Definition at line 32 of file OutputStream.h.

Definition at line 31 of file OutputStream.h.

typedef std::vector<std::string> OutputStream::ItemNames

Definition at line 30 of file OutputStream.h.

typedef std::vector<DataStoreItem*> OutputStream::Items

Definition at line 29 of file OutputStream.h.

Constructor & Destructor Documentation

OutputStream::OutputStream ( const std::string &  name,
ISvcLocator pSvcLocator 
)

Standard algorithm Constructor.

in the baseclass, always fire the incidents by default in e.g. RecordStream this will be set to false, and configurable

in the baseclass, always fire the incidents by default in RecordStream this will be set to false, and configurable

Definition at line 30 of file OutputStream.cpp.

31 : Algorithm(name, pSvcLocator)
32 {
33  m_doPreLoad = true;
34  m_doPreLoadOpt = false;
35  m_verifyItems = true;
36  m_output = "";
37  m_outputName = "";
38  m_outputType = "UPDATE";
39  m_storeName = "EventDataSvc";
40  m_persName = "EventPersistencySvc";
41  m_agent = new OutputStreamAgent(this);
42  m_acceptAlgs = new std::vector<Algorithm*>();
43  m_requireAlgs = new std::vector<Algorithm*>();
44  m_vetoAlgs = new std::vector<Algorithm*>();
47  m_fireIncidents = true;
48  declareProperty("ItemList", m_itemNames);
49  declareProperty("OptItemList", m_optItemNames);
50  declareProperty("AlgDependentItemList", m_algDependentItemList);
51  declareProperty("Preload", m_doPreLoad);
52  declareProperty("PreloadOptItems", m_doPreLoadOpt);
53  declareProperty("Output", m_output);
54  declareProperty("OutputFile", m_outputName);
55  declareProperty("EvtDataSvc", m_storeName);
56  declareProperty("EvtConversionSvc", m_persName);
57  declareProperty("AcceptAlgs", m_acceptNames);
58  declareProperty("RequireAlgs", m_requireNames);
59  declareProperty("VetoAlgs", m_vetoNames);
60  declareProperty("VerifyItems", m_verifyItems);
63 
64  // Associate action handlers with the AcceptAlgs, RequireAlgs and VetoAlgs.
68 
69  //setProperty( "OutputLevel", 2 );
70 
71 }
StringArrayProperty m_acceptNames
Vector of names of Algorithms that this stream accepts.
Definition: OutputStream.h:80
std::string m_storeName
Name of the service managing the data store.
Definition: OutputStream.h:43
std::string m_outputType
Output type: NEW(NEW,CREATE,WRITE,RECREATE), UPDATE)
Definition: OutputStream.h:51
StringArrayProperty m_vetoNames
Vector of names of Algorithms that this stream is vetoed by.
Definition: OutputStream.h:84
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Algorithm.h:402
std::string m_outputName
Name of the output file.
Definition: OutputStream.h:49
void requireAlgsHandler(Property &theProp)
Handler for RequireAlgs Property.
std::string m_persName
Name of the persistency service capable to write data from the store.
Definition: OutputStream.h:45
AlgDependentItemNames m_algDependentItemList
Mapping between algorithm names, and a list of items for which, if the algorithm in question accepted...
Definition: OutputStream.h:72
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
Definition: Property.cpp:141
bool m_verifyItems
Flag to indicate that item consistency should be checked.
Definition: OutputStream.h:41
OutputStreamAgent * m_agent
Keep reference of agent.
Definition: OutputStream.h:53
bool m_doPreLoad
Flag indicating whether data pre-loading should be performed.
Definition: OutputStream.h:37
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
bool m_doPreLoadOpt
Flag indicating whether optional items should be preloaded.
Definition: OutputStream.h:39
std::vector< Algorithm * > * m_requireAlgs
Vector of Algorithms that this stream requires.
Definition: OutputStream.h:88
std::vector< Algorithm * > * m_acceptAlgs
Vector of Algorithms that this stream accepts.
Definition: OutputStream.h:86
Algorithm(const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
Constructor.
Definition: Algorithm.cpp:28
ItemNames m_itemNames
Vector of item names.
Definition: OutputStream.h:63
ItemNames m_optItemNames
Vector of item names.
Definition: OutputStream.h:67
void acceptAlgsHandler(Property &theProp)
Handler for AcceptAlgs Property.
StringArrayProperty m_requireNames
Vector of names of Algorithms that this stream requires.
Definition: OutputStream.h:82
std::string m_output
Name of the output file specification.
Definition: OutputStream.h:47
std::vector< Algorithm * > * m_vetoAlgs
Vector of Algorithms that this stream is vetoed by.
Definition: OutputStream.h:90
void vetoAlgsHandler(Property &theProp)
Handler for VetoAlgs Property.
bool m_fireIncidents
should I fire incidents for writing opening/closing etc?
Definition: OutputStream.h:123
OutputStream::~OutputStream ( )
virtual

Standard Destructor.

Definition at line 74 of file OutputStream.cpp.

74  {
75  delete m_agent;
76  delete m_acceptAlgs;
77  delete m_requireAlgs;
78  delete m_vetoAlgs;
79 }
OutputStreamAgent * m_agent
Keep reference of agent.
Definition: OutputStream.h:53
std::vector< Algorithm * > * m_requireAlgs
Vector of Algorithms that this stream requires.
Definition: OutputStream.h:88
std::vector< Algorithm * > * m_acceptAlgs
Vector of Algorithms that this stream accepts.
Definition: OutputStream.h:86
std::vector< Algorithm * > * m_vetoAlgs
Vector of Algorithms that this stream is vetoed by.
Definition: OutputStream.h:90

Member Function Documentation

void OutputStream::acceptAlgsHandler ( Property theProp)
protected

Handler for AcceptAlgs Property.

Definition at line 556 of file OutputStream.cpp.

556  {
558  if (sc.isFailure()) {
559  throw GaudiException("Failure in OutputStream::decodeAlgorithms",
560  "OutputStream::acceptAlgsHandler",sc);
561  }
562 }
StringArrayProperty m_acceptNames
Vector of names of Algorithms that this stream accepts.
Definition: OutputStream.h:80
StatusCode decodeAlgorithms(StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs)
Decode specified list of Algorithms.
Define general base for Gaudi exception.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
std::vector< Algorithm * > * m_acceptAlgs
Vector of Algorithms that this stream accepts.
Definition: OutputStream.h:86
void OutputStream::addItem ( Items itms,
const std::string &  descriptor 
)

Add item to output streamer list.

Definition at line 440 of file OutputStream.cpp.

440  {
441  MsgStream log(msgSvc(), name());
442  int level = 0;
443  size_t sep = descriptor.rfind("#");
444  std::string obj_path (descriptor,0,sep);
445  std::string slevel (descriptor,sep+1,descriptor.length());
446  if ( slevel == "*" ) {
447  level = 9999999;
448  }
449  else {
450  level = atoi(slevel.c_str());
451  }
452  if ( m_verifyItems ) {
453  size_t idx = obj_path.find("/",1);
454  while(idx != std::string::npos) {
455  std::string sub_item = obj_path.substr(0,idx);
456  if ( 0 == findItem(sub_item) ) {
457  addItem(itms, sub_item+"#1");
458  }
459  idx = obj_path.find("/",idx+1);
460  }
461  }
462  DataStoreItem* item = new DataStoreItem(obj_path, level);
463  ON_DEBUG
464  log << MSG::DEBUG << "Adding OutputStream item " << item->path()
465  << " with " << item->depth()
466  << " level(s)." << endmsg;
467  itms.push_back( item );
468 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
int depth() const
Accessor: Retrieve load depth.
Definition: DataStoreItem.h:70
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Description of the DataStoreItem class.
Definition: DataStoreItem.h:18
const std::string & path() const
Accessor: Retrieve load path.
Definition: DataStoreItem.h:66
DataStoreItem * findItem(const std::string &path)
Find single item identified by its path (exact match)
bool m_verifyItems
Flag to indicate that item consistency should be checked.
Definition: OutputStream.h:41
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
void addItem(Items &itms, const std::string &descriptor)
Add item to output streamer list.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
tuple item
print s1,s2
Definition: ana.py:146
#define ON_DEBUG
list itms
Definition: ana.py:135
void OutputStream::clearItems ( Items itms)

Clear item list.

Definition at line 420 of file OutputStream.cpp.

420  {
421  for ( Items::iterator i = itms.begin(); i != itms.end(); i++ ) {
422  delete (*i);
423  }
424  itms.erase(itms.begin(), itms.end());
425 }
list itms
Definition: ana.py:135
list i
Definition: ana.py:128
void OutputStream::clearSelection ( )

Clear list of selected objects.

Definition at line 415 of file OutputStream.cpp.

415  {
416  m_objects.erase(m_objects.begin(), m_objects.end());
417 }
IDataSelector m_objects
Collection of objects being selected.
Definition: OutputStream.h:76
bool OutputStream::collect ( IRegistry dir,
int  level 
)
virtual

Store agent's classback.

Definition at line 310 of file OutputStream.cpp.

310  {
311  if ( level < m_currentItem->depth() ) {
312  if ( dir->object() != 0 ) {
313  /*
314  std::cout << "Analysing ("
315  << dir->name()
316  << ") Object:"
317  << ((dir->object()==0) ? "UNLOADED" : "LOADED")
318  << std::endl;
319  */
320  m_objects.push_back(dir->object());
321  return true;
322  }
323  }
324  return false;
325 }
IDataSelector m_objects
Collection of objects being selected.
Definition: OutputStream.h:76
virtual DataObject * object() const =0
Retrieve object behind the link.
StatusCode OutputStream::collectObjects ( )
virtual

Collect all objects to be written to the output stream.

Reimplemented in InputCopyStream.

Definition at line 328 of file OutputStream.cpp.

328  {
329  MsgStream log(msgSvc(), name());
331 
332  // Traverse the tree and collect the requested objects
333  for ( Items::iterator i = m_itemList.begin(); i != m_itemList.end(); i++ ) {
334  DataObject* obj = 0;
335  m_currentItem = (*i);
337  if ( iret.isSuccess() ) {
338  iret = m_pDataManager->traverseSubTree(obj, m_agent);
339  if ( !iret.isSuccess() ) {
340  status = iret;
341  }
342  }
343  else {
344  log << MSG::ERROR << "Cannot write mandatory object(s) (Not found) "
345  << m_currentItem->path() << endmsg;
346  status = iret;
347  }
348  }
349 
350  // Traverse the tree and collect the requested objects (tolerate missing items here)
351  for ( Items::iterator i = m_optItemList.begin(); i != m_optItemList.end(); i++ ) {
352  DataObject* obj = 0;
353  m_currentItem = (*i);
355  if ( iret.isSuccess() ) {
356  iret = m_pDataManager->traverseSubTree(obj, m_agent);
357  }
358  if ( !iret.isSuccess() ) {
359  ON_DEBUG
360  log << MSG::DEBUG << "Ignore request to write non-mandatory object(s) "
361  << m_currentItem->path() << endmsg;
362  }
363  }
364 
365  // Collect objects dependent on particular algorithms
366  for ( AlgDependentItems::const_iterator iAlgItems = m_algDependentItems.begin();
367  iAlgItems != m_algDependentItems.end(); ++iAlgItems )
368  {
369  Algorithm * alg = iAlgItems->first;
370  const Items& items = iAlgItems->second;
371  if ( alg->isExecuted() && alg->filterPassed() )
372  {
373  ON_DEBUG
374  log << MSG::DEBUG << "Algorithm '" << alg->name() << "' fired. Adding " << items << endmsg;
375  for ( Items::const_iterator i = items.begin(); i != items.end(); ++i )
376  {
377  DataObject* obj = NULL;
378  m_currentItem = (*i);
380  if ( iret.isSuccess() )
381  {
383  if ( !iret.isSuccess() ) { status = iret; }
384  }
385  else
386  {
387  log << MSG::ERROR << "Cannot write mandatory (algorithm dependent) object(s) (Not found) "
388  << m_currentItem->path() << endmsg;
389  status = iret;
390  }
391  }
392  }
393  }
394 
395  if (status.isSuccess())
396  {
397  // Remove duplicates from the list of objects, preserving the order in the list
398  std::set<DataObject*> unique;
399  std::vector<DataObject*> tmp; // temporary vector with the reduced list
400  tmp.reserve(m_objects.size());
401  for (std::vector<DataObject*>::iterator o = m_objects.begin(); o != m_objects.end(); ++o) {
402  if (!unique.count(*o)) {
403  // if the pointer is not in the set, add it to both the set and the temporary vector
404  unique.insert(*o);
405  tmp.push_back(*o);
406  }
407  }
408  m_objects.swap(tmp); // swap the data of the two vectors
409  }
410 
411  return status;
412 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
IDataSelector m_objects
Collection of objects being selected.
Definition: OutputStream.h:76
virtual bool filterPassed() const
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:862
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
DataStoreItem * m_currentItem
Keep track of the current item.
Definition: OutputStream.h:61
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
virtual bool isExecuted() const
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:845
SmartIF< IDataProviderSvc > m_pDataProvider
Keep reference to the data provider service.
Definition: OutputStream.h:55
const std::string & path() const
Accessor: Retrieve load path.
Definition: DataStoreItem.h:66
AlgDependentItems m_algDependentItems
Items to be saved for specific algorithms.
Definition: OutputStream.h:74
std::vector< DataStoreItem * > Items
Definition: OutputStream.h:29
OutputStreamAgent * m_agent
Keep reference of agent.
Definition: OutputStream.h:53
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Items m_itemList
Vector of items to be saved to this stream.
Definition: OutputStream.h:65
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
SmartIF< IDataManagerSvc > m_pDataManager
Keep reference to the data manager service.
Definition: OutputStream.h:57
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
#define ON_DEBUG
virtual StatusCode traverseSubTree(const std::string &sub_path, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by its full path name...
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
list i
Definition: ana.py:128
Items m_optItemList
Vector of optional items to be saved to this stream.
Definition: OutputStream.h:69
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
StatusCode OutputStream::connectConversionSvc ( )
virtual

Definition at line 471 of file OutputStream.cpp.

471  {
472  StatusCode status = StatusCode(StatusCode::FAILURE, true);
473  MsgStream log(msgSvc(), name());
474  // Get output file from input
475  std::string dbType, svc, shr;
476  for(auto attrib: Gaudi::Utils::AttribStringParser(m_output)) {
477  const std::string& tag = attrib.tag;
478  const std::string& val = attrib.value;
479  switch( ::toupper(tag[0]) ) {
480  case 'D':
481  m_outputName = val;
482  break;
483  case 'T':
484  dbType = val;
485  break;
486  case 'S':
487  switch( ::toupper(tag[1]) ) {
488  case 'V': svc = val; break;
489  case 'H': shr = "YES"; break;
490  }
491  break;
492  case 'O': // OPT='<NEW<CREATE,WRITE,RECREATE>, UPDATE>'
493  switch( ::toupper(val[0]) ) {
494  case 'R':
495  if ( ::strncasecmp(val.c_str(),"RECREATE",3)==0 )
496  m_outputType = "RECREATE";
497  else if ( ::strncasecmp(val.c_str(),"READ",3)==0 )
498  m_outputType = "READ";
499  break;
500  case 'C':
501  case 'N':
502  case 'W':
503  m_outputType = "NEW";
504  break;
505  case 'U':
506  m_outputType = "UPDATE";
507  break;
508  default:
509  m_outputType = "???";
510  break;
511  }
512  break;
513  default:
514  break;
515  }
516  }
517  if ( !shr.empty() ) m_outputType += "|SHARED";
518  // Get access to the default Persistency service
519  // The default service is the same for input as for output.
520  // If this is not desired, then a specialized OutputStream must overwrite
521  // this value.
522  if ( dbType.length() > 0 || svc.length() > 0 ) {
523  std::string typ = dbType.length()>0 ? dbType : svc;
525  if( !ipers.isValid() ) {
526  log << MSG::FATAL << "Unable to locate IPersistencySvc interface of " << m_persName << endmsg;
527  return StatusCode::FAILURE;
528  }
529  IConversionSvc *cnvSvc = 0;
530  status = ipers->getService(typ, cnvSvc);
531  if( !status.isSuccess() ) {
532  log << MSG::FATAL << "Unable to locate IConversionSvc interface of database type " << typ << endmsg;
533  return status;
534  }
535  // Increase reference count and keep service.
536  m_pConversionSvc = cnvSvc;
537  }
538  else
539  {
540  log << MSG::FATAL
541  << "Unable to locate IConversionSvc interface (Unknown technology) " << endmsg
542  << "You either have to specify a technology name or a service name!" << endmsg
543  << "Please correct the job option \"" << name() << ".Output\" !" << endmsg;
544  return StatusCode::FAILURE;
545  }
546  return StatusCode::SUCCESS;
547 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Algorithm.cpp:1091
std::string m_outputType
Output type: NEW(NEW,CREATE,WRITE,RECREATE), UPDATE)
Definition: OutputStream.h:51
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
std::string m_outputName
Name of the output file.
Definition: OutputStream.h:49
std::string m_persName
Name of the persistency service capable to write data from the store.
Definition: OutputStream.h:45
SmartIF< IConversionSvc > m_pConversionSvc
Keep reference to the data conversion service.
Definition: OutputStream.h:59
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
StatusCode service(const std::string &name, T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Algorithm.h:210
std::string m_output
Name of the output file specification.
Definition: OutputStream.h:47
void toupper(std::string &s)
StatusCode OutputStream::decodeAcceptAlgs ( )
protected

Decode list of Algorithms that this stream accepts.

Definition at line 549 of file OutputStream.cpp.

549  {
550  MsgStream log(msgSvc(), name());
551  ON_DEBUG
552  log << MSG::DEBUG << "AcceptAlgs : " << m_acceptNames.value() << endmsg;
554 }
StringArrayProperty m_acceptNames
Vector of names of Algorithms that this stream accepts.
Definition: OutputStream.h:80
StatusCode decodeAlgorithms(StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs)
Decode specified list of Algorithms.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
std::vector< Algorithm * > * m_acceptAlgs
Vector of Algorithms that this stream accepts.
Definition: OutputStream.h:86
const TYPE & value() const
explicit conversion
Definition: Property.h:355
#define ON_DEBUG
Algorithm * OutputStream::decodeAlgorithm ( const std::string &  theName)
protected

Decode a single algorithm name.

Definition at line 594 of file OutputStream.cpp.

595 {
596  Algorithm * theAlgorithm = NULL;
597 
599  if ( theAlgMgr.isValid() )
600  {
601  // Check whether the supplied name corresponds to an existing
602  // Algorithm object.
603  SmartIF<IAlgorithm> &theIAlg = theAlgMgr->algorithm(theName);
604  if ( theIAlg.isValid() )
605  {
606  try
607  {
608  theAlgorithm = dynamic_cast<Algorithm*>(theIAlg.get());
609  }
610  catch(...)
611  {
612  // do nothing
613  }
614  }
615  }
616  else
617  {
618  MsgStream log( msgSvc( ), name( ) );
619  log << MSG::FATAL << "Can't locate ApplicationMgr!!!" << endmsg;
620  }
621 
622  if ( !theAlgorithm )
623  {
624  MsgStream log( msgSvc( ), name( ) );
625  log << MSG::WARNING
626  << "Failed to decode Algorithm name " << theName << endmsg;
627  }
628 
629  return theAlgorithm;
630 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Algorithm.cpp:1091
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:62
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
StatusCode OutputStream::decodeAlgorithms ( StringArrayProperty theNames,
std::vector< Algorithm * > *  theAlgs 
)
protected

Decode specified list of Algorithms.

Definition at line 632 of file OutputStream.cpp.

634 {
635  // Reset the list of Algorithms
636  theAlgs->clear( );
637 
639 
640  // Build the list of Algorithms from the names list
641  const std::vector<std::string> nameList = theNames.value( );
642  for ( std::vector<std::string>::const_iterator it = nameList.begin();
643  it != nameList.end(); ++it )
644  {
645 
646  Algorithm * theAlgorithm = decodeAlgorithm( *it );
647  if ( theAlgorithm )
648  {
649  // Check that the specified algorithm doesn't already exist in the list
650  for ( std::vector<Algorithm*>::iterator ita = theAlgs->begin();
651  ita != theAlgs->end(); ++ita )
652  {
653  Algorithm * existAlgorithm = (*ita);
654  if ( theAlgorithm == existAlgorithm )
655  {
656  result = StatusCode::FAILURE;
657  break;
658  }
659  }
660  if ( result.isSuccess( ) )
661  {
662  theAlgorithm->addRef();
663  theAlgs->push_back( theAlgorithm );
664  }
665  }
666  else
667  {
668  MsgStream log( msgSvc( ), name( ) );
669  log << MSG::INFO << *it << " doesn't exist - ignored" << endmsg;
670  }
671 
672  }
673  result = StatusCode::SUCCESS;
674 
675  return result;
676 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
const TYPE & value() const
explicit conversion
Definition: Property.h:355
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
Algorithm * decodeAlgorithm(const std::string &theName)
Decode a single algorithm name.
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
StatusCode OutputStream::decodeRequireAlgs ( )
protected

Decode list of Algorithms that this stream requires.

Definition at line 564 of file OutputStream.cpp.

564  {
565  MsgStream log(msgSvc(), name());
566  ON_DEBUG
567  log << MSG::DEBUG << "RequireAlgs : " << m_requireNames.value() << endmsg;
569 }
StatusCode decodeAlgorithms(StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs)
Decode specified list of Algorithms.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
std::vector< Algorithm * > * m_requireAlgs
Vector of Algorithms that this stream requires.
Definition: OutputStream.h:88
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
const TYPE & value() const
explicit conversion
Definition: Property.h:355
StringArrayProperty m_requireNames
Vector of names of Algorithms that this stream requires.
Definition: OutputStream.h:82
#define ON_DEBUG
StatusCode OutputStream::decodeVetoAlgs ( )
protected

Decode list of Algorithms that this stream is vetoed by.

Definition at line 579 of file OutputStream.cpp.

579  {
580  MsgStream log(msgSvc(), name());
581  ON_DEBUG
582  log << MSG::DEBUG << "VetoAlgs : " << m_vetoNames.value() << endmsg;
584 }
StatusCode decodeAlgorithms(StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs)
Decode specified list of Algorithms.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StringArrayProperty m_vetoNames
Vector of names of Algorithms that this stream is vetoed by.
Definition: OutputStream.h:84
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
const TYPE & value() const
explicit conversion
Definition: Property.h:355
#define ON_DEBUG
std::vector< Algorithm * > * m_vetoAlgs
Vector of Algorithms that this stream is vetoed by.
Definition: OutputStream.h:90
StatusCode OutputStream::execute ( )
virtual

Working entry point.

Implements IAlgorithm.

Reimplemented in SequentialOutputStream, RecordStream, and RunRecordStream.

Definition at line 204 of file OutputStream.cpp.

205 {
206  // Clear any previously existing item list
207  clearSelection();
208  // Test whether this event should be output
209  if ( isEventAccepted() )
210  {
211  const StatusCode sc = writeObjects();
212  clearSelection();
213  ++m_events;
214  if ( sc.isSuccess() && m_fireIncidents )
215  {
218  }
219  else if ( m_fireIncidents )
220  {
223  }
224  return sc;
225  }
226  return StatusCode::SUCCESS;
227 }
bool isEventAccepted() const
Test whether this event should be output.
int m_events
Number of events written to this output stream.
Definition: OutputStream.h:78
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
std::string m_outputName
Name of the output file.
Definition: OutputStream.h:49
virtual StatusCode writeObjects()
Select the different objects and write them to file.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
void clearSelection()
Clear list of selected objects.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: OutputStream.h:35
Base class for all Incidents (computing events).
Definition: Incident.h:16
const std::string WroteToOutputFile
the output file was written to in this event
Definition: Incident.h:74
const std::string FailOutputFile
could not create or write to this file
Definition: Incident.h:73
bool m_fireIncidents
should I fire incidents for writing opening/closing etc?
Definition: OutputStream.h:123
StatusCode OutputStream::finalize ( )
virtual

Terminate OutputStream.

Reimplemented from Algorithm.

Reimplemented in TagCollectionStream, InputCopyStream, RecordStream, and RunRecordStream.

Definition at line 189 of file OutputStream.cpp.

189  {
190  MsgStream log(msgSvc(), name());
191  log << MSG::INFO << "Events output: " << m_events << endmsg;
200  return StatusCode::SUCCESS;
201 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
void clearItems(Items &itms)
Clear item list.
int m_events
Number of events written to this output stream.
Definition: OutputStream.h:78
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::string m_outputName
Name of the output file.
Definition: OutputStream.h:49
SmartIF< IDataProviderSvc > m_pDataProvider
Keep reference to the data provider service.
Definition: OutputStream.h:55
SmartIF< IConversionSvc > m_pConversionSvc
Keep reference to the data conversion service.
Definition: OutputStream.h:59
const std::string EndOutputFile
an output file has been finished
Definition: Incident.h:75
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
Items m_itemList
Vector of items to be saved to this stream.
Definition: OutputStream.h:65
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
SmartIF< IDataManagerSvc > m_pDataManager
Keep reference to the data manager service.
Definition: OutputStream.h:57
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: OutputStream.h:35
void reset(TYPE *ptr=0)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:74
Base class for all Incidents (computing events).
Definition: Incident.h:16
bool m_fireIncidents
should I fire incidents for writing opening/closing etc?
Definition: OutputStream.h:123
Items m_optItemList
Vector of optional items to be saved to this stream.
Definition: OutputStream.h:69
DataStoreItem * OutputStream::findItem ( const std::string &  path)
protected

Find single item identified by its path (exact match)

Definition at line 429 of file OutputStream.cpp.

429  {
430  for(Items::const_iterator i=m_itemList.begin(); i != m_itemList.end(); ++i) {
431  if ( (*i)->path() == path ) return (*i);
432  }
433  for(Items::const_iterator j=m_optItemList.begin(); j != m_optItemList.end(); ++j) {
434  if ( (*j)->path() == path ) return (*j);
435  }
436  return 0;
437 }
list path
Definition: __init__.py:15
Items m_itemList
Vector of items to be saved to this stream.
Definition: OutputStream.h:65
list i
Definition: ana.py:128
Items m_optItemList
Vector of optional items to be saved to this stream.
Definition: OutputStream.h:69
bool OutputStream::hasInput ( ) const
protectedvirtual

Tell if the instance has been configured with input items or not.

Reimplemented in InputCopyStream.

Definition at line 724 of file OutputStream.cpp.

724  {
725  return !(m_itemNames.empty() && m_optItemNames.empty() &&
726  m_algDependentItemList.empty());
727 }
AlgDependentItemNames m_algDependentItemList
Mapping between algorithm names, and a list of items for which, if the algorithm in question accepted...
Definition: OutputStream.h:72
ItemNames m_itemNames
Vector of item names.
Definition: OutputStream.h:63
ItemNames m_optItemNames
Vector of item names.
Definition: OutputStream.h:67
StatusCode OutputStream::initialize ( )
virtual

Initialize OutputStream.

Reimplemented from Algorithm.

Reimplemented in TagCollectionStream, and InputCopyStream.

Definition at line 82 of file OutputStream.cpp.

82  {
83  MsgStream log(msgSvc(), name());
84 
85  // Reset the number of events written
86  m_events = 0;
87  // Get access to the DataManagerSvc
89  if( !m_pDataManager.isValid() ) {
90  log << MSG::FATAL << "Unable to locate IDataManagerSvc interface" << endmsg;
91  return StatusCode::FAILURE;
92  }
93  // Get access to the IncidentService
94  m_incidentSvc = serviceLocator()->service("IncidentSvc");
95  if( !m_incidentSvc.isValid() ) {
96  log << MSG::WARNING << "Error retrieving IncidentSvc." << endmsg;
97  return StatusCode::FAILURE;
98  }
99  // Get access to the assigned data service
101  if( !m_pDataProvider.isValid() ) {
102  log << MSG::FATAL << "Unable to locate IDataProviderSvc interface of " << m_storeName << endmsg;
103  return StatusCode::FAILURE;
104  }
105  if ( hasInput() ) {
106  StatusCode status = connectConversionSvc();
107  if( !status.isSuccess() ) {
108  log << MSG::FATAL << "Unable to connect to conversion service." << endmsg;
111  return status;
112  }
113  }
114 
115  // Clear the list with optional items
117  // Clear the item list
119 
120  // Take the new item list from the properties.
121  ON_DEBUG log << MSG::DEBUG << "ItemList : " << m_itemNames << endmsg;
122  for( ItemNames::const_iterator i = m_itemNames.begin();
123  i != m_itemNames.end(); ++i )
124  {
125  addItem( m_itemList, *i );
126  }
127 
128  // Take the new item list from the properties.
129  ON_DEBUG log << MSG::DEBUG << "OptItemList : " << m_optItemNames << endmsg;
130  for( ItemNames::const_iterator i = m_optItemNames.begin();
131  i != m_optItemNames.end(); ++i )
132  {
133  addItem( m_optItemList, *i );
134  }
135 
136  // prepare the algorithm selected dependent locations
137  ON_DEBUG log << MSG::DEBUG << "AlgDependentItemList : " << m_algDependentItemList << endmsg;
138  for ( AlgDependentItemNames::const_iterator a = m_algDependentItemList.begin();
139  a != m_algDependentItemList.end(); ++a )
140  {
141  // Get the algorithm pointer
142  Algorithm * theAlgorithm = decodeAlgorithm( a->first );
143  if ( theAlgorithm )
144  {
145  // Get the item list for this alg
146  Items& items = m_algDependentItems[theAlgorithm];
147  // Clear the list for this alg
148  clearItems( items );
149  // fill the list again
150  for ( ItemNames::const_iterator i = a->second.begin();
151  i != a->second.end(); ++i )
152  {
153  addItem( items, *i );
154  }
155  }
156  }
157 
158  // Take the item list to the data service preload list.
159  if ( m_doPreLoad ) {
160  for(Items::iterator j = m_itemList.begin(); j != m_itemList.end(); j++) {
162  }
163  // Not working: bad reference counting! pdataSvc->release();
164  }
165 
166  if ( m_doPreLoadOpt ) {
167  for(Items::iterator j=m_optItemList.begin(); j!=m_optItemList.end(); j++) {
169  }
170  }
171  log << MSG::INFO << "Data source: " << m_storeName << " output: " << m_output << endmsg;
172 
173  // Decode the accept, required and veto Algorithms. The logic is the following:
174  // a. The event is accepted if all lists are empty.
175  // b. The event is provisionally accepted if any Algorithm in the accept list
176  // has been executed and has indicated that its filter is passed. This
177  // provisional acceptance can be overridden by the other lists.
178  // c. The event is rejected unless all Algorithms in the required list have
179  // been executed and have indicated that their filter passed.
180  // d. The event is rejected if any Algorithm in the veto list has been
181  // executed and has indicated that its filter has passed.
184  decodeVetoAlgs ().ignore();
185  return StatusCode::SUCCESS;
186 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
void clearItems(Items &itms)
Clear item list.
virtual bool hasInput() const
Tell if the instance has been configured with input items or not.
StatusCode decodeRequireAlgs()
Decode list of Algorithms that this stream requires.
std::string m_storeName
Name of the service managing the data store.
Definition: OutputStream.h:43
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Algorithm.cpp:1091
int m_events
Number of events written to this output stream.
Definition: OutputStream.h:78
virtual StatusCode addPreLoadItem(const DataStoreItem &item)=0
Add an item to the preload list.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
std::string m_outputName
Name of the output file.
Definition: OutputStream.h:49
SmartIF< IDataProviderSvc > m_pDataProvider
Keep reference to the data provider service.
Definition: OutputStream.h:55
AlgDependentItemNames m_algDependentItemList
Mapping between algorithm names, and a list of items for which, if the algorithm in question accepted...
Definition: OutputStream.h:72
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:82
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
virtual StatusCode connectConversionSvc()
AlgDependentItems m_algDependentItems
Items to be saved for specific algorithms.
Definition: OutputStream.h:74
std::vector< DataStoreItem * > Items
Definition: OutputStream.h:29
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Items m_itemList
Vector of items to be saved to this stream.
Definition: OutputStream.h:65
bool m_doPreLoad
Flag indicating whether data pre-loading should be performed.
Definition: OutputStream.h:37
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
void addItem(Items &itms, const std::string &descriptor)
Add item to output streamer list.
bool m_doPreLoadOpt
Flag indicating whether optional items should be preloaded.
Definition: OutputStream.h:39
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
SmartIF< IDataManagerSvc > m_pDataManager
Keep reference to the data manager service.
Definition: OutputStream.h:57
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: OutputStream.h:35
StatusCode decodeVetoAlgs()
Decode list of Algorithms that this stream is vetoed by.
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
ItemNames m_itemNames
Vector of item names.
Definition: OutputStream.h:63
ItemNames m_optItemNames
Vector of item names.
Definition: OutputStream.h:67
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
Base class for all Incidents (computing events).
Definition: Incident.h:16
#define ON_DEBUG
Algorithm * decodeAlgorithm(const std::string &theName)
Decode a single algorithm name.
const std::string FailOutputFile
could not create or write to this file
Definition: Incident.h:73
void ignore() const
Definition: StatusCode.h:107
std::string m_output
Name of the output file specification.
Definition: OutputStream.h:47
list i
Definition: ana.py:128
StatusCode decodeAcceptAlgs()
Decode list of Algorithms that this stream accepts.
bool m_fireIncidents
should I fire incidents for writing opening/closing etc?
Definition: OutputStream.h:123
Items m_optItemList
Vector of optional items to be saved to this stream.
Definition: OutputStream.h:69
bool OutputStream::isEventAccepted ( ) const
protected

Test whether this event should be output.

Definition at line 678 of file OutputStream.cpp.

678  {
679  typedef std::vector<Algorithm*>::iterator AlgIter;
680  bool result = true;
681 
682  // Loop over all Algorithms in the accept list to see
683  // whether any have been executed and have their filter
684  // passed flag set. Any match causes the event to be
685  // provisionally accepted.
686  if ( ! m_acceptAlgs->empty() ) {
687  result = false;
688  for(AlgIter i=m_acceptAlgs->begin(),end=m_acceptAlgs->end(); i != end; ++i) {
689  if ( (*i)->isExecuted() && (*i)->filterPassed() ) {
690  result = true;
691  break;
692  }
693  }
694  }
695 
696  // Loop over all Algorithms in the required list to see
697  // whether all have been executed and have their filter
698  // passed flag set. Any mismatch causes the event to be
699  // rejected.
700  if ( result && ! m_requireAlgs->empty() ) {
701  for(AlgIter i=m_requireAlgs->begin(),end=m_requireAlgs->end(); i != end; ++i) {
702  if ( !(*i)->isExecuted() || !(*i)->filterPassed() ) {
703  result = false;
704  break;
705  }
706  }
707  }
708 
709  // Loop over all Algorithms in the veto list to see
710  // whether any have been executed and have their filter
711  // passed flag set. Any match causes the event to be
712  // rejected.
713  if ( result && ! m_vetoAlgs->empty() ) {
714  for(AlgIter i=m_vetoAlgs->begin(),end=m_vetoAlgs->end(); i != end; ++i) {
715  if ( (*i)->isExecuted() && (*i)->filterPassed() ) {
716  result = false;
717  break;
718  }
719  }
720  }
721  return result;
722 }
std::vector< Algorithm * > * m_requireAlgs
Vector of Algorithms that this stream requires.
Definition: OutputStream.h:88
std::vector< Algorithm * > * m_acceptAlgs
Vector of Algorithms that this stream accepts.
Definition: OutputStream.h:86
tuple end
Definition: IOTest.py:101
std::vector< Algorithm * > * m_vetoAlgs
Vector of Algorithms that this stream is vetoed by.
Definition: OutputStream.h:90
list i
Definition: ana.py:128
void OutputStream::requireAlgsHandler ( Property theProp)
protected

Handler for RequireAlgs Property.

Definition at line 571 of file OutputStream.cpp.

571  {
573  if (sc.isFailure()) {
574  throw GaudiException("Failure in OutputStream::decodeAlgorithms",
575  "OutputStream::requireAlgsHandler",sc);
576  }
577 }
StatusCode decodeAlgorithms(StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs)
Decode specified list of Algorithms.
Define general base for Gaudi exception.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
std::vector< Algorithm * > * m_requireAlgs
Vector of Algorithms that this stream requires.
Definition: OutputStream.h:88
StringArrayProperty m_requireNames
Vector of names of Algorithms that this stream requires.
Definition: OutputStream.h:82
IDataSelector* OutputStream::selectedObjects ( )
inline

Return the list of selected objects.

Definition at line 148 of file OutputStream.h.

148 { return &m_objects; }
IDataSelector m_objects
Collection of objects being selected.
Definition: OutputStream.h:76
void OutputStream::vetoAlgsHandler ( Property theProp)
protected

Handler for VetoAlgs Property.

Definition at line 586 of file OutputStream.cpp.

586  {
588  if (sc.isFailure()) {
589  throw GaudiException("Failure in OutputStream::decodeAlgorithms",
590  "OutputStream::vetoAlgsHandler",sc);
591  }
592 }
StatusCode decodeAlgorithms(StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs)
Decode specified list of Algorithms.
Define general base for Gaudi exception.
StringArrayProperty m_vetoNames
Vector of names of Algorithms that this stream is vetoed by.
Definition: OutputStream.h:84
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
std::vector< Algorithm * > * m_vetoAlgs
Vector of Algorithms that this stream is vetoed by.
Definition: OutputStream.h:90
StatusCode OutputStream::writeObjects ( )
protectedvirtual

Select the different objects and write them to file.

Reimplemented in TagCollectionStream, and SequentialOutputStream.

Definition at line 230 of file OutputStream.cpp.

231 {
232  // Connect the output file to the service
233  StatusCode status = collectObjects();
234  if ( status.isSuccess() )
235  {
237  if ( sel->begin() != sel->end() )
238  {
240  if ( status.isSuccess() )
241  {
242  // Now pass the collection to the persistency service
243  IOpaqueAddress* pAddress = NULL;
244  for ( IDataSelector::iterator j = sel->begin(); j != sel->end(); ++j )
245  {
246  try
247  {
248  const StatusCode iret = m_pConversionSvc->createRep( *j, pAddress );
249  if ( !iret.isSuccess() )
250  {
251  status = iret;
252  continue;
253  }
254  IRegistry* pReg = (*j)->registry();
255  pReg->setAddress(pAddress);
256  }
257  catch ( const std::exception & excpt )
258  {
259  MsgStream log( msgSvc(), name() );
260  const std::string loc = ( (*j)->registry() ?
261  (*j)->registry()->identifier() : "UnRegistered" );
262  log << MSG::FATAL
263  << "std::exception during createRep for '" << loc << "' "
264  << System::typeinfoName( typeid(**j) )
265  << endmsg;
266  log << MSG::FATAL << excpt.what() << endmsg;
267  throw;
268  }
269  }
270  for ( IDataSelector::iterator j = sel->begin(); j != sel->end(); ++j )
271  {
272  try
273  {
274  IRegistry* pReg = (*j)->registry();
275  const StatusCode iret = m_pConversionSvc->fillRepRefs( pReg->address(), *j );
276  if ( !iret.isSuccess() )
277  {
278  status = iret;
279  }
280  }
281  catch ( const std::exception & excpt )
282  {
283  MsgStream log( msgSvc(), name() );
284  const std::string loc = ( (*j)->registry() ?
285  (*j)->registry()->identifier() : "UnRegistered" );
286  log << MSG::FATAL
287  << "std::exception during fillRepRefs for '" << loc << "'"
288  << System::typeinfoName( typeid(**j) )
289  << endmsg;
290  log << MSG::FATAL << excpt.what() << endmsg;
291  throw;
292  }
293  }
294  // Commit the data if there was no error; otherwise possibly discard
295  if ( status.isSuccess() )
296  {
297  status = m_pConversionSvc->commitOutput(m_outputName, true);
298  }
299  else
300  {
302  }
303  }
304  }
305  }
306  return status;
307 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::string m_outputType
Output type: NEW(NEW,CREATE,WRITE,RECREATE), UPDATE)
Definition: OutputStream.h:51
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
std::string m_outputName
Name of the output file.
Definition: OutputStream.h:49
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
IDataSelector * selectedObjects()
Return the list of selected objects.
Definition: OutputStream.h:148
std::vector< DataObject * > IDataSelector
This is only a placeholder to allow me compiling until the responsible guy does his work! M...
Definition: IDataSelector.h:8
SmartIF< IConversionSvc > m_pConversionSvc
Keep reference to the data conversion service.
Definition: OutputStream.h:59
virtual StatusCode connectOutput(const std::string &outputFile)=0
Connect the output file to the service.
virtual StatusCode commitOutput(const std::string &outputFile, bool do_commit)=0
Commit pending output.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual void setAddress(IOpaqueAddress *pAddress)=0
Set/Update Opaque storage address.
Opaque address interface definition.
void ignore() const
Definition: StatusCode.h:107
virtual StatusCode collectObjects()
Collect all objects to be written to the output stream.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.

Member Data Documentation

std::vector<Algorithm*>* OutputStream::m_acceptAlgs
protected

Vector of Algorithms that this stream accepts.

Definition at line 86 of file OutputStream.h.

StringArrayProperty OutputStream::m_acceptNames
protected

Vector of names of Algorithms that this stream accepts.

Definition at line 80 of file OutputStream.h.

OutputStreamAgent* OutputStream::m_agent
protected

Keep reference of agent.

Definition at line 53 of file OutputStream.h.

AlgDependentItemNames OutputStream::m_algDependentItemList
protected

Mapping between algorithm names, and a list of items for which, if the algorithm in question accepted the event, they should be also stored.

Definition at line 72 of file OutputStream.h.

AlgDependentItems OutputStream::m_algDependentItems
protected

Items to be saved for specific algorithms.

Definition at line 74 of file OutputStream.h.

DataStoreItem* OutputStream::m_currentItem
protected

Keep track of the current item.

Definition at line 61 of file OutputStream.h.

bool OutputStream::m_doPreLoad
protected

Flag indicating whether data pre-loading should be performed.

Definition at line 37 of file OutputStream.h.

bool OutputStream::m_doPreLoadOpt
protected

Flag indicating whether optional items should be preloaded.

Definition at line 39 of file OutputStream.h.

int OutputStream::m_events
protected

Number of events written to this output stream.

Definition at line 78 of file OutputStream.h.

bool OutputStream::m_fireIncidents
protected

should I fire incidents for writing opening/closing etc?

Definition at line 123 of file OutputStream.h.

SmartIF<IIncidentSvc> OutputStream::m_incidentSvc
protected

Reference to the incident service.

Definition at line 35 of file OutputStream.h.

Items OutputStream::m_itemList
protected

Vector of items to be saved to this stream.

Definition at line 65 of file OutputStream.h.

ItemNames OutputStream::m_itemNames
protected

Vector of item names.

Definition at line 63 of file OutputStream.h.

IDataSelector OutputStream::m_objects
protected

Collection of objects being selected.

Definition at line 76 of file OutputStream.h.

Items OutputStream::m_optItemList
protected

Vector of optional items to be saved to this stream.

Definition at line 69 of file OutputStream.h.

ItemNames OutputStream::m_optItemNames
protected

Vector of item names.

Definition at line 67 of file OutputStream.h.

std::string OutputStream::m_output
protected

Name of the output file specification.

Definition at line 47 of file OutputStream.h.

std::string OutputStream::m_outputName
protected

Name of the output file.

Definition at line 49 of file OutputStream.h.

std::string OutputStream::m_outputType
protected

Output type: NEW(NEW,CREATE,WRITE,RECREATE), UPDATE)

Definition at line 51 of file OutputStream.h.

SmartIF<IConversionSvc> OutputStream::m_pConversionSvc
protected

Keep reference to the data conversion service.

Definition at line 59 of file OutputStream.h.

SmartIF<IDataManagerSvc> OutputStream::m_pDataManager
protected

Keep reference to the data manager service.

Definition at line 57 of file OutputStream.h.

SmartIF<IDataProviderSvc> OutputStream::m_pDataProvider
protected

Keep reference to the data provider service.

Definition at line 55 of file OutputStream.h.

std::string OutputStream::m_persName
protected

Name of the persistency service capable to write data from the store.

Definition at line 45 of file OutputStream.h.

std::vector<Algorithm*>* OutputStream::m_requireAlgs
protected

Vector of Algorithms that this stream requires.

Definition at line 88 of file OutputStream.h.

StringArrayProperty OutputStream::m_requireNames
protected

Vector of names of Algorithms that this stream requires.

Definition at line 82 of file OutputStream.h.

std::string OutputStream::m_storeName
protected

Name of the service managing the data store.

Definition at line 43 of file OutputStream.h.

bool OutputStream::m_verifyItems
protected

Flag to indicate that item consistency should be checked.

Definition at line 41 of file OutputStream.h.

std::vector<Algorithm*>* OutputStream::m_vetoAlgs
protected

Vector of Algorithms that this stream is vetoed by.

Definition at line 90 of file OutputStream.h.

StringArrayProperty OutputStream::m_vetoNames
protected

Vector of names of Algorithms that this stream is vetoed by.

Definition at line 84 of file OutputStream.h.


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