Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v28r2p1 (f1a77ff4)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DataStreamTool Class Reference

#include <GaudiKernel/DataStreamTool.h>

Inheritance diagram for DataStreamTool:
Collaboration diagram for DataStreamTool:

Public Types

typedef std::vector< EventSelectorDataStream * > Streams
 
typedef std::vector< Gaudi::Property< std::string > > Properties
 
- Public Types inherited from extends< AlgTool, IDataStreamTool >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from AlgTool
typedef Gaudi::PluginService::Factory< IAlgTool *, const std::string &, const std::string &, const IInterface * > Factory
 
- Public Types inherited from extends< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > >, IDataHandleHolder >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 

Public Member Functions

 DataStreamTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor. More...
 
 ~DataStreamTool () override=default
 Destructor. More...
 
StatusCode initialize () override
 
StatusCode finalize () override
 
StatusCode initializeStream (EventSelectorDataStream *) override
 Initialize newly opened stream. More...
 
StatusCode finalizeStream (EventSelectorDataStream *) override
 Finalize no longer needed stream. More...
 
StatusCode getNextStream (const EventSelectorDataStream *&, size_type &) override
 
StatusCode getPreviousStream (const EventSelectorDataStream *&, size_type &) override
 
StatusCode addStream (const std::string &) override
 
StatusCode addStreams (const StreamSpecs &) override
 
StatusCode eraseStream (const std::string &) override
 
EventSelectorDataStreamgetStream (const std::string &) override
 Retrieve stream by name. More...
 
EventSelectorDataStreamgetStream (size_type) override
 
EventSelectorDataStreamlastStream () override
 
size_type size () override
 
StatusCode clear () override
 
virtual StreamsgetStreams ()
 
virtual Streams::iterator beginOfStreams ()
 
virtual Streams::iterator endOfStreams ()
 
- Public Member Functions inherited from extends< AlgTool, IDataStreamTool >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 ~extends () override=default
 Virtual destructor. More...
 
- Public Member Functions inherited from AlgTool
StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown) override
 Query for a given interface. More...
 
const std::stringname () const override
 Retrieve full identifying name of the concrete tool object. More...
 
const std::stringtype () const override
 Retrieve type (concrete class) of the sub-algtool. More...
 
const IInterfaceparent () const override
 Retrieve parent of the sub-algtool. More...
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode sysInitialize () override
 Initialize AlgTool. More...
 
StatusCode sysStart () override
 Start AlgTool. More...
 
StatusCode sysStop () override
 Stop AlgTool. More...
 
StatusCode sysFinalize () override
 Finalize AlgTool. More...
 
StatusCode sysReinitialize () override
 Initialize AlgTool. More...
 
StatusCode sysRestart () override
 Start AlgTool. More...
 
 AlgTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator. More...
 
ISvcLocatorsvcLoc () const
 shortcut for the method service locator More...
 
IDataProviderSvcevtSvc () const
 accessor to event service service More...
 
IToolSvctoolSvc () const
 The standard ToolSvc service, Return a pointer to the service if present. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified in the jobOptions via the job option service. More...
 
template<class T >
StatusCode service (const std::string &name, T *&svc, 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 &type, const std::string &name, T *&svc) const
 Access a service by name, 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...
 
template<typename T >
SmartIF< T > service (const std::string &name, const bool createIf=true, const bool quiet=false) const
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
virtual void acceptDHVisitor (IDataHandleVisitor *) const override
 
void commitHandles () override
 
void registerTool (IAlgTool *tool) const
 
void deregisterTool (IAlgTool *tool) const
 
template<class T >
StatusCode declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
 Declare used public tool. More...
 
template<class T >
StatusCode declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
 Declare used private tool. More...
 
const std::vector< IAlgTool * > & tools () const
 
IAuditorSvcauditorSvc () const
 Access the auditor service. More...
 
IMonitorSvcmonitorSvc () 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...
 
 ~AlgTool () override
 
- Public Member Functions inherited from DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > > >
std::vector< Gaudi::DataHandle * > inputHandles () const override
 
std::vector< Gaudi::DataHandle * > outputHandles () const override
 
virtual const DataObjIDCollextraInputDeps () const override
 
virtual const DataObjIDCollextraOutputDeps () const override
 
void declare (Gaudi::DataHandle &handle) override
 
void renounce (Gaudi::DataHandle &handle) override
 
const DataObjIDCollinputDataObjs () const override
 
