|
Gaudi Framework, version v22r2 |
| Home | Generated: Tue May 10 2011 |
#include <GaudiKernel/DataStreamTool.h>


Definition at line 29 of file DataStreamTool.h.
Definition at line 33 of file DataStreamTool.h.
Definition at line 32 of file DataStreamTool.h.
| 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); m_incidentSvc = 0; m_streamCount = 0; m_streamID = 0; }
| DataStreamTool::~DataStreamTool | ( | ) | [virtual] |
| DataStreamTool::DataStreamTool | ( | const DataStreamTool & | ) | [private] |
Fake copy constructor (never implemented).
| StatusCode DataStreamTool::addStream | ( | const std::string & | input ) | [virtual] |
Implements IDataStreamTool.
Definition at line 76 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 111 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.
| StatusCode DataStreamTool::clear | ( | void | ) | [virtual] |
Implements IDataStreamTool.
Definition at line 248 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 281 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 294 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 158 of file DataStreamTool.cpp.
{
MsgStream log(msgSvc(), name());
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();
}
return StatusCode::FAILURE;
}
| StatusCode DataStreamTool::createStream | ( | const std::string & | nam, |
| const std::string & | info, | ||
| EventSelectorDataStream *& | stream | ||
| ) | [protected, virtual] |
Implements IDataStreamTool.
Definition at line 208 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.
| StatusCode DataStreamTool::eraseStream | ( | const std::string & | info ) | [virtual] |
Implements IDataStreamTool.
Definition at line 195 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 | ( | void | ) | [virtual] |
Reimplemented from AlgTool.
Definition at line 125 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 173 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 321 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 334 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 | ( | size_type | pos ) | [virtual] |
Implements IDataStreamTool.
Definition at line 231 of file DataStreamTool.cpp.
| EventSelectorDataStream * DataStreamTool::getStream | ( | const std::string & | info ) | [virtual] |
Retrieve stream by name.
Implements IDataStreamTool.
Definition at line 216 of file DataStreamTool.cpp.
{
Streams::iterator i = getStreamIterator(info);
if ( m_streams.end() == i ) return NULL;
return *i;
}
| DataStreamTool::Streams::iterator DataStreamTool::getStreamIterator | ( | const std::string & | info ) | [protected] |
Definition at line 222 of file DataStreamTool.cpp.
| 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 55 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 132 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 238 of file DataStreamTool.cpp.
| DataStreamTool& DataStreamTool::operator= | ( | const DataStreamTool & | ) | [private] |
Fake assignment operator (never implemented).
| virtual size_type DataStreamTool::size | ( | void | ) | [inline, virtual] |
Implements IDataStreamTool.
Definition at line 75 of file DataStreamTool.h.
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.