All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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
< StringProperty
Properties
 
- Public Types inherited from extends1< AlgTool, IDataStreamTool >
typedef extends1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1
< IDataStreamTool
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 AlgTool
typedef
Gaudi::PluginService::Factory
< IAlgTool *, const
std::string &, const
std::string &, const
IInterface * > 
Factory
 
- Public Types inherited from implements3< IAlgTool, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IAlgTool, 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< IAlgTool, IProperty, IStateful >
typedef mpl::fold< typename
IAlgTool::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 Types inherited from extend_interfaces1< IDataStreamTool >
typedef
IDataStreamTool::iid::iids::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IDataStreamTool
typedef std::vector< std::string > StreamSpecs
 
typedef long size_type
 

Public Member Functions

 DataStreamTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor. More...
 
virtual ~DataStreamTool ()
 Destructor. More...
 
virtual StatusCode initialize ()
 Initialization (from CONFIGURED to INITIALIZED). More...
 
virtual StatusCode addStream (const std::string &)
 
virtual StatusCode addStreams (const StreamSpecs &)
 
virtual StatusCode eraseStream (const std::string &)
 
virtual StatusCode finalize ()
 Finalize (from INITIALIZED to CONFIGURED). More...
 
virtual StatusCode initializeStream (EventSelectorDataStream *)
 Initialize newly opened stream. More...
 
virtual StatusCode finalizeStream (EventSelectorDataStream *)
 Finalize no longer needed stream. More...
 
virtual StatusCode getNextStream (const EventSelectorDataStream *&, size_type &)
 
virtual StatusCode getPreviousStream (const EventSelectorDataStream *&, size_type &)
 
virtual StreamsgetStreams ()
 
virtual EventSelectorDataStreamlastStream ()
 
virtual Streams::iterator beginOfStreams ()
 
virtual Streams::iterator endOfStreams ()
 
virtual EventSelectorDataStreamgetStream (const std::string &)
 Retrieve stream by name. More...
 
virtual EventSelectorDataStreamgetStream (size_type)
 
virtual size_type size ()
 
virtual StatusCode clear ()
 
- Public Member Functions inherited from extends1< AlgTool, IDataStreamTool >
 extends1 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments. More...
 
 extends1 (A1 a1, A2 a2)
 Templated constructor with 2 arguments. More...
 
 extends1 (A1 a1)
 Templated constructor with 1 argument. More...
 
 extends1 ()
 Default constructor. More...
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface. More...
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual ~extends1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from AlgTool
virtual const std::string & name () const
 Retrieve full identifying name of the concrete tool object. More...
 
virtual const std::string & type () const
 Retrieve type (concrete class) of the sub-algtool. More...
 
virtual const IInterfaceparent () const
 Retrieve parent of the sub-algtool. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode sysInitialize ()
 Initialize AlgTool. More...
 
virtual StatusCode sysStart ()
 Start AlgTool. More...
 
virtual StatusCode sysStop ()
 Stop AlgTool. More...
 
virtual StatusCode sysFinalize ()
 Finalize AlgTool. More...
 
virtual StatusCode sysReinitialize ()
 Initialize AlgTool. More...
 
virtual StatusCode sysRestart ()
 Start AlgTool. More...
 
virtual StatusCode setProperty (const Property &p)
 Default implementations for IProperty interface. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector
< Property * > & 
getProperties () const
 Get list of properties. More...
 
PropertyMgrgetPropertyMgr ()
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 AlgTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Constructor. More...
 
ISvcLocatorserviceLocator () const
 Retrieve pointer to service locator. More...
 
ISvcLocatorsvcLoc () const
 shortcut for the method service locator More...
 
IMessageSvcmsgSvc () const
 Retrieve pointer to message 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...
 
void declInterface (const InterfaceID &, void *)
 declare interface 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...
 
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...
 
- Public Member Functions inherited from extend_interfaces3< IAlgTool, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IAlgTool
 DeclareInterfaceID (IAlgTool, 3, 0)
 InterfaceID. More...
 
virtual ~IAlgTool ()
 Virtual destructor. More...
 
virtual unsigned long refCount () const =0
 Current number of reference counts. 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 unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface 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 ()
 
- Public Member Functions inherited from extend_interfaces1< IDataStreamTool >
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IDataStreamTool
 DeclareInterfaceID (IDataStreamTool, 2, 0)
 InterfaceID. More...
 

Protected Member Functions

virtual StatusCode createSelector (const std::string &, const std::string &, IEvtSelector *&)
 