const DataObjIDColloutputDataObjs () const override
 
void addDependency (const DataObjID &id, const Gaudi::DataHandle::Mode &mode) override
 
- Public Member Functions inherited from extends< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > >, IDataHandleHolder >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 ~extends () override=default
 Virtual destructor. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > >
 PropertyHolder ()=default
 
 ~PropertyHolder () override=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
 Specializations for various GaudiHandles. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const __attribute__((deprecated))
 Backward compatibility function for getting the output level. More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces... >
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Protected Member Functions

StatusCode createSelector (const std::string &, const std::string &, IEvtSelector *&) override
 
StatusCode createStream (const std::string &, const std::string &, EventSelectorDataStream *&) override
 
StatusCode connectStream (EventSelectorDataStream *)
 Connect single stream by reference. More...
 
StatusCode connectStream (const std::string &)
 Connect single stream by name. More...
 
Streams::iterator getStreamIterator (const std::string &)
 
- Protected Member Functions inherited from AlgTool
template<typename I >
void declareInterface (I *i)
 
std::vector< IAlgTool * > & tools ()
 
- Protected Member Functions inherited from DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > > >
void initDataHandleHolder ()
 initializes all handles - called by the sysInitialize method of any descendant of this More...
 
- Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > >
Gaudi::Details::PropertyBaseproperty (const std::string &name) const
 
- Protected Member Functions inherited from CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Protected Attributes

size_type m_streamID = 0
 
size_type m_streamCount = 0
 
Streams m_streams
 
StreamSpecs m_streamSpecs
 
SmartIF< IIncidentSvcm_incidentSvc = nullptr
 Reference to the incident service. More...
 
- Protected Attributes inherited from AlgTool
std::unique_ptr< IDataHandleVisitorm_updateDataHandles
 Hook for for derived classes to provide a custom visitor for data handles. More...
 
- Protected Attributes inherited from DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > > >
DataObjIDColl m_inputDataObjs
 
DataObjIDColl m_outputDataObjs
 

Private Member Functions

 DataStreamTool (const DataStreamTool &)=delete
 Fake copy constructor (never implemented). More...
 
DataStreamTooloperator= (const DataStreamTool &)=delete
 Fake assignment operator (never implemented). More...
 

Detailed Description

Author
Andres Felipe Osorio Oliveros
Marco Clemencic
Date
2006-09-21

Definition at line 28 of file DataStreamTool.h.

Member Typedef Documentation

Constructor & Destructor Documentation

DataStreamTool::DataStreamTool ( const std::string type,
const std::string name,
const IInterface parent 
)

Standard constructor.

Definition at line 25 of file DataStreamTool.cpp.

26  : base_class( type, name, parent )
27 {
28  // declareInterface<IDataStreamTool>(this);
29 }
extends base_class
Typedef to this class.
Definition: extends.h:14
DataStreamTool::~DataStreamTool ( )
overridedefault

Destructor.

DataStreamTool::DataStreamTool ( const DataStreamTool )
privatedelete

Fake copy constructor (never implemented).

Member Function Documentation

StatusCode DataStreamTool::addStream ( const std::string input)
override

Definition at line 50 of file DataStreamTool.cpp.

