All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
*, Items
AlgDependentItems
 
typedef std::map< std::string,
ItemNames
AlgDependentItemNames
 
- Public Types inherited from Algorithm
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 extend_interfaces3
< IAlgorithm, IProperty,
IStateful
extend_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...
 
- 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...
 
- Public Types inherited from IInterface
enum  Status { 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...
 

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...
 
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...
 
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...
 
- Public Member Functions inherited from IAlgorithm
 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...
 
- 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...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from 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...
 

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

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 29 of file OutputStream.cpp.

30 : Algorithm(name, pSvcLocator)
31 {
32  m_doPreLoad = true;
33  m_doPreLoadOpt = false;
34  m_verifyItems = true;
35  m_output = "";
36  m_outputName = "";
37  m_outputType = "UPDATE";
38  m_storeName = "EventDataSvc";
39  m_persName = "EventPersistencySvc";
40  m_agent = new OutputStreamAgent(this);
41  m_acceptAlgs = new std::vector<Algorithm*>();
42  m_requireAlgs = new std::vector<Algorithm*>();
43  m_vetoAlgs = new std::vector<Algorithm*>();
46  m_fireIncidents = true;
47  declareProperty("ItemList", m_itemNames);
48  declareProperty("OptItemList", m_optItemNames);
49  declareProperty("AlgDependentItemList", m_algDependentItemList);
50  declareProperty("Preload", m_doPreLoad);
51  declareProperty("PreloadOptItems", m_doPreLoadOpt);
52  declareProperty("Output", m_output);
53  declareProperty("OutputFile", m_outputName);
54  declareProperty("EvtDataSvc", m_storeName);
55  declareProperty("EvtConversionSvc", m_persName);
56  declareProperty("AcceptAlgs", m_acceptNames);
57  declareProperty("RequireAlgs", m_requireNames);
58  declareProperty("VetoAlgs", m_vetoNames);
59  declareProperty("VerifyItems", m_verifyItems);
62 
63  // Associate action handlers with the AcceptAlgs, RequireAlgs and VetoAlgs.
67 
68  //setProperty( "OutputLevel", 2 );
69 
70 }
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:397
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 73 of file OutputStream.cpp.

73  {
74  delete m_agent;
75  delete m_acceptAlgs;
76  delete m_requireAlgs;
77  delete m_vetoAlgs;
78 }
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 557 of file OutputStream.cpp.

557  {
559  if (sc.isFailure()) {
560  throw GaudiException("Failure in OutputStream::decodeAlgorithms",
561  "OutputStream::acceptAlgsHandler",sc);
562  }
563 }
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:72
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 439 of file OutputStream.cpp.

439  {
440  MsgStream log(msgSvc(), name());
441  int level = 0;
442  size_t sep = descriptor.rfind("#");
443  std::string obj_path (descriptor,0,sep);
444  std::string slevel (descriptor,sep+1,descriptor.length());
445  if ( slevel == "*" ) {
446  level = 9999999;
447  }
448  else {
449  level = atoi(slevel.c_str());
450  }
451  if ( m_verifyItems ) {
452  size_t idx = obj_path.find("/",1);
453  while(idx != std::string::npos) {
454  std::string sub_item = obj_path.substr(0,idx);
455  if ( 0 == findItem(sub_item) ) {
456  addItem(itms, sub_item+"#1");
457  }
458  idx = obj_path.find("/",idx+1);
459  }
460  }
461  DataStoreItem* item = new DataStoreItem(obj_path, level);
462  ON_DEBUG
463  log << MSG::DEBUG << "Adding OutputStream item " << item->path()
464  << " with " << item->depth()
465  << " level(s)." << endmsg;
466  itms.push_back( item );
467 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
int depth() const
Accessor: Retrieve load depth.
Definition: DataStoreItem.h:70
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
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
void OutputStream::clearItems ( Items itms)

Clear item list.

Definition at line 419 of file OutputStream.cpp.

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

Clear list of selected objects.

Definition at line 414 of file OutputStream.cpp.

414  {
415  m_objects.erase(m_objects.begin(), m_objects.end());
416 }
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 309 of file OutputStream.cpp.

309  {
310  if ( level < m_currentItem->depth() ) {
311  if ( dir->object() != 0 ) {
312  /*
313  std::cout << "Analysing ("
314  << dir->name()
315  << ") Object:"
316  << ((dir->object()==0) ? "UNLOADED" : "LOADED")
317  << std::endl;
318  */
319  m_objects.push_back(dir->object());
320  return true;
321  }
322  }
323  return false;
324 }
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 327 of file OutputStream.cpp.

327  {
328  MsgStream log(msgSvc(), name());
330 
331  // Traverse the tree and collect the requested objects
332  for ( Items::iterator i = m_itemList.begin(); i != m_itemList.end(); i++ ) {
333  DataObject* obj = 0;
334  m_currentItem = (*i);
335  StatusCode iret = m_pDataProvider->retrieveObject(m_currentItem->path(), obj);
336  if ( iret.isSuccess() ) {
337  iret = m_pDataManager->traverseSubTree(obj, m_agent);
338  if ( !iret.isSuccess() ) {
339  status = iret;
340  }
341  }
342  else {
343  log << MSG::ERROR << "Cannot write mandatory object(s) (Not found) "
344  << m_currentItem->path() << endmsg;
345  status = iret;
346  }
347  }
348 
349  // Traverse the tree and collect the requested objects (tolerate missing items here)
350  for ( Items::iterator i = m_optItemList.begin(); i != m_optItemList.end(); i++ ) {
351  DataObject* obj = 0;
352  m_currentItem = (*i);
353  StatusCode iret = m_pDataProvider->retrieveObject(m_currentItem->path(), obj);
354  if ( iret.isSuccess() ) {
355  iret = m_pDataManager->traverseSubTree(obj, m_agent);
356  }
357  if ( !iret.isSuccess() ) {
358  ON_DEBUG
359  log << MSG::DEBUG << "Ignore request to write non-mandatory object(s) "
360  << m_currentItem->path() << endmsg;
361  }
362  }
363 
364  // Collect objects dependent on particular algorithms
365  for ( AlgDependentItems::const_iterator iAlgItems = m_algDependentItems.begin();
366  iAlgItems != m_algDependentItems.end(); ++iAlgItems )
367  {
368  Algorithm * alg = iAlgItems->first;
369  const Items& items = iAlgItems->second;
370  if ( alg->isExecuted() && alg->filterPassed() )
371  {
372  ON_DEBUG
373  log << MSG::DEBUG << "Algorithm '" << alg->name() << "' fired. Adding " << items << endmsg;
374  for ( Items::const_iterator i = items.begin(); i != items.end(); ++i )
375  {
376  DataObject* obj = NULL;
377  m_currentItem = (*i);
378  StatusCode iret = m_pDataProvider->retrieveObject(m_currentItem->path(),obj);
379  if ( iret.isSuccess() )
380  {
381  iret = m_pDataManager->traverseSubTree(obj,m_agent);
382  if ( !iret.isSuccess() ) { status = iret; }
383  }
384  else
385  {
386  log << MSG::ERROR << "Cannot write mandatory (algorithm dependent) object(s) (Not found) "
387  << m_currentItem->path() << endmsg;
388  status = iret;
389  }
390  }
391  }
392  }
393 
394  if (status.isSuccess())
395  {
396  // Remove duplicates from the list of objects, preserving the order in the list
397  std::set<DataObject*> unique;
398  std::vector<DataObject*> tmp; // temporary vector with the reduced list
399  tmp.reserve(m_objects.size());
400  for (std::vector<DataObject*>::iterator o = m_objects.begin(); o != m_objects.end(); ++o) {
401  if (!unique.count(*o)) {
402  // if the pointer is not in the set, add it to both the set and the temporary vector
403  unique.insert(*o);
404  tmp.push_back(*o);
405  }
406  }
407  m_objects.swap(tmp); // swap the data of the two vectors
408  }
409 
410  return status;
411 }
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
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:62
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
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
list i
Definition: ana.py:128
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Items m_optItemList
Vector of optional items to be saved to this stream.
Definition: OutputStream.h:69
StatusCode OutputStream::connectConversionSvc ( )
virtual

Definition at line 470 of file OutputStream.cpp.

470  {
471  StatusCode status = StatusCode(StatusCode::FAILURE, true);
472  MsgStream log(msgSvc(), name());
473  // Get output file from input
474  std::string dbType, svc, shr;
475  Tokenizer tok(true);
476  tok.analyse(m_output, " ", "", "", "=", "'", "'");
477  for(Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); ++i) {
478  const std::string& tag = (*i).tag();
479  const std::string& val = (*i).value();
480  switch( ::toupper(tag[0]) ) {
481  case 'D':
482  m_outputName = val;
483  break;
484  case 'T':
485  dbType = val;
486  break;
487  case 'S':
488  switch( ::toupper(tag[1]) ) {
489  case 'V': svc = val; break;
490  case 'H': shr = "YES"; break;
491  }
492  break;
493  case 'O': // OPT='<NEW<CREATE,WRITE,RECREATE>, UPDATE>'
494  switch( ::toupper(val[0]) ) {
495  case 'R':
496  if ( ::strncasecmp(val.c_str(),"RECREATE",3)==0 )
497  m_outputType = "RECREATE";
498  else if ( ::strncasecmp(val.c_str(),"READ",3)==0 )
499  m_outputType = "READ";
500  break;
501  case 'C':
502  case 'N':
503  case 'W':
504  m_outputType = "NEW";
505  break;
506  case 'U':
507  m_outputType = "UPDATE";
508  break;
509  default:
510  m_outputType = "???";
511  break;
512  }
513  break;
514  default:
515  break;
516  }
517  }
518  if ( !shr.empty() ) m_outputType += "|SHARED";
519  // Get access to the default Persistency service
520  // The default service is the same for input as for output.
521  // If this is not desired, then a specialized OutputStream must overwrite
522  // this value.
523  if ( dbType.length() > 0 || svc.length() > 0 ) {
524  std::string typ = dbType.length()>0 ? dbType : svc;
526  if( !ipers.isValid() ) {
527  log << MSG::FATAL << "Unable to locate IPersistencySvc interface of " << m_persName << endmsg;
528  return StatusCode::FAILURE;
529  }
530  IConversionSvc *cnvSvc = 0;
531  status = ipers->getService(typ, cnvSvc);
532  if( !status.isSuccess() ) {
533  log << MSG::FATAL << "Unable to locate IConversionSvc interface of database type " << typ << endmsg;
534  return status;
535  }
536  // Increase reference count and keep service.
537  m_pConversionSvc = cnvSvc;
538  }
539  else
540  {
541  log << MSG::FATAL
542  << "Unable to locate IConversionSvc interface (Unknown technology) " << endmsg
543  << "You either have to specify a technology name or a service name!" << endmsg
544  << "Please correct the job option \"" << name() << ".Output\" !" << endmsg;
545  return StatusCode::FAILURE;
546  }
547  return StatusCode::SUCCESS;
548 }
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
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
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
STL Include files.
Definition: Tokenizer.h:24
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:207
std::string m_output
Name of the output file specification.
Definition: OutputStream.h:47
list i
Definition: ana.py:128
void toupper(std::string &s)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode OutputStream::decodeAcceptAlgs ( )
protected

Decode list of Algorithms that this stream accepts.

Definition at line 550 of file OutputStream.cpp.

550  {
551  MsgStream log(msgSvc(), name());
552  ON_DEBUG
553  log << MSG::DEBUG << "AcceptAlgs : " << m_acceptNames.value() << endmsg;
555 }
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
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
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Algorithm * OutputStream::decodeAlgorithm ( const std::string &  theName)
protected

Decode a single algorithm name.

Definition at line 595 of file OutputStream.cpp.

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

Decode specified list of Algorithms.

Definition at line 633 of file OutputStream.cpp.

635 {
636  // Reset the list of Algorithms
637  theAlgs->clear( );
638 
640 
641  // Build the list of Algorithms from the names list
642  const std::vector<std::string> nameList = theNames.value( );
643  for ( std::vector<std::string>::const_iterator it = nameList.begin();
644  it != nameList.end(); ++it )
645  {
646 
647  Algorithm * theAlgorithm = decodeAlgorithm( *it );
648  if ( theAlgorithm )
649  {
650  // Check that the specified algorithm doesn't already exist in the list
651  for ( std::vector<Algorithm*>::iterator ita = theAlgs->begin();
652  ita != theAlgs->end(); ++ita )
653  {
654  Algorithm * existAlgorithm = (*ita);
655  if ( theAlgorithm == existAlgorithm )
656  {
657  result = StatusCode::FAILURE;
658  break;
659  }
660  }
661  if ( result.isSuccess( ) )
662  {
663  theAlgorithm->addRef();
664  theAlgs->push_back( theAlgorithm );
665  }
666  }
667  else
668  {
669  MsgStream log( msgSvc( ), name( ) );
670  log << MSG::INFO << *it << " doesn't exist - ignored" << endmsg;
671  }
672 
673  }
674  result = StatusCode::SUCCESS;
675 
676  return result;
677 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
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.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode OutputStream::decodeRequireAlgs ( )
protected

Decode list of Algorithms that this stream requires.

Definition at line 565 of file OutputStream.cpp.

565  {
566  MsgStream log(msgSvc(), name());
567  ON_DEBUG
568  log << MSG::DEBUG << "RequireAlgs : " << m_requireNames.value() << endmsg;
570 }
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
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
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode OutputStream::decodeVetoAlgs ( )
protected

Decode list of Algorithms that this stream is vetoed by.

Definition at line 580 of file OutputStream.cpp.

580  {
581  MsgStream log(msgSvc(), name());
582  ON_DEBUG
583  log << MSG::DEBUG << "VetoAlgs : " << m_vetoNames.value() << endmsg;
585 }
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
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
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode OutputStream::execute ( )
virtual

Working entry point.

Implements IAlgorithm.

Reimplemented in SequentialOutputStream, RecordStream, and RunRecordStream.

Definition at line 203 of file OutputStream.cpp.

204 {
205  // Clear any previously existing item list
206  clearSelection();
207  // Test whether this event should be output
208  if ( isEventAccepted() )
209  {
210  const StatusCode sc = writeObjects();
211  clearSelection();
212  ++m_events;
213  if ( sc.isSuccess() && m_fireIncidents )
214  {
215  m_incidentSvc->fireIncident(Incident(m_outputName,
217  }
218  else if ( m_fireIncidents )
219  {
220  m_incidentSvc->fireIncident(Incident(m_outputName,
222  }
223  return sc;
224  }
225  return StatusCode::SUCCESS;
226 }
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:62
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.
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 188 of file OutputStream.cpp.

188  {
189  MsgStream log(msgSvc(), name());
190  log << MSG::INFO << "Events output: " << m_events << endmsg;
199  return StatusCode::SUCCESS;
200 }
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
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
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
Base class for all Incidents (computing events).
Definition: Incident.h:16
void reset(TYPE *ptr=0)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:74
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
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 428 of file OutputStream.cpp.

428  {
429  for(Items::const_iterator i=m_itemList.begin(); i != m_itemList.end(); ++i) {
430  if ( (*i)->path() == path ) return (*i);
431  }
432  for(Items::const_iterator j=m_optItemList.begin(); j != m_optItemList.end(); ++j) {
433  if ( (*j)->path() == path ) return (*j);
434  }
435  return 0;
436 }
Items m_itemList
Vector of items to be saved to this stream.
Definition: OutputStream.h:65
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
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 725 of file OutputStream.cpp.

725  {
726  return !(m_itemNames.empty() && m_optItemNames.empty() &&
727  m_algDependentItemList.empty());
728 }
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 81 of file OutputStream.cpp.

81  {
82  MsgStream log(msgSvc(), name());
83 
84  // Reset the number of events written
85  m_events = 0;
86  // Get access to the DataManagerSvc
88  if( !m_pDataManager.isValid() ) {
89  log << MSG::FATAL << "Unable to locate IDataManagerSvc interface" << endmsg;
90  return StatusCode::FAILURE;
91  }
92  // Get access to the IncidentService
93  m_incidentSvc = serviceLocator()->service("IncidentSvc");
94  if( !m_incidentSvc.isValid() ) {
95  log << MSG::WARNING << "Error retrieving IncidentSvc." << endmsg;
96  return StatusCode::FAILURE;
97  }
98  // Get access to the assigned data service
100  if( !m_pDataProvider.isValid() ) {
101  log << MSG::FATAL << "Unable to locate IDataProviderSvc interface of " << m_storeName << endmsg;
102  return StatusCode::FAILURE;
103  }
104  if ( hasInput() ) {
105  StatusCode status = connectConversionSvc();
106  if( !status.isSuccess() ) {
107  log << MSG::FATAL << "Unable to connect to conversion service." << endmsg;
110  return status;
111  }
112  }
113 
114  // Clear the list with optional items
116  // Clear the item list
118 
119  // Take the new item list from the properties.
120  ON_DEBUG log << MSG::DEBUG << "ItemList : " << m_itemNames << endmsg;
121  for( ItemNames::const_iterator i = m_itemNames.begin();
122  i != m_itemNames.end(); ++i )
123  {
124  addItem( m_itemList, *i );
125  }
126 
127  // Take the new item list from the properties.
128  ON_DEBUG log << MSG::DEBUG << "OptItemList : " << m_optItemNames << endmsg;
129  for( ItemNames::const_iterator i = m_optItemNames.begin();
130  i != m_optItemNames.end(); ++i )
131  {
132  addItem( m_optItemList, *i );
133  }
134 
135  // prepare the algorithm selected dependent locations
136  ON_DEBUG log << MSG::DEBUG << "AlgDependentItemList : " << m_algDependentItemList << endmsg;
137  for ( AlgDependentItemNames::const_iterator a = m_algDependentItemList.begin();
138  a != m_algDependentItemList.end(); ++a )
139  {
140  // Get the algorithm pointer
141  Algorithm * theAlgorithm = decodeAlgorithm( a->first );
142  if ( theAlgorithm )
143  {
144  // Get the item list for this alg
145  Items& items = m_algDependentItems[theAlgorithm];
146  // Clear the list for this alg
147  clearItems( items );
148  // fill the list again
149  for ( ItemNames::const_iterator i = a->second.begin();
150  i != a->second.end(); ++i )
151  {
152  addItem( items, *i );
153  }
154  }
155  }
156 
157  // Take the item list to the data service preload list.
158  if ( m_doPreLoad ) {
159  for(Items::iterator j = m_itemList.begin(); j != m_itemList.end(); j++) {
160  m_pDataProvider->addPreLoadItem( *(*j) ).ignore();
161  }
162  // Not working: bad reference counting! pdataSvc->release();
163  }
164 
165  if ( m_doPreLoadOpt ) {
166  for(Items::iterator j=m_optItemList.begin(); j!=m_optItemList.end(); j++) {
167  m_pDataProvider->addPreLoadItem( *(*j) );
168  }
169  }
170  log << MSG::INFO << "Data source: " << m_storeName << " output: " << m_output << endmsg;
171 
172  // Decode the accept, required and veto Algorithms. The logic is the following:
173  // a. The event is accepted if all lists are empty.
174  // b. The event is provisionally accepted if any Algorithm in the accept list
175  // has been executed and has indicated that its filter is passed. This
176  // provisional acceptance can be overridden by the other lists.
177  // c. The event is rejected unless all Algorithms in the required list have
178  // been executed and have indicated that their filter passed.
179  // d. The event is rejected if any Algorithm in the veto list has been
180  // executed and has indicated that its filter has passed.
183  decodeVetoAlgs ().ignore();
184  return StatusCode::SUCCESS;
185 }
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
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
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
virtual StatusCode connectConversionSvc()
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
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
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:94
std::string m_output
Name of the output file specification.
Definition: OutputStream.h:47
list i
Definition: ana.py:128
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
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 679 of file OutputStream.cpp.

679  {
680  typedef std::vector<Algorithm*>::iterator AlgIter;
681  bool result = true;
682 
683  // Loop over all Algorithms in the accept list to see
684  // whether any have been executed and have their filter
685  // passed flag set. Any match causes the event to be
686  // provisionally accepted.
687  if ( ! m_acceptAlgs->empty() ) {
688  result = false;
689  for(AlgIter i=m_acceptAlgs->begin(),end=m_acceptAlgs->end(); i != end; ++i) {
690  if ( (*i)->isExecuted() && (*i)->filterPassed() ) {
691  result = true;
692  break;
693  }
694  }
695  }
696 
697  // Loop over all Algorithms in the required list to see
698  // whether all have been executed and have their filter
699  // passed flag set. Any mismatch causes the event to be
700  // rejected.
701  if ( result && ! m_requireAlgs->empty() ) {
702  for(AlgIter i=m_requireAlgs->begin(),end=m_requireAlgs->end(); i != end; ++i) {
703  if ( !(*i)->isExecuted() || !(*i)->filterPassed() ) {
704  result = false;
705  break;
706  }
707  }
708  }
709 
710  // Loop over all Algorithms in the veto list to see
711  // whether any have been executed and have their filter
712  // passed flag set. Any match causes the event to be
713  // rejected.
714  if ( result && ! m_vetoAlgs->empty() ) {
715  for(AlgIter i=m_vetoAlgs->begin(),end=m_vetoAlgs->end(); i != end; ++i) {
716  if ( (*i)->isExecuted() && (*i)->filterPassed() ) {
717  result = false;
718  break;
719  }
720  }
721  }
722  return result;
723 }
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 572 of file OutputStream.cpp.

572  {
574  if (sc.isFailure()) {
575  throw GaudiException("Failure in OutputStream::decodeAlgorithms",
576  "OutputStream::requireAlgsHandler",sc);
577  }
578 }
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:72
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 587 of file OutputStream.cpp.

587  {
589  if (sc.isFailure()) {
590  throw GaudiException("Failure in OutputStream::decodeAlgorithms",
591  "OutputStream::vetoAlgsHandler",sc);
592  }
593 }
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:72
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 229 of file OutputStream.cpp.

230 {
231  // Connect the output file to the service
232  StatusCode status = collectObjects();
233  if ( status.isSuccess() )
234  {
236  if ( sel->begin() != sel->end() )
237  {
238  status = m_pConversionSvc->connectOutput(m_outputName, m_outputType);
239  if ( status.isSuccess() )
240  {
241  // Now pass the collection to the persistency service
242  IOpaqueAddress* pAddress = NULL;
243  for ( IDataSelector::iterator j = sel->begin(); j != sel->end(); ++j )
244  {
245  try
246  {
247  const StatusCode iret = m_pConversionSvc->createRep( *j, pAddress );
248  if ( !iret.isSuccess() )
249  {
250  status = iret;
251  continue;
252  }
253  IRegistry* pReg = (*j)->registry();
254  pReg->setAddress(pAddress);
255  }
256  catch ( const std::exception & excpt )
257  {
258  MsgStream log( msgSvc(), name() );
259  const std::string loc = ( (*j)->registry() ?
260  (*j)->registry()->identifier() : "UnRegistered" );
261  log << MSG::FATAL
262  << "std::exception during createRep for '" << loc << "' "
263  << System::typeinfoName( typeid(**j) )
264  << endmsg;
265  log << MSG::FATAL << excpt.what() << endmsg;
266  throw;
267  }
268  }
269  for ( IDataSelector::iterator j = sel->begin(); j != sel->end(); ++j )
270  {
271  try
272  {
273  IRegistry* pReg = (*j)->registry();
274  const StatusCode iret = m_pConversionSvc->fillRepRefs( pReg->address(), *j );
275  if ( !iret.isSuccess() )
276  {
277  status = iret;
278  }
279  }
280  catch ( const std::exception & excpt )
281  {
282  MsgStream log( msgSvc(), name() );
283  const std::string loc = ( (*j)->registry() ?
284  (*j)->registry()->identifier() : "UnRegistered" );
285  log << MSG::FATAL
286  << "std::exception during fillRepRefs for '" << loc << "'"
287  << System::typeinfoName( typeid(**j) )
288  << endmsg;
289  log << MSG::FATAL << excpt.what() << endmsg;
290  throw;
291  }
292  }
293  // Commit the data if there was no error; otherwise possibly discard
294  if ( status.isSuccess() )
295  {
296  status = m_pConversionSvc->commitOutput(m_outputName, true);
297  }
298  else
299  {
300  m_pConversionSvc->commitOutput(m_outputName, false).ignore();
301  }
302  }
303  }
304  }
305  return status;
306 }
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
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
std::string m_outputName
Name of the output file.
Definition: OutputStream.h:49
IDataSelector * selectedObjects()
Return the list of selected objects.
Definition: OutputStream.h:148
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
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.
virtual StatusCode collectObjects()
Collect all objects to be written to the output stream.
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
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

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: