Gaudi Framework, version v24r2

Home   Generated: Wed Dec 4 2013
 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:
Inheritance graph
[legend]
Collaboration diagram for DataStreamTool:
Collaboration graph
[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 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::stringStreamSpecs
 
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 StreamsgetStreams ()
 
virtual EventSelectorDataStreamlastStream ()
 
virtual Streams::iterator beginOfStreams ()
 
virtual Streams::iterator endOfStreams ()
 
virtual EventSelectorDataStreamgetStream (const std::string &)
 Retrieve stream by name.
 
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.
 
 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::stringgetInterfaceNames () const
 Implementation of IInterface::getInterfaceNames.
 
virtual ~extends1 ()
 Virtual destructor.
 
- Public Member Functions inherited from AlgTool
virtual const std::stringname () const
 Retrieve full identifying name of the concrete tool object.
 
virtual const std::stringtype () const
 Retrieve type (concrete class) of the sub-algtool.
 
virtual const IInterfaceparent () 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 PropertygetProperty (const std::string &name) const
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 
virtual const std::vector
< Property * > & 
getProperties () const
 
PropertyMgrgetPropertyMgr ()
 
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.
 
ISvcLocatorserviceLocator () const
 Retrieve pointer to service locator.
 
ISvcLocatorsvcLoc () const
 shortcut for the method service locator
 
IMessageSvcmsgSvc () const
 Retrieve pointer to message service.
 
IToolSvctoolSvc () 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< 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")
 
void declInterface (const InterfaceID &, void *)
 declare interface
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties.
 
IAuditorSvcauditorSvc () const
 Access the auditor service.
 
IMonitorSvcmonitorSvc () 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::stringtype () const =0
 The type of an AlgTool, meaning the concrete AlgTool class.
 
virtual const IInterfaceparent () 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::stringname () 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< IIncidentSvcm_incidentSvc
 Reference to the incident service.
 
bool m_reconfigure
 

Private Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 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

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 36 of file DataStreamTool.cpp.

: base_class ( type, name , parent )
{
//declareInterface<IDataStreamTool>(this);
}
DataStreamTool::~DataStreamTool ( )
virtual

Destructor.

Definition at line 51 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 76 of file DataStreamTool.cpp.

{
if ( NULL != getStream(input) ) {
log << MSG::WARNING << "Input stream " << input << "already in use" << endmsg;
}
strname << name() << '_' << ++m_streamCount;
StatusCode status = createStream(strname.str(), input , s );
if( status.isSuccess() && 0 != s ) {
s->addRef();
}
else {
if (s) {
s->release();
log << MSG::ERROR << "Error connecting/creating Stream: " << s << endmsg;
}
log << MSG::ERROR << "Error connecting/creating Stream: " << input << endmsg;
}
return status;
}
StatusCode DataStreamTool::addStreams ( const StreamSpecs inputs)
virtual

Implements IDataStreamTool.

Definition at line 111 of file DataStreamTool.cpp.

{
for ( StreamSpecs::const_iterator itr = inputs.begin(); itr != inputs.end() && status.isSuccess(); ++itr ) {
status = addStream(*itr);
}
return status;
}
virtual Streams::iterator DataStreamTool::beginOfStreams ( )
inlinevirtual

Definition at line 66 of file DataStreamTool.h.

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

Implements IDataStreamTool.

Definition at line 249 of file DataStreamTool.cpp.

{
iret.ignore();
// disconnect the streams
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;
}
}
}
return status;
}
StatusCode DataStreamTool::connectStream ( EventSelectorDataStream s)
protected

Connect single stream by reference.

Definition at line 282 of file DataStreamTool.cpp.

{
if ( 0 != s ) {
s->addRef();
}
}
StatusCode DataStreamTool::connectStream ( const std::string info)
protected

Connect single stream by name.

Definition at line 295 of file DataStreamTool.cpp.