virtual StatusCode createStream (const std::string &, const std::string &, EventSelectorDataStream *&)
 
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
int outputLevel () const
 get tool's output level More...
 
IntegerPropertyoutputLevelProperty ()
 Accessor for the Message level property. More...
 
void initOutputLevel (Property &prop)
 callback for output level property More...
 
virtual ~AlgTool ()
 

Protected Attributes

size_type m_streamID
 
size_type m_streamCount
 
Streams m_streams
 
StreamSpecs m_streamSpecs
 
SmartIF< IIncidentSvcm_incidentSvc
 Reference to the incident service. More...
 

Private Member Functions

 DataStreamTool (const DataStreamTool &)
 Fake copy constructor (never implemented). More...
 
DataStreamTooloperator= (const DataStreamTool &)
 Fake assignment operator (never implemented). 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

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

Definition at line 29 of file DataStreamTool.h.

Member Typedef Documentation

Definition at line 33 of file DataStreamTool.h.

Definition at line 32 of file DataStreamTool.h.

Constructor & Destructor Documentation

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

Standard constructor.

Definition at line 31 of file DataStreamTool.cpp.

34  : base_class ( type, name , parent )
35 {
36  //declareInterface<IDataStreamTool>(this);
37 
38  m_incidentSvc = 0;
39  m_streamCount = 0;
40  m_streamID = 0;
41 
42 }
virtual const std::string & type() const
Retrieve type (concrete class) of the sub-algtool.
Definition: AlgTool.cpp:58
extends1 base_class
Typedef to this class.
Definition: extends.h:12
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
size_type m_streamID
size_type m_streamCount
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
DataStreamTool::~DataStreamTool ( )
virtual

Destructor.

Definition at line 46 of file DataStreamTool.cpp.

46  {
47 }
DataStreamTool::DataStreamTool ( const DataStreamTool )
private

Fake copy constructor (never implemented).

Member Function Documentation

StatusCode DataStreamTool::addStream ( const std::string &  input)
virtual

Implements IDataStreamTool.

Definition at line 71 of file DataStreamTool.cpp.