51 {
52 
53  if ( getStream( input ) ) {
54  warning() << "Input stream " << input << "already in use" << endmsg;
55  }
56 
57  m_streamSpecs.push_back( input );
58 
59  auto strname = name() + '_' + std::to_string( ++m_streamCount );
60  EventSelectorDataStream* s = nullptr;
61 
62  StatusCode status = createStream( strname, input, s );
63 
64  if ( status.isSuccess() && s ) {
65  s->addRef();
66  m_streams.push_back( s );
67  status = StatusCode::SUCCESS;
68  } else {
69  if ( s ) {
70  s->release();
71  error() << "Error connecting/creating Stream: " << s << endmsg;
72  }
73  error() << "Error connecting/creating Stream: " << input << endmsg;
74  status = StatusCode::FAILURE;
75  }
76  return status;
77 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
T to_string(T...args)
StatusCode createStream(const std::string &, const std::string &, EventSelectorDataStream *&) override
T push_back(T...args)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
unsigned long addRef() override
Reference Interface instance.
Definition: implements.h:44
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventSelectorDataStream * getStream(const std::string &) override
Retrieve stream by name.
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:63
Definition of class EventSelectorDataStream.
size_type m_streamCount
string s
Definition: gaudirun.py:245
StreamSpecs m_streamSpecs
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
unsigned long release() override
Release Interface instance.
Definition: implements.h:46
StatusCode DataStreamTool::addStreams ( const StreamSpecs &  inputs)
override

Definition at line 79 of file DataStreamTool.cpp.

80 {
81 
83  for ( auto& i : inputs ) {
84  status = addStream( i );
85  if ( !status.isSuccess() ) break;
86  }
87  return status;
88 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode addStream(const std::string &) override
virtual Streams::iterator DataStreamTool::beginOfStreams ( )
inlinevirtual

Definition at line 71 of file DataStreamTool.h.

71 { return m_streams.begin(); };
T begin(T...args)
StatusCode DataStreamTool::clear ( )
override

Definition at line 197 of file DataStreamTool.cpp.

198 {
199 
200  StatusCode iret, status = StatusCode::SUCCESS;
201  iret.ignore();
202 
203  // disconnect the streams
204  for ( auto& il : m_streamSpecs ) {
206  if ( s ) {
207  if ( s->isInitialized() ) {
208  iret = finalizeStream( s );
209  if ( !iret.isSuccess() ) {
210  error() << "Error finalizing Stream" << il << endmsg;
211  status = iret;
212  }
213  }
214  iret = eraseStream( il );
215  if ( !iret.isSuccess() ) {
216  error() << "Error diconnecting Stream" << il << endmsg;
217  status = iret;
218  }
219  }
220  }
221 
222  m_streamSpecs.clear();
223 
224  return status;
225 }
bool isInitialized() const
Check initialization status.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode finalizeStream(EventSelectorDataStream *) override
Finalize no longer needed stream.
EventSelectorDataStream * getStream(const std::string &) override
Retrieve stream by name.
StatusCode eraseStream(const std::string &) override
Definition of class EventSelectorDataStream.
string s
Definition: gaudirun.py:245
void ignore() const
Definition: StatusCode.h:106
StreamSpecs m_streamSpecs
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode DataStreamTool::connectStream ( EventSelectorDataStream s)
protected

Connect single stream by reference.

Definition at line 227 of file DataStreamTool.cpp.

228 {
229 
230  if ( !s ) return StatusCode::FAILURE;
231  s->addRef();
232  m_streams.push_back( s );
233  return StatusCode::SUCCESS;
234 }
T push_back(T...args)
unsigned long addRef() override
Reference Interface instance.
Definition: implements.h:44
StatusCode DataStreamTool::connectStream ( const std::string info)
protected

Connect single stream by name.

Definition at line 236 of file DataStreamTool.cpp.

237 {
238  if ( getStream( info ) ) {
239  warning() << "Input stream " << info << "already in use" << endmsg;
240  }
241  auto nam = name() + '_' + std::to_string( ++m_streamCount );
242  EventSelectorDataStream* s = nullptr;
243  StatusCode status = createStream( nam, info, s );
244  if ( status.isSuccess() ) return connectStream( s );
245  s->release();
246  return status;
247 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
T to_string(T...args)
StatusCode createStream(const std::string &, const std::string &, EventSelectorDataStream *&) override
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode connectStream(EventSelectorDataStream *)
Connect single stream by reference.
EventSelectorDataStream * getStream(const std::string &) override
Retrieve stream by name.
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:63
Definition of class EventSelectorDataStream.
size_type m_streamCount
string s
Definition: gaudirun.py:245
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
unsigned long release() override
Release Interface instance.
Definition: implements.h:46
StatusCode DataStreamTool::createSelector ( const std::string nam,
const std::string typ,
IEvtSelector *&  sel 
)
overrideprotected

Definition at line 120 of file DataStreamTool.cpp.

121 {
122  auto isvc = make_SmartIF( Service::Factory::create( typ, nam, serviceLocator() ) );
123  if ( isvc ) {
124  auto isel = isvc.as<IEvtSelector>();
125  if ( isel ) {
126  sel = isel.get();
127  sel->addRef(); // make sure that sel is not left dangling once isel and isvc go out of scope...
128  return StatusCode::SUCCESS;
129  }
130  }
131  sel = nullptr;
132  error() << "Failed to create IEvtSelector " << typ << "/" << nam << endmsg;
133  return StatusCode::FAILURE;
134 }
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: AlgTool.cpp:84
The Event Selector Interface.
Definition: IEvtSelector.h:18
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
SmartIF< IFace > make_SmartIF(IFace *iface)
Definition: SmartIF.h:143
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode DataStreamTool::createStream ( const std::string nam,
const std::string info,
EventSelectorDataStream *&  stream 
)
overrideprotected

Definition at line 170 of file DataStreamTool.cpp.

172 {
173  stream = new EventSelectorDataStream( nam, info, serviceLocator() );
174  return StatusCode::SUCCESS;
175 }
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: AlgTool.cpp:84
Definition of class EventSelectorDataStream.
virtual Streams::iterator DataStreamTool::endOfStreams ( )
inlinevirtual

Definition at line 73 of file DataStreamTool.h.

73 { return m_streams.end(); };
T end(T...args)
StatusCode DataStreamTool::eraseStream ( const std::string info)
override

Definition at line 158 of file DataStreamTool.cpp.

159 {
160 
161  auto i = getStreamIterator( info );
162  if ( i != m_streams.end() ) {
163  ( *i )->release();
164  m_streams.erase( i );
165  return StatusCode::SUCCESS;
166  }
167  return StatusCode::FAILURE;
168 }
Streams::iterator getStreamIterator(const std::string &)
T end(T...args)
T erase(T...args)
StatusCode DataStreamTool::finalize ( )
override

Definition at line 90 of file DataStreamTool.cpp.

91 {
92  clear().ignore();
94  return AlgTool::finalize();
95 }
StatusCode clear() override
StatusCode finalize() override
Definition: AlgTool.cpp:297
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
void ignore() const
Definition: StatusCode.h:106
StatusCode DataStreamTool::finalizeStream ( EventSelectorDataStream s)
override

Finalize no longer needed stream.

Definition at line 136 of file DataStreamTool.cpp.

137 {
138  if ( s ) {
139  IEvtSelector* sel = s->selector();
140  if ( sel ) {
141  SmartIF<IService> isvc( sel );
142  if ( isvc ) {
143  isvc->finalize().ignore();
144  s->finalize().ignore();
145  // Fire EndStream "Incident"
146  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndStream ) );
147  return StatusCode::SUCCESS;
148  }
149  // Failed to get service interface of sub-event selector
150  return StatusCode::FAILURE;
151  }
152  // No selector (yet) attached - no need to finalize it!
153  return StatusCode::SUCCESS;
154  }
155  return StatusCode::FAILURE;
156 }
The Event Selector Interface.
Definition: IEvtSelector.h:18
IEvtSelector * selector() const
Retrieve event selector object.
sel
Definition: IOTest.py:84
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
virtual StatusCode finalize()
Finalize stream and release resources.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:63
Base class for all Incidents (computing events).
Definition: Incident.h:17
void ignore() const
Definition: StatusCode.h:106
StatusCode DataStreamTool::getNextStream ( const EventSelectorDataStream *&  esds,
size_type &  dsid 
)
override

Definition at line 255 of file DataStreamTool.cpp.

256 {
257 
258  EventSelectorDataStream* nextStream = getStream( dsid );
259  if ( !nextStream ) return StatusCode::FAILURE; //<-end of streams reached
260 
261  esds = nextStream;
262  ++m_streamID;
263 
264  return StatusCode::SUCCESS;
265 }
EventSelectorDataStream * getStream(const std::string &) override
Retrieve stream by name.
size_type m_streamID
Definition of class EventSelectorDataStream.
StatusCode DataStreamTool::getPreviousStream ( const EventSelectorDataStream *&  esds,
size_type &  dsid 
)
override

Definition at line 267 of file DataStreamTool.cpp.

268 {
269 
270  EventSelectorDataStream* previousStream = getStream( dsid );
271  if ( !previousStream ) return StatusCode::FAILURE; //<-begin of streams reached
272 
273  esds = previousStream;
274  --m_streamID;
275 
276  return StatusCode::SUCCESS;
277 }
EventSelectorDataStream * getStream(const std::string &) override
Retrieve stream by name.
size_type m_streamID
Definition of class EventSelectorDataStream.
EventSelectorDataStream * DataStreamTool::getStream ( const std::string info)
override

Retrieve stream by name.

Definition at line 177 of file DataStreamTool.cpp.

178 {
179  auto i = getStreamIterator( info );
180  return i != m_streams.end() ? *i : nullptr;
181 }
Streams::iterator getStreamIterator(const std::string &)
T end(T...args)
EventSelectorDataStream * DataStreamTool::getStream ( size_type  pos)
override

Definition at line 189 of file DataStreamTool.cpp.

190 {
191  // pos has to point inside the vector
192  return ( ( pos >= 0 ) && ( (size_t)pos < m_streams.size() ) ) ? m_streams[pos] : nullptr;
193 }
T size(T...args)
DataStreamTool::Streams::iterator DataStreamTool::getStreamIterator ( const std::string info)
protected

Definition at line 183 of file DataStreamTool.cpp.

184 {
186  [&]( const EventSelectorDataStream* i ) { return i->definition() == info; } );
187 }
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
T end(T...args)
const std::string & definition() const
Retrieve definition string.
T find_if(T...args)
T begin(T...args)
Definition of class EventSelectorDataStream.
virtual Streams& DataStreamTool::getStreams ( )
inlinevirtual