{
if ( NULL != getStream(info) ) {
log << MSG::WARNING << "Input stream " << info << "already in use" << endmsg;
}
nam << name() << '_' << ++m_streamCount;
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 
)
protectedvirtual

Implements IDataStreamTool.

Definition at line 158 of file DataStreamTool.cpp.

{
IService* isvc = ROOT::Reflex::PluginService::Create<IService*>(typ, nam, serviceLocator());
if ( isvc ) {
StatusCode status = isvc->queryInterface(IEvtSelector::interfaceID(), (void**)&sel);
if ( status.isSuccess() ) {
return status;
}
sel = 0;
isvc->release();
}
log << MSG::ERROR << "Failed to create IEvtSelector " << typ << "/" << nam << endmsg;
}
StatusCode DataStreamTool::createStream ( const std::string nam,
const std::string info,
EventSelectorDataStream *&  stream 
)
protectedvirtual

Implements IDataStreamTool.

Definition at line 209 of file DataStreamTool.cpp.

{
stream = new EventSelectorDataStream(nam, info, serviceLocator());
}
virtual Streams::iterator DataStreamTool::endOfStreams ( )
inlinevirtual

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 196 of file DataStreamTool.cpp.

{
if ( m_streams.end() != i ) {
(*i)->release();
}
}
StatusCode DataStreamTool::finalize ( )
virtual

Reimplemented from AlgTool.

Definition at line 125 of file DataStreamTool.cpp.

{
m_incidentSvc = 0; // release
}
StatusCode DataStreamTool::finalizeStream ( EventSelectorDataStream s)
virtual

Finalize no longer needed stream.

Implements IDataStreamTool.

Definition at line 174 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"
}
// Failed to get service interface of sub-event selector
}
// No selector (yet) attached - no need to finalize it!
}
}
StatusCode DataStreamTool::getNextStream ( const EventSelectorDataStream *&  esds,
size_type dsid 
)
virtual

Implements IDataStreamTool.

Definition at line 322 of file DataStreamTool.cpp.

{
EventSelectorDataStream * nextStream = getStream(dsid);
if ( NULL == nextStream ) return StatusCode::FAILURE; //<-end of streams reached
esds = nextStream;
}
StatusCode DataStreamTool::getPreviousStream ( const EventSelectorDataStream *&  esds,
size_type dsid 
)
virtual

Implements IDataStreamTool.

Definition at line 335 of file DataStreamTool.cpp.

{
EventSelectorDataStream * previousStream = getStream(dsid);
if ( NULL == previousStream ) return StatusCode::FAILURE; //<-begin of streams reached
esds = previousStream;
}
EventSelectorDataStream * DataStreamTool::getStream ( const std::string info)
virtual

Retrieve stream by name.

Implements IDataStreamTool.

Definition at line 217 of file DataStreamTool.cpp.

{
if ( m_streams.end() == i ) return NULL;
return *i;
}
EventSelectorDataStream * DataStreamTool::getStream ( size_type  pos)
virtual

Implements IDataStreamTool.

Definition at line 232 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 223 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 ( )
inlinevirtual

Definition at line 62 of file DataStreamTool.h.

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

Reimplemented from AlgTool.

Definition at line 55 of file DataStreamTool.cpp.

{
MsgStream logger(msgSvc(), name());
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");
logger << MSG::FATAL << "Error retrieving IncidentSvc." << endmsg;
}
}
StatusCode DataStreamTool::initializeStream ( EventSelectorDataStream s)
virtual

Initialize newly opened stream.

Implements IDataStreamTool.

Definition at line 132 of file DataStreamTool.cpp.

{
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();
}
}
}
}
EventSelectorDataStream * DataStreamTool::lastStream ( )
virtual

Implements IDataStreamTool.

Definition at line 239 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 ( )
inlinevirtual

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:

Generated at Wed Dec 4 2013 14:33:15 for Gaudi Framework, version v24r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004