| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
DataStreamTool Class Reference

`#include <GaudiKernel/DataStreamTool.h>`

Inheritance diagram for DataStreamTool:
[legend]
Collaboration diagram for DataStreamTool:
[legend]

## 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.
typedef extend_interfaces1 < IDataStreamTool > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.
Public Types inherited from AlgTool
typedef Gaudi::PluginService::Factory3 < 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.
typedef extend_interfaces3 < IAlgTool, IProperty, IStateful > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.
Public Types inherited from extend_interfaces3< I1, I2, I3 >
typedef mpl::fold< typename I1::iid::iids::type, typename mpl::fold< typename I2::iid::iids::type, typename I3::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.
Public Types inherited from extend_interfaces1< IDataStreamTool >
typedef IDataStreamTool::iid::iids::type | ext_iids
| MPL set of interfaces extended by this one.
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.
virtual | ~DataStreamTool ()
| Destructor.
virtual StatusCode | initialize ()
virtual StatusCode | addStream (const std::string &)
virtual StatusCode | addStreams (const StreamSpecs &)
virtual StatusCode | eraseStream (const std::string &)
virtual StatusCode | finalize ()
virtual StatusCode | initializeStream (EventSelectorDataStream *)
| Initialize newly opened stream.
virtual StatusCode | finalizeStream (EventSelectorDataStream *)
| Finalize no longer needed stream.
virtual StatusCode | getNextStream (const EventSelectorDataStream *&, size_type &)
virtual StatusCode | getPreviousStream (const EventSelectorDataStream *&, size_type &)
virtual Streams & | getStreams ()
virtual EventSelectorDataStream * | lastStream ()
virtual Streams::iterator | beginOfStreams ()
virtual Streams::iterator | endOfStreams ()
virtual EventSelectorDataStream * | getStream (const std::string &)
| Retrieve stream by name.
virtual EventSelectorDataStream * | getStream (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.
| extends1 (A1 a1, A2 a2)
| Templated constructor with 2 arguments.
| extends1 (A1 a1)
| Templated constructor with 1 argument.
| extends1 ()
| Default constructor.
virtual void * | i_cast (const InterfaceID &tid) const
| Implementation of IInterface::i_cast.
virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp)
| Implementation of IInterface::queryInterface.
virtual std::vector< std::string > | getInterfaceNames () const
| Implementation of IInterface::getInterfaceNames.
virtual | ~extends1 ()
| Virtual destructor.
Public Member Functions inherited from AlgTool
virtual const std::string & | name () const
| Retrieve full identifying name of the concrete tool object.
virtual const std::string & | type () const
| Retrieve type (concrete class) of the sub-algtool.
virtual const IInterface * | parent () const
| Retrieve parent of the sub-algtool.
virtual StatusCode | configure ()
virtual StatusCode | start ()
virtual StatusCode | stop ()
virtual StatusCode | terminate ()
virtual StatusCode | reinitialize ()
virtual StatusCode | restart ()
virtual Gaudi::StateMachine::State | FSMState () const
virtual Gaudi::StateMachine::State | targetFSMState () const
virtual StatusCode | sysInitialize ()
| Initialize AlgTool.
virtual StatusCode | sysStart ()
| Start AlgTool.
virtual StatusCode | sysStop ()
| Stop AlgTool.
virtual StatusCode | sysFinalize ()
| Finalize AlgTool.
virtual StatusCode | sysReinitialize ()
| Initialize AlgTool.
virtual StatusCode | sysRestart ()
| Start AlgTool.
virtual StatusCode | setProperty (const Property &p)
| Default implementations for IProperty interface.
virtual StatusCode | setProperty (const std::string &s)
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
virtual StatusCode | getProperty (Property *p) const
virtual const Property & | getProperty (const std::string &name) const
virtual StatusCode | getProperty (const std::string &n, std::string &v) const
virtual const std::vector < Property * > & | getProperties () const
PropertyMgr * | getPropertyMgr ()
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
| AlgTool (const std::string &type, const std::string &name, const IInterface *parent)
| Standard Constructor.
ISvcLocator * | serviceLocator () const
| Retrieve pointer to service locator.
ISvcLocator * | svcLoc () const
| shortcut for the method service locator
IMessageSvc * | msgSvc () const
| Retrieve pointer to message service.
IToolSvc * | toolSvc () const
| The standard ToolSvc service, Return a pointer to the service if present.
StatusCode | setProperties ()
| Method for setting declared properties to the values specified in the jobOptions via the job option service.
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.
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.
SmartIF< IService > | service (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")
void | declInterface (const InterfaceID &, void *)
| declare interface
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties.
IAuditorSvc * | auditorSvc () const
| Access the auditor service.
IMonitorSvc * | monitorSvc () const
| Access the monitor service.
template<class T >
void | declareInfo (const std::string &name, const T &var, const std::string &desc) const
| Declare monitoring information.
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)
Public Member Functions inherited from extend_interfaces1< IDataStreamTool >
virtual | ~extend_interfaces1 ()
| Virtual destructor.
Public Member Functions inherited from IDataStreamTool
| DeclareInterfaceID (IDataStreamTool, 2, 0)
| InterfaceID.
Public Member Functions inherited from IAlgTool
| DeclareInterfaceID (IAlgTool, 3, 0)
| InterfaceID.
virtual | ~IAlgTool ()
| Virtual destructor.
virtual const std::string & | type () const =0
| The type of an AlgTool, meaning the concrete AlgTool class.
virtual const IInterface * | parent () const =0
| The parent of the concrete AlgTool.
virtual StatusCode | configure ()=0
| Configuration (from OFFLINE to CONFIGURED).
virtual StatusCode | start ()=0
| Start (from INITIALIZED to RUNNING).
virtual StatusCode | stop ()=0
| Stop (from RUNNING to INITIALIZED).
virtual StatusCode | terminate ()=0
| Initialization (from CONFIGURED to OFFLINE).
virtual StatusCode | reinitialize ()=0
| Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
virtual StatusCode | restart ()=0
| Initialization (from RUNNING to RUNNING, via INITIALIZED).
virtual Gaudi::StateMachine::State | FSMState () const =0
| Get the current state.
virtual StatusCode | sysInitialize ()=0
| Initialization of the Tool.
virtual StatusCode | sysStart ()=0
| Initialization of the Tool.
virtual StatusCode | sysStop ()=0
| Initialization of the Tool.
virtual StatusCode | sysFinalize ()=0
| Finalization of the Tool.
virtual StatusCode | sysReinitialize ()=0
| Initialization of the Tool.
virtual StatusCode | sysRestart ()=0
| Initialization of the Tool.
virtual unsigned long | refCount () const =0
| Current number of reference counts.
Public Member Functions inherited from INamedInterface
| DeclareInterfaceID (INamedInterface, 1, 0)
| InterfaceID.
virtual const std::string & | name () const =0
| Retrieve the name of the instance.
virtual | ~INamedInterface ()
| Virtual destructor (always needed for abstract classes).
Public Member Functions inherited from IInterface
virtual unsigned long | addRef ()=0
| Increment the reference count of Interface instance.
virtual unsigned long | release ()=0
| Release Interface instance.
virtual | ~IInterface ()
| Virtual destructor.