Definition at line 69 of file DataStreamTool.h.

69 { return m_streams; };
StatusCode DataStreamTool::initialize ( )
override

Definition at line 31 of file DataStreamTool.cpp.

32 {
33 
35  if ( !status.isSuccess() ) {
36  fatal() << "Error. Cannot initialize base class." << endmsg;
37  return status;
38  }
39 
40  // Get the references to the services that are needed by the ApplicationMgr itself
41  m_incidentSvc = serviceLocator()->service( "IncidentSvc" );
42  if ( !m_incidentSvc ) {
43  fatal() << "Error retrieving IncidentSvc." << endmsg;
44  return StatusCode::FAILURE;
45  }
46 
47  return StatusCode::SUCCESS;
48 }
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: AlgTool.cpp:84
StatusCode initialize() override
Definition: AlgTool.cpp:227
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode DataStreamTool::initializeStream ( EventSelectorDataStream s)
override

Initialize newly opened stream.

Definition at line 97 of file DataStreamTool.cpp.

98 {
99  IEvtSelector* sel = nullptr;
100  StatusCode status = s->initialize();
101  if ( status.isSuccess() ) {
102  status = createSelector( s->name(), s->selectorType(), sel );
103  if ( status.isSuccess() ) {
104  SmartIF<IProperty> prop( sel ); // Att: IProperty, IService used to point to EventSelector
105  SmartIF<IService> isvc( sel );
106  s->setSelector( sel );
107  sel->release(); // No need for this interface anymore, it is passed to the stream
108  if ( prop && isvc ) {
109  for ( const auto& i : s->properties() ) prop->setProperty( i ).ignore();
110  prop->setProperty( Gaudi::Property<int>( "OutputLevel", msgLevel() ) ).ignore();
111  // FIXME: (MCl) Why do we have to initialize the selector here?
112  return isvc->sysInitialize();
113  }
114  }
115  }
116  return StatusCode::FAILURE;
117 }
const std::string & name() const
Retrieve stream name.
Implementation of property with value of concrete type.
Definition: Property.h:314
The Event Selector Interface.
Definition: IEvtSelector.h:18
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
sel
Definition: IOTest.py:84
virtual StatusCode initialize()
Parse input criteria.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode createSelector(const std::string &, const std::string &, IEvtSelector *&) override
virtual unsigned long release()=0
Release Interface instance.
const std::string & selectorType() const
Retrieve event selector type.
const Properties & properties()
Access properties.
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
virtual void setSelector(IEvtSelector *pSelector)
Attach event selector object.
EventSelectorDataStream * DataStreamTool::lastStream ( )
override

Definition at line 195 of file DataStreamTool.cpp.

195 { return m_streams.back(); }
T back(T...args)
DataStreamTool& DataStreamTool::operator= ( const DataStreamTool )
privatedelete

Fake assignment operator (never implemented).

size_type DataStreamTool::size ( )
inlineoverride

Definition at line 65 of file DataStreamTool.h.

65 { return m_streams.size(); };
T size(T...args)

Member Data Documentation

SmartIF<IIncidentSvc> DataStreamTool::m_incidentSvc = nullptr
protected

Reference to the incident service.

Definition at line 94 of file DataStreamTool.h.

size_type DataStreamTool::m_streamCount = 0
protected

Definition at line 87 of file DataStreamTool.h.

size_type DataStreamTool::m_streamID = 0
protected

Definition at line 85 of file DataStreamTool.h.

Streams DataStreamTool::m_streams
protected

Definition at line 89 of file DataStreamTool.h.

StreamSpecs DataStreamTool::m_streamSpecs
protected

Definition at line 91 of file DataStreamTool.h.


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