71  {
72 
73  if ( NULL != getStream(input) ) {
74  MsgStream log(msgSvc(), name());
75  log << MSG::WARNING << "Input stream " << input << "already in use" << endmsg;
76  }
77 
78  m_streamSpecs.push_back(input);
79 
80  std::ostringstream strname;
81  strname << name() << '_' << ++m_streamCount;
82 
84 
85  StatusCode status = createStream(strname.str(), input , s );
86 
87  if( status.isSuccess() && 0 != s ) {
88  s->addRef();
89  m_streams.push_back(s);
90  status = StatusCode::SUCCESS;
91  }
92  else {
93  MsgStream log(msgSvc(), name());
94  if (s) {
95  s->release();
96  log << MSG::ERROR << "Error connecting/creating Stream: " << s << endmsg;
97  }
98  log << MSG::ERROR << "Error connecting/creating Stream: " << input << endmsg;
99  status = StatusCode::FAILURE;
100  }
101 
102  return status;
103 
104 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual StatusCode createStream(const std::string &, const std::string &, EventSelectorDataStream *&)
virtual EventSelectorDataStream * getStream(const std::string &)
Retrieve stream by name.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual unsigned long release()=0
Release Interface instance.
Definition of class EventSelectorDataStream.
size_type m_streamCount
string s
Definition: gaudirun.py:210
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
StreamSpecs m_streamSpecs
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode DataStreamTool::addStreams ( const StreamSpecs inputs)
virtual

Implements IDataStreamTool.

Definition at line 106 of file DataStreamTool.cpp.

106  {
107 
109 
110  for ( StreamSpecs::const_iterator itr = inputs.begin(); itr != inputs.end() && status.isSuccess(); ++itr ) {
111 
112  status = addStream(*itr);
113 
114  }
115 
116  return status;
117 
118 }
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 StatusCode addStream(const std::string &)
virtual Streams::iterator DataStreamTool::beginOfStreams ( )
inlinevirtual

Definition at line 66 of file DataStreamTool.h.

66 {return m_streams.begin(); };
StatusCode DataStreamTool::clear ( )
virtual

Implements IDataStreamTool.

Definition at line 244 of file DataStreamTool.cpp.

245 {
246 
247  StatusCode iret, status = StatusCode::SUCCESS;
248  iret.ignore();
249 
250  MsgStream log(msgSvc(), name());
251 
252  // disconnect the streams
253  for ( StreamSpecs::const_iterator il = m_streamSpecs.begin(); il != m_streamSpecs.end(); il++ ) {
255  if ( NULL != s ) {
256  if ( s->isInitialized() ) {
257  iret = finalizeStream(s);
258  if ( !iret.isSuccess() ) {
259  log << MSG::ERROR << "Error finalizing Stream" << *il << endmsg;
260  status = iret;
261  }
262  }
263  iret = eraseStream( *il );
264  if ( !iret.isSuccess() ) {
265  log << MSG::ERROR << "Error diconnecting Stream" << *il << endmsg;
266  status = iret;
267  }
268  }
269  }
270 
271  m_streamSpecs.clear();
272 
273  return status;
274 }
bool isInitialized() const
Check initialization status.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual EventSelectorDataStream * getStream(const std::string &)
Retrieve stream by name.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
virtual StatusCode eraseStream(const std::string &)
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Definition of class EventSelectorDataStream.
string s
Definition: gaudirun.py:210
virtual StatusCode finalizeStream(EventSelectorDataStream *)
Finalize no longer needed stream.
void ignore() const
Definition: StatusCode.h:94
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
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 277 of file DataStreamTool.cpp.

278 {
279 
280  if ( 0 != s ) {
281  s->addRef();
282  m_streams.push_back(s);
283  return StatusCode::SUCCESS;
284  }
285 
286  return StatusCode::FAILURE;
287 
288 }
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
StatusCode DataStreamTool::connectStream ( const std::string &  info)
protected

Connect single stream by name.

Definition at line 290 of file DataStreamTool.cpp.

291 {
292 
293  if ( NULL != getStream(info) ) {
294  MsgStream log(msgSvc(), name());
295  log << MSG::WARNING << "Input stream " << info << "already in use" << endmsg;
296  }
297  std::ostringstream nam;
298  nam << name() << '_' << ++m_streamCount;
300  StatusCode status = createStream(nam.str(), info, s);
301  if ( status.isSuccess() ) {
302  return connectStream(s);
303  }
304  s->release();
305  return status;
306 
307 
308 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual StatusCode createStream(const std::string &, const std::string &, EventSelectorDataStream *&)
virtual EventSelectorDataStream * getStream(const std::string &)
Retrieve stream by name.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode connectStream(EventSelectorDataStream *)
Connect single stream by reference.
virtual unsigned long release()=0
Release Interface instance.
Definition of class EventSelectorDataStream.
size_type m_streamCount
string s
Definition: gaudirun.py:210
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode DataStreamTool::createSelector ( const std::string &  nam,
const std::string &  typ,
IEvtSelector *&  sel 
)
protectedvirtual

Implements IDataStreamTool.

Definition at line 153 of file DataStreamTool.cpp.

153  {
154  IService* isvc = Service::Factory::create(typ, nam, serviceLocator());
155  if ( isvc ) {
156  StatusCode status = isvc->queryInterface(IEvtSelector::interfaceID(), (void**)&sel);
157  if ( status.isSuccess() ) {
158  return status;
159  }
160  sel = 0;
161  isvc->release();
162  }
163  MsgStream log(msgSvc(), name());
164  log << MSG::ERROR << "Failed to create IEvtSelector " << typ << "/" << nam << endmsg;
165  return StatusCode::FAILURE;
166 }
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
ISvcLocator * serviceLocator() const
Retrieve pointer to service locator.
Definition: AlgTool.cpp:72
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
General service interface definition.
Definition: IService.h:19
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual unsigned long release()=0
Release Interface instance.
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:171
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)=0
Set the void** to the pointer to the requested interface of the instance.
StatusCode DataStreamTool::createStream ( const std::string &  nam,
const std::string &  info,
EventSelectorDataStream *&  stream 
)
protectedvirtual

Implements IDataStreamTool.

Definition at line 204 of file DataStreamTool.cpp.

205  {
206  stream = new EventSelectorDataStream(nam, info, serviceLocator());
207 
208  return StatusCode::SUCCESS;
209 }
ISvcLocator * serviceLocator() const
Retrieve pointer to service locator.
Definition: AlgTool.cpp:72
Definition of class EventSelectorDataStream.
virtual Streams::iterator DataStreamTool::endOfStreams ( )
inlinevirtual

Definition at line 68 of file DataStreamTool.h.

68 {return m_streams.end(); };
StatusCode DataStreamTool::eraseStream ( const std::string &  info)
virtual

Implements IDataStreamTool.

Definition at line 191 of file DataStreamTool.cpp.

191  {
192 
193  Streams::iterator i = getStreamIterator(info);
194 
195  if ( m_streams.end() != i ) {
196  (*i)->release();
197  m_streams.erase(i);
198  return StatusCode::SUCCESS;
199  }
200 
201  return StatusCode::FAILURE;
202 }
Streams::iterator getStreamIterator(const std::string &)
list i
Definition: ana.py:128
StatusCode DataStreamTool::finalize ( )
virtual

Finalize (from INITIALIZED to CONFIGURED).

Reimplemented from AlgTool.

Definition at line 120 of file DataStreamTool.cpp.

120  {
121  clear().ignore();
122  m_incidentSvc = 0; // release
123 
124  return AlgTool::finalize();
125 }
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: AlgTool.cpp:434
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
void ignore() const
Definition: StatusCode.h:94
virtual StatusCode clear()
StatusCode DataStreamTool::finalizeStream ( EventSelectorDataStream s)
virtual

Finalize no longer needed stream.

Implements IDataStreamTool.

Definition at line 169 of file DataStreamTool.cpp.

169  {
170  if ( s ) {
171  IEvtSelector* sel = const_cast<IEvtSelector*>(s->selector());
172  if ( sel ) {
173  SmartIF<IService> isvc(sel);
174  if ( isvc.isValid() ) {
175  isvc->finalize().ignore();
176  s->finalize().ignore();
177  // Fire EndStream "Incident"
179  return StatusCode::SUCCESS;
180  }
181  // Failed to get service interface of sub-event selector
182  return StatusCode::FAILURE;
183  }
184  // No selector (yet) attached - no need to finalize it!
185  return StatusCode::SUCCESS;
186  }
187  return StatusCode::FAILURE;
188 }
The Event Selector Interface.
Definition: IEvtSelector.h:19
IEvtSelector * selector() const
Retrieve event selector object.
virtual StatusCode finalize()
Finalize stream and release resources.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Base class for all Incidents (computing events).
Definition: Incident.h:16
void ignore() const
Definition: StatusCode.h:94
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
const std::string EndStream
Processing of the stream has finished.
Definition: Incident.h:64
StatusCode DataStreamTool::getNextStream ( const EventSelectorDataStream *&  esds,
size_type dsid 
)
virtual

Implements IDataStreamTool.

Definition at line 317 of file DataStreamTool.cpp.

318 {
319 
320  EventSelectorDataStream * nextStream = getStream(dsid);
321  if ( NULL == nextStream ) return StatusCode::FAILURE; //<-end of streams reached
322 
323  esds = nextStream;
324  ++m_streamID;
325 
326  return StatusCode::SUCCESS;
327 
328 }
virtual EventSelectorDataStream * getStream(const std::string &)
Retrieve stream by name.
size_type m_streamID
Definition of class EventSelectorDataStream.
StatusCode DataStreamTool::getPreviousStream ( const EventSelectorDataStream *&  esds,
size_type dsid 
)
virtual

Implements IDataStreamTool.

Definition at line 330 of file DataStreamTool.cpp.

331 {
332 
333  EventSelectorDataStream * previousStream = getStream(dsid);
334  if ( NULL == previousStream ) return StatusCode::FAILURE; //<-begin of streams reached
335 
336  esds = previousStream;
337  --m_streamID;
338 
339  return StatusCode::SUCCESS;
340 
341 }
virtual EventSelectorDataStream * getStream(const std::string &)
Retrieve stream by name.
size_type m_streamID
Definition of class EventSelectorDataStream.
EventSelectorDataStream * DataStreamTool::getStream ( const std::string &  info)
virtual

Retrieve stream by name.

Implements IDataStreamTool.

Definition at line 212 of file DataStreamTool.cpp.

212  {
213  Streams::iterator i = getStreamIterator(info);
214  if ( m_streams.end() == i ) return NULL;
215  return *i;
216 }
Streams::iterator getStreamIterator(const std::string &)
list i
Definition: ana.py:128
EventSelectorDataStream * DataStreamTool::getStream ( size_type  pos)
virtual

Implements IDataStreamTool.

Definition at line 227 of file DataStreamTool.cpp.

227  {
228  if ( (pos >= 0) && ((size_t)pos < m_streams.size()) ) // pos has to point inside the vector
229  return m_streams[pos];
230  else
231  return 0;
232 }
DataStreamTool::Streams::iterator DataStreamTool::getStreamIterator ( const std::string &  info)
protected

Definition at line 218 of file DataStreamTool.cpp.

218  {
219  for ( Streams::iterator i = m_streams.begin(); i != m_streams.end(); i++ ) {
220  if ( (*i)->definition() == info ) {
221  return i;
222  }
223  }
224  return m_streams.end();
225 }
list i
Definition: ana.py:128
virtual Streams& DataStreamTool::getStreams ( )
inlinevirtual

Definition at line 62 of file DataStreamTool.h.

62 { return m_streams; };
StatusCode DataStreamTool::initialize ( )
virtual

Initialization (from CONFIGURED to INITIALIZED).

Reimplemented from AlgTool.

Definition at line 50 of file DataStreamTool.cpp.

50  {
51 
53 
55  if( !status.isSuccess() ) {
56  logger << MSG::FATAL << "Error. Cannot initialize base class." << endmsg;
57  return status;
58  }
59 
60  // Get the references to the services that are needed by the ApplicationMgr itself
61  m_incidentSvc = serviceLocator()->service("IncidentSvc");
62  if( !m_incidentSvc.isValid() ) {
63  logger << MSG::FATAL << "Error retrieving IncidentSvc." << endmsg;
64  return StatusCode::FAILURE;
65  }
66 
67  return StatusCode::SUCCESS;
68 
69 }
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
ISvcLocator * serviceLocator() const
Retrieve pointer to service locator.
Definition: AlgTool.cpp:72
GAUDIPS_API Logger & logger()
Return the current logger instance.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:82
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: AlgTool.cpp:307
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode DataStreamTool::initializeStream ( EventSelectorDataStream s)
virtual

Initialize newly opened stream.

Implements IDataStreamTool.

Definition at line 127 of file DataStreamTool.cpp.

127  {
128  IEvtSelector* sel = 0;
129  StatusCode status = s->initialize();
130  if ( status.isSuccess() ) {
131  status = createSelector(s->name(), s->selectorType(), sel);
132  if ( status.isSuccess() ) {
133  SmartIF<IProperty> prop(sel); //Att: IProperty, IService used to point to EventSelector
134  SmartIF<IService> isvc(sel);
135  s->setSelector(sel);
136  sel->release(); // No need of this interface anymore, it is passed to the stream
137  if ( prop.isValid( ) && isvc.isValid( ) ) {
138  const Properties& p = s->properties();
139  for(Properties::const_iterator i=p.begin(); i!=p.end(); i++) {
140  prop->setProperty((*i)).ignore();
141  }
142  int output_level = this->outputLevel();
143  prop->setProperty(IntegerProperty("OutputLevel",output_level)).ignore();
144  // FIXME: (MCl) Why do we have to initialize the selector here?
145  return isvc->sysInitialize();
146  }
147  }
148  }
149  return StatusCode::FAILURE;
150 }
const std::string & name() const
Retrieve stream name.
The Event Selector Interface.
Definition: IEvtSelector.h:19
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
std::vector< StringProperty > Properties
virtual StatusCode createSelector(const std::string &, const std::string &, IEvtSelector *&)
virtual StatusCode initialize()
Parse input criteria.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
SimpleProperty< int > IntegerProperty
Definition: Property.h:733
virtual unsigned long release()=0
Release Interface instance.
const std::string & selectorType() const
Retrieve event selector type.
int outputLevel() const
get tool's output level
Definition: AlgTool.h:305
const Properties & properties()
Access properties.
list i
Definition: ana.py:128
virtual void setSelector(IEvtSelector *pSelector)
Attach event selector object.
EventSelectorDataStream * DataStreamTool::lastStream ( )
virtual

Implements IDataStreamTool.

Definition at line 234 of file DataStreamTool.cpp.

235 {
236  if (m_streams.size() > 1 )
237  return *(--m_streams.end());
238  else return *m_streams.begin();
239 
240 }
DataStreamTool& DataStreamTool::operator= ( const DataStreamTool )
private

Fake assignment operator (never implemented).

virtual size_type DataStreamTool::size ( )
inlinevirtual

Implements IDataStreamTool.

Definition at line 75 of file DataStreamTool.h.

75 { return m_streams.size(); };

Member Data Documentation

SmartIF<IIncidentSvc> DataStreamTool::m_incidentSvc
protected

Reference to the incident service.

Definition at line 101 of file DataStreamTool.h.

size_type DataStreamTool::m_streamCount
protected

Definition at line 94 of file DataStreamTool.h.

size_type DataStreamTool::m_streamID
protected

Definition at line 92 of file DataStreamTool.h.

Streams DataStreamTool::m_streams
protected

Definition at line 96 of file DataStreamTool.h.

StreamSpecs DataStreamTool::m_streamSpecs
protected

Definition at line 98 of file DataStreamTool.h.


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