## 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.
StatusCode | connectStream (const std::string &)
| Connect single stream by name.
Streams::iterator | getStreamIterator (const std::string &)

## Protected Attributes
size_type | m_streamID
size_type | m_streamCount
Streams | m_streams
StreamSpecs | m_streamSpecs
SmartIF< IIncidentSvc > | m_incidentSvc
| Reference to the incident service.
bool | m_reconfigure

## Private Member Functions
| DataStreamTool (const DataStreamTool &)
| Fake copy constructor (never implemented).
DataStreamTool & | operator= (const DataStreamTool &)
| Fake assignment operator (never implemented).

## Additional Inherited Members
Static Public Member Functions inherited from IInterface
static const InterfaceID & | interfaceID ()
| Return an instance of InterfaceID identifying the interface.

## Detailed Description

Author
  Andres Felipe Osorio Oliveros
  Marco Clemencic

Date
  2006-09-21

Definition at line 29 of file DataStreamTool.h.

## Member Typedef Documentation

typedef std::vector<StringProperty> DataStreamTool::Properties

Definition at line 33 of file DataStreamTool.h.

typedef std::vector<EventSelectorDataStream*> DataStreamTool::Streams

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.

: base_class ( type, name , parent )
{
//declareInterface<IDataStreamTool>(this);
m_incidentSvc = 0;
m_streamCount = 0;
m_streamID = 0;
}

DataStreamTool::~DataStreamTool | ( |  | ) |
| virtual

Destructor.

Definition at line 46 of file DataStreamTool.cpp.

{
}

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.

{
if ( NULL != getStream(input) ) {
MsgStream log(msgSvc(), name());
log << MSG::WARNING << "Input stream " << input << "already in use" << endmsg;
}
m_streamSpecs.push_back(input);
std::ostringstream strname;
strname << name() << '_' << ++m_streamCount;
EventSelectorDataStream* s = 0;
StatusCode status = createStream(strname.str(), input , s );
if( status.isSuccess() && 0 != s ) {
s->addRef();
m_streams.push_back(s);
status = StatusCode::SUCCESS;
}
else {
MsgStream log(msgSvc(), name());
if (s) {
s->release();
log << MSG::ERROR << "Error connecting/creating Stream: " << s << endmsg;
}
log << MSG::ERROR << "Error connecting/creating Stream: " << input << endmsg;
status = StatusCode::FAILURE;
}
return status;
}

StatusCode DataStreamTool::addStreams | ( | const StreamSpecs & | inputs | ) |
| virtual

Implements IDataStreamTool.

Definition at line 106 of file DataStreamTool.cpp.

{
StatusCode status = StatusCode::SUCCESS;
for ( StreamSpecs::const_iterator itr = inputs.begin(); itr != inputs.end() && status.isSuccess(); ++itr ) {
status = addStream(*itr);
}
return status;
}

virtual Streams::iterator DataStreamTool::beginOfStreams | ( |  | ) |
| inline virtual

Definition at line 66 of file DataStreamTool.h.

{return m_streams.begin(); };

StatusCode DataStreamTool::clear | ( |  | ) |
| virtual

Implements IDataStreamTool.

Definition at line 244 of file DataStreamTool.cpp.

{
StatusCode iret, status = StatusCode::SUCCESS;
iret.ignore();
MsgStream log(msgSvc(), name());
// disconnect the streams
for ( StreamSpecs::const_iterator il = m_streamSpecs.begin(); il != m_streamSpecs.end(); il++ ) {
EventSelectorDataStream* s = getStream(*il);
if ( NULL != s ) {
if ( s->isInitialized() ) {
iret = finalizeStream(s);
if ( !iret.isSuccess() ) {
log << MSG::ERROR << "Error finalizing Stream" << *il << endmsg;
status = iret;
}
}
iret = eraseStream( *il );
if ( !iret.isSuccess() ) {
log << MSG::ERROR << "Error diconnecting Stream" << *il << endmsg;
status = iret;
}
}
}
m_streamSpecs.clear();
return status;
}

StatusCode DataStreamTool::connectStream | ( | EventSelectorDataStream * | s | ) |
| protected

Connect single stream by reference.

Definition at line 277 of file DataStreamTool.cpp.

{
if ( 0 != s ) {
s->addRef();
m_streams.push_back(s);
return StatusCode::SUCCESS;
}
return StatusCode::FAILURE;
}

StatusCode DataStreamTool::connectStream | ( | const std::string & | info | ) |
| protected

Connect single stream by name.

Definition at line 290 of file DataStreamTool.cpp.

{
if ( NULL != getStream(info) ) {
MsgStream log(msgSvc(), name());
log << MSG::WARNING << "Input stream " << info << "already in use" << endmsg;
}
std::ostringstream nam;
nam << name() << '_' << ++m_streamCount;
EventSelectorDataStream* s = 0;
StatusCode status = createStream(nam.str(), info, s);
if ( status.isSuccess() ) {
return connectStream(s);
}
s->release();
return status;
}

StatusCode DataStreamTool::createSelector | ( | const std::string & | nam,
|  | const std::string & | typ,
|  | IEvtSelector *& | sel
| ) |  |
| protected virtual

Implements IDataStreamTool.

Definition at line 153 of file DataStreamTool.cpp.

{
IService* isvc = Service::Factory::create(typ, nam, serviceLocator());
if ( isvc ) {
StatusCode status = isvc->queryInterface(IEvtSelector::interfaceID(), (void**)&sel);
if ( status.isSuccess() ) {
return status;
}
sel = 0;
isvc->release();
}
MsgStream log(msgSvc(), name());
log << MSG::ERROR << "Failed to create IEvtSelector " << typ << "/" << nam << endmsg;
return StatusCode::FAILURE;
}

StatusCode DataStreamTool::createStream | ( | const std::string & | nam,
|  | const std::string & | info,
|  | EventSelectorDataStream *& | stream
| ) |  |
| protected virtual

Implements IDataStreamTool.

Definition at line 204 of file DataStreamTool.cpp.

{
stream = new EventSelectorDataStream(nam, info, serviceLocator());
return StatusCode::SUCCESS;
}

virtual Streams::iterator DataStreamTool::endOfStreams | ( |  | ) |
| inline virtual

Definition at line 68 of file DataStreamTool.h.

{return m_streams.end(); };

StatusCode DataStreamTool::eraseStream | ( | const std::string & | info | ) |
| virtual

Implements IDataStreamTool.

Definition at line 191 of file DataStreamTool.cpp.

{
Streams::iterator i = getStreamIterator(info);
if ( m_streams.end() != i ) {
(*i)->release();
m_streams.erase(i);
return StatusCode::SUCCESS;
}
return StatusCode::FAILURE;
}

StatusCode DataStreamTool::finalize | ( |  | ) |
| virtual

Reimplemented from AlgTool.

Definition at line 120 of file DataStreamTool.cpp.

{
clear().ignore();
m_incidentSvc = 0; // release
return AlgTool::finalize();
}

StatusCode DataStreamTool::finalizeStream | ( | EventSelectorDataStream * | s | ) |
| virtual

Finalize no longer needed stream.

Implements IDataStreamTool.

Definition at line 169 of file DataStreamTool.cpp.

{
if ( s ) {
IEvtSelector* sel = const_cast<IEvtSelector*>(s->selector());
if ( sel ) {
SmartIF<IService> isvc(sel);
if ( isvc.isValid() ) {
isvc->finalize().ignore();
s->finalize().ignore();
// Fire EndStream "Incident"
m_incidentSvc->fireIncident(Incident(name(),IncidentType::EndStream));
return StatusCode::SUCCESS;
}
// Failed to get service interface of sub-event selector
return StatusCode::FAILURE;
}
// No selector (yet) attached - no need to finalize it!
return StatusCode::SUCCESS;
}
return StatusCode::FAILURE;
}

StatusCode DataStreamTool::getNextStream | ( | const EventSelectorDataStream *& | esds,
|  | size_type & | dsid
| ) |  |
| virtual

Implements IDataStreamTool.

Definition at line 317 of file DataStreamTool.cpp.

{
EventSelectorDataStream * nextStream = getStream(dsid);
if ( NULL == nextStream ) return StatusCode::FAILURE; //<-end of streams reached
esds = nextStream;
++m_streamID;
return StatusCode::SUCCESS;
}

StatusCode DataStreamTool::getPreviousStream | ( | const EventSelectorDataStream *& | esds,
|  | size_type & | dsid
| ) |  |
| virtual

Implements IDataStreamTool.

Definition at line 330 of file DataStreamTool.cpp.

{
EventSelectorDataStream * previousStream = getStream(dsid);
if ( NULL == previousStream ) return StatusCode::FAILURE; //<-begin of streams reached
esds = previousStream;
--m_streamID;
return StatusCode::SUCCESS;
}

EventSelectorDataStream * DataStreamTool::getStream | ( | const std::string & | info | ) |
| virtual

Retrieve stream by name.

Implements IDataStreamTool.

Definition at line 212 of file DataStreamTool.cpp.

{
Streams::iterator i = getStreamIterator(info);
if ( m_streams.end() == i ) return NULL;
return *i;
}

EventSelectorDataStream * DataStreamTool::getStream | ( | size_type | pos | ) |
| virtual

Implements IDataStreamTool.

Definition at line 227 of file DataStreamTool.cpp.

{
if ( (pos >= 0) && ((size_t)pos < m_streams.size()) ) // pos has to point inside the vector
return m_streams[pos];
else
return 0;
}

DataStreamTool::Streams::iterator DataStreamTool::getStreamIterator | ( | const std::string & | info | ) |
| protected

Definition at line 218 of file DataStreamTool.cpp.

{
for ( Streams::iterator i = m_streams.begin(); i != m_streams.end(); i++ ) {
if ( (*i)->definition() == info ) {
return i;
}
}
return m_streams.end();
}

virtual Streams& DataStreamTool::getStreams | ( |  | ) |
| inline virtual

Definition at line 62 of file DataStreamTool.h.

{ return m_streams; };

StatusCode DataStreamTool::initialize | ( |  | ) |
| virtual

Reimplemented from AlgTool.

Definition at line 50 of file DataStreamTool.cpp.

{
MsgStream logger(msgSvc(), name());
StatusCode status = AlgTool::initialize();
if( !status.isSuccess() ) {
logger << MSG::FATAL << "Error. Cannot initialize base class." << endmsg;
return status;
}
// Get the references to the services that are needed by the ApplicationMgr itself
m_incidentSvc = serviceLocator()->service("IncidentSvc");
if( !m_incidentSvc.isValid() ) {
logger << MSG::FATAL << "Error retrieving IncidentSvc." << endmsg;
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}

StatusCode DataStreamTool::initializeStream | ( | EventSelectorDataStream * | s | ) |
| virtual

Initialize newly opened stream.

Implements IDataStreamTool.

Definition at line 127 of file DataStreamTool.cpp.

{
IEvtSelector* sel = 0;
StatusCode status = s->initialize();
if ( status.isSuccess() ) {
status = createSelector(s->name(), s->selectorType(), sel);
if ( status.isSuccess() ) {
SmartIF<IProperty> prop(sel); //Att: IProperty, IService used to point to EventSelector
SmartIF<IService> isvc(sel);
s->setSelector(sel);
sel->release(); // No need of this interface anymore, it is passed to the stream
if ( prop.isValid( ) && isvc.isValid( ) ) {
const Properties& p = s->properties();
for(Properties::const_iterator i=p.begin(); i!=p.end(); i++) {
prop->setProperty((*i)).ignore();
}
int output_level = this->outputLevel();
prop->setProperty(IntegerProperty("OutputLevel",output_level)).ignore();
// FIXME: (MCl) Why do we have to initialize the selector here?
return isvc->sysInitialize();
}
}
}
return StatusCode::FAILURE;
}

EventSelectorDataStream * DataStreamTool::lastStream | ( |  | ) |
| virtual

Implements IDataStreamTool.

Definition at line 234 of file DataStreamTool.cpp.

{
if (m_streams.size() > 1 )
return *(--m_streams.end());
else return *m_streams.begin();
}

DataStreamTool& DataStreamTool::operator= | ( | const DataStreamTool & |  | ) |
| private

Fake assignment operator (never implemented).

virtual size_type DataStreamTool::size | ( |  | ) |
| inline virtual

Implements IDataStreamTool.

Definition at line 75 of file DataStreamTool.h.

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

bool DataStreamTool::m_reconfigure
| protected

Definition at line 103 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:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiKernel/GaudiKernel/DataStreamTool.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiKernel/src/Lib/DataStreamTool.cpp