Gaudi Framework, version v21r8

Home   Generated: 17 Mar 2010

OutputStream Class Reference

A small to stream Data I/O. More...

#include <OutputStream.h>

Inheritance diagram for OutputStream:

Inheritance graph
[legend]
Collaboration diagram for OutputStream:

Collaboration graph
[legend]

List of all members.

Public Types

typedef std::vector
< DataStoreItem * > 
Items
typedef std::vector< std::stringItemNames

Public Member Functions

 OutputStream (const std::string &name, ISvcLocator *pSvcLocator)
 Standard algorithm Constructor.
virtual ~OutputStream ()
 Standard Destructor.
virtual StatusCode initialize ()
 Initialize OutputStream.
virtual StatusCode finalize ()
 Terminate OutputStream.
virtual StatusCode execute ()
 Working entry point.
virtual StatusCode connectConversionSvc ()
virtual bool collect (IRegistry *dir, int level)
 Store agent's classback.
virtual StatusCode collectObjects ()
 Collect all objects to be written tio the output stream.
void clearItems (Items &itms)
 Clear item list.
void addItem (Items &itms, const std::string &descriptor)
 Add item to output stramer list.
void clearSelection ()
 Clear list of selected objects.
IDataSelectorselectedObjects ()
 Return the list of selected objects.

Protected Member Functions

StatusCode decodeAcceptAlgs ()
 Decode list of Algorithms that this stream accepts.
void acceptAlgsHandler (Property &theProp)
 Handler for AcceptAlgs Property.
StatusCode decodeRequireAlgs ()
 Decode list of Algorithms that this stream requires.
void requireAlgsHandler (Property &theProp)
 Handler for RequireAlgs Property.
StatusCode decodeVetoAlgs ()
 Decode list of Algorithms that this stream is vetoed by.
void vetoAlgsHandler (Property &theProp)
 Handler for VetoAlgs Property.
StatusCode decodeAlgorithms (StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs)
 Decode specified list of Algorithms.
bool isEventAccepted () const
 Test whether this event should be output.
DataStoreItemfindItem (const std::string &path)
 Find single item identified by its path (exact match).
virtual StatusCode writeObjects ()
 Select the different objects and write them to file.

Protected Attributes

SmartIF< IIncidentSvcm_incidentSvc
 Reference to the indicent service.
bool m_doPreLoad
 Flag indicating wether data pre-loading should be performed.
bool m_doPreLoadOpt
 Flag indicating whether optional items should be preloaded.
bool m_verifyItems
 Flag to indicate that item consistency should be checked.
std::string m_storeName
 Name of the service managing the data store.
std::string m_persName
 Name of the persistency service capable to write data from the store.
std::string m_output
 Name of the output file specification.
std::string m_outputName
 Name of the output file.
std::string m_outputType
 Output type: NEW(NEW,CREATE,WRITE,RECREATE), UPDATE).
OutputStreamAgentm_agent
 Keep reference of agent.
SmartIF< IDataProviderSvcm_pDataProvider
 Keep reference to the data provider service.
SmartIF< IDataManagerSvcm_pDataManager
 Keep reference to the data manager service.
SmartIF< IConversionSvcm_pConversionSvc
 Keep reference to the data conversion service.
DataStoreItemm_currentItem
 Keep track of the current item.
ItemNames m_itemNames
 Vector of item names.
Items m_itemList
 Vector of items to be saved to this stream.
ItemNames m_optItemNames
 Vector of item names.
Items m_optItemList
 Vector of optional items to be saved to this stream.
IDataSelector m_objects
 Collection of objects beeing selected.
int m_events
 Number of events written to this output stream.
StringArrayProperty m_acceptNames
 Vector of names of Algorithms that this stream accepts.
StringArrayProperty m_requireNames
 Vector of names of Algorithms that this stream requires.
StringArrayProperty m_vetoNames
 Vector of names of Algorithms that this stream is vetoed by.
std::vector< Algorithm * > * m_acceptAlgs
 Vector of Algorithms that this stream accepts.
std::vector< Algorithm * > * m_requireAlgs
 Vector of Algorithms that this stream requires.
std::vector< Algorithm * > * m_vetoAlgs
 Vector of Algorithms that this stream is vetoed by.
bool m_fireIncidents
 should I fire incidents for writing opening/closing etc?

Friends

class AlgFactory< OutputStream >
class Factory< OutputStream, IAlgorithm *(std::string, ISvcLocator *)>


Detailed Description

A small to stream Data I/O.

Author: M.Frank author R. Lambert Version: 1.0

Definition at line 32 of file OutputStream.h.


Member Typedef Documentation

Definition at line 37 of file OutputStream.h.

Definition at line 38 of file OutputStream.h.


Constructor & Destructor Documentation

OutputStream::OutputStream ( const std::string name,
ISvcLocator pSvcLocator 
)

Standard algorithm Constructor.

in the baseclass, always fire the incidents by default in e.g. RecordStream this will be set to false, and configurable

in the baseclass, always fire the incidents by default in RecordStream this will be set to false, and configurable

Definition at line 29 of file OutputStream.cpp.

00030  : Algorithm(name, pSvcLocator)
00031 {
00032   m_doPreLoad      = true;
00033   m_doPreLoadOpt   = false;
00034   m_verifyItems    = true;
00035   m_output         = "";
00036   m_outputName     = "";
00037   m_outputType     = "UPDATE";
00038   m_storeName      = "EventDataSvc";
00039   m_persName       = "EventPersistencySvc";
00040   m_agent          = new OutputStreamAgent(this);
00041   m_acceptAlgs     = new std::vector<Algorithm*>();
00042   m_requireAlgs    = new std::vector<Algorithm*>();
00043   m_vetoAlgs       = new std::vector<Algorithm*>();
00046   m_fireIncidents  = true;
00047   declareProperty("ItemList",         m_itemNames);
00048   declareProperty("OptItemList",      m_optItemNames);
00049   declareProperty("Preload",          m_doPreLoad);
00050   declareProperty("PreloadOptItems",  m_doPreLoadOpt);
00051   declareProperty("Output",           m_output);
00052   declareProperty("OutputFile",       m_outputName);
00053   declareProperty("EvtDataSvc",       m_storeName);
00054   declareProperty("EvtConversionSvc", m_persName);
00055   declareProperty("AcceptAlgs",       m_acceptNames);
00056   declareProperty("RequireAlgs",      m_requireNames);
00057   declareProperty("VetoAlgs",         m_vetoNames);
00058   declareProperty("VerifyItems",      m_verifyItems);
00061 
00062   // Associate action handlers with the AcceptAlgs, RequireAlgs & VetoAlgs properties
00063   m_acceptNames.declareUpdateHandler ( &OutputStream::acceptAlgsHandler , this );
00064   m_requireNames.declareUpdateHandler( &OutputStream::requireAlgsHandler, this );
00065   m_vetoNames.declareUpdateHandler   ( &OutputStream::vetoAlgsHandler   , this );
00066 }

OutputStream::~OutputStream (  )  [virtual]

Standard Destructor.

Definition at line 69 of file OutputStream.cpp.

00069                               {
00070   delete m_agent;
00071   delete m_acceptAlgs;
00072   delete m_requireAlgs;
00073   delete m_vetoAlgs;
00074 }


Member Function Documentation

StatusCode OutputStream::decodeAcceptAlgs (  )  [protected]

Decode list of Algorithms that this stream accepts.

Definition at line 430 of file OutputStream.cpp.

00430                                            {
00431   return decodeAlgorithms( m_acceptNames, m_acceptAlgs );
00432 }

void OutputStream::acceptAlgsHandler ( Property theProp  )  [protected]

Handler for AcceptAlgs Property.

Definition at line 434 of file OutputStream.cpp.

00434                                                                {
00435   StatusCode sc = decodeAlgorithms( m_acceptNames, m_acceptAlgs );
00436   if (sc.isFailure()) {
00437     throw GaudiException("Failure in OutputStream::decodeAlgorithms",
00438                          "OutputStream::acceptAlgsHandler",sc);
00439   }
00440 }

StatusCode OutputStream::decodeRequireAlgs (  )  [protected]

Decode list of Algorithms that this stream requires.

Definition at line 442 of file OutputStream.cpp.

00442                                              {
00443   return decodeAlgorithms( m_requireNames, m_requireAlgs );
00444 }

void OutputStream::requireAlgsHandler ( Property theProp  )  [protected]

Handler for RequireAlgs Property.

Definition at line 446 of file OutputStream.cpp.

00446                                                                 {
00447   StatusCode sc = decodeAlgorithms( m_requireNames, m_requireAlgs );
00448   if (sc.isFailure()) {
00449     throw GaudiException("Failure in OutputStream::decodeAlgorithms",
00450                          "OutputStream::requireAlgsHandler",sc);
00451   }
00452 }

StatusCode OutputStream::decodeVetoAlgs (  )  [protected]

Decode list of Algorithms that this stream is vetoed by.

Definition at line 454 of file OutputStream.cpp.

00454                                           {
00455   return decodeAlgorithms( m_vetoNames, m_vetoAlgs );
00456 }

void OutputStream::vetoAlgsHandler ( Property theProp  )  [protected]

Handler for VetoAlgs Property.

Definition at line 458 of file OutputStream.cpp.

00458                                                              {
00459   StatusCode sc = decodeAlgorithms( m_vetoNames, m_vetoAlgs );
00460   if (sc.isFailure()) {
00461     throw GaudiException("Failure in OutputStream::decodeAlgorithms",
00462                          "OutputStream::vetoAlgsHandler",sc);
00463   }
00464 }

StatusCode OutputStream::decodeAlgorithms ( StringArrayProperty theNames,
std::vector< Algorithm * > *  theAlgs 
) [protected]

Decode specified list of Algorithms.

Definition at line 466 of file OutputStream.cpp.

00468 {
00469   // Reset the list of Algorithms
00470   theAlgs->clear( );
00471 
00472   MsgStream log( msgSvc( ), name( ) );
00473 
00474   StatusCode result = StatusCode::FAILURE;
00475 
00476   SmartIF<IAlgManager> theAlgMgr(serviceLocator());
00477   if ( theAlgMgr.isValid() ) {
00478     // Build the list of Algorithms from the names list
00479     const std::vector<std::string> nameList = theNames.value( );
00480     std::vector<std::string>::const_iterator it;
00481     std::vector<std::string>::const_iterator itend = nameList.end( );
00482     for (it = nameList.begin(); it != itend; ++it) {
00483       // Check whether the supplied name corresponds to an existing
00484       // Algorithm object.
00485       const std::string &theName = (*it);
00486       SmartIF<IAlgorithm> &theIAlg = theAlgMgr->algorithm(theName);
00487       Algorithm*  theAlgorithm;
00488       if ( theIAlg.isValid() ) {
00489         result = StatusCode::SUCCESS;
00490         try{
00491           theAlgorithm = dynamic_cast<Algorithm*>(theIAlg.get());
00492         } catch(...){
00493           result = StatusCode::FAILURE;
00494         }
00495       }
00496       if ( result.isSuccess( ) ) {
00497         // Check that the specified algorithm doesn't already exist in the list
00498         std::vector<Algorithm*>::iterator ita;
00499         std::vector<Algorithm*>::iterator itaend = theAlgs->end( );
00500         for (ita = theAlgs->begin(); ita != itaend; ++ita) {
00501           Algorithm* existAlgorithm = (*ita);
00502           if ( theAlgorithm == existAlgorithm ) {
00503             result = StatusCode::FAILURE;
00504             break;
00505           }
00506         }
00507         if ( result.isSuccess( ) ) {
00508           theAlgorithm->addRef();
00509           theAlgs->push_back( theAlgorithm );
00510         }
00511       }
00512       else {
00513         log << MSG::INFO << theName << " doesn't exist - ignored" << endmsg;
00514       }
00515     }
00516     result = StatusCode::SUCCESS;
00517   }
00518   else {
00519     log << MSG::FATAL << "Can't locate ApplicationMgr!!!" << endmsg;
00520   }
00521   return result;
00522 }

bool OutputStream::isEventAccepted (  )  const [protected]

Test whether this event should be output.

Definition at line 524 of file OutputStream.cpp.

00524                                            {
00525   typedef std::vector<Algorithm*>::iterator AlgIter;
00526   bool result = true;
00527 
00528   // Loop over all Algorithms in the accept list to see
00529   // whether any have been executed and have their filter
00530   // passed flag set. Any match causes the event to be
00531   // provisionally accepted.
00532   if ( ! m_acceptAlgs->empty() ) {
00533     result = false;
00534     for(AlgIter i=m_acceptAlgs->begin(),end=m_acceptAlgs->end(); i != end; ++i) {
00535       if ( (*i)->isExecuted() && (*i)->filterPassed() ) {
00536         result = true;
00537         break;
00538       }
00539     }
00540   }
00541 
00542   // Loop over all Algorithms in the required list to see
00543   // whether all have been executed and have their filter
00544   // passed flag set. Any mismatch causes the event to be
00545   // rejected.
00546   if ( result && ! m_requireAlgs->empty() ) {
00547     for(AlgIter i=m_requireAlgs->begin(),end=m_requireAlgs->end(); i != end; ++i) {
00548       if ( !(*i)->isExecuted() || !(*i)->filterPassed() ) {
00549         result = false;
00550         break;
00551       }
00552     }
00553   }
00554 
00555   // Loop over all Algorithms in the veto list to see
00556   // whether any have been executed and have their filter
00557   // passed flag set. Any match causes the event to be
00558   // rejected.
00559   if ( result && ! m_vetoAlgs->empty() ) {
00560     for(AlgIter i=m_vetoAlgs->begin(),end=m_vetoAlgs->end(); i != end; ++i) {
00561       if ( (*i)->isExecuted() && (*i)->filterPassed() ) {
00562         result = false;
00563         break;
00564       }
00565     }
00566   }
00567   return result;
00568 }

DataStoreItem * OutputStream::findItem ( const std::string path  )  [protected]

Find single item identified by its path (exact match).

Definition at line 303 of file OutputStream.cpp.

00303                                              {
00304   for(Items::const_iterator i=m_itemList.begin(); i != m_itemList.end(); ++i)  {
00305     if ( (*i)->path() == path )  return (*i);
00306   }
00307   for(Items::const_iterator j=m_optItemList.begin(); j != m_optItemList.end(); ++j)  {
00308     if ( (*j)->path() == path )  return (*j);
00309   }
00310   return 0;
00311 }

StatusCode OutputStream::writeObjects (  )  [protected, virtual]

Select the different objects and write them to file.

Reimplemented in SequentialOutputStream, and TagCollectionStream.

Definition at line 192 of file OutputStream.cpp.

00192                                        {
00193   // Connect the output file to the service
00194   StatusCode status = collectObjects();
00195   if ( status.isSuccess() )   {
00196     IDataSelector*  sel = selectedObjects();
00197     if ( sel->begin() != sel->end() )  {
00198       status = m_pConversionSvc->connectOutput(m_outputName, m_outputType);
00199       if ( status.isSuccess() )   {
00200         // Now pass the collection to the persistency service
00201         IDataSelector::iterator j;
00202         IOpaqueAddress* pAddress = 0;
00203         for ( j = sel->begin(); j != sel->end(); j++ )    {
00204           StatusCode iret = m_pConversionSvc->createRep( *j, pAddress );
00205           if ( !iret.isSuccess() )      {
00206             status = iret;
00207             continue;
00208           }
00209           IRegistry* pReg = (*j)->registry();
00210           pReg->setAddress(pAddress);
00211         }
00212         for ( j = sel->begin(); j != sel->end(); j++ )    {
00213           IRegistry* pReg = (*j)->registry();
00214           StatusCode iret = m_pConversionSvc->fillRepRefs( pReg->address(), *j );
00215           if ( !iret.isSuccess() )      {
00216             status = iret;
00217           }
00218         }
00219               // Commit the data if there was no error; otherwise possibly discard
00220         if ( status.isSuccess() )  {
00221           status = m_pConversionSvc->commitOutput(m_outputName, true);
00222         }
00223         else   {
00224           m_pConversionSvc->commitOutput(m_outputName, false);
00225         }
00226       }
00227     }
00228   }
00229   return status;
00230 }

StatusCode OutputStream::initialize (  )  [virtual]

Initialize OutputStream.

Reimplemented from Algorithm.

Reimplemented in TagCollectionStream.

Definition at line 77 of file OutputStream.cpp.

00077                                     {
00078   MsgStream log(msgSvc(), name());
00079 
00080   // Reset the number of events written
00081   m_events = 0;
00082   // Get access to the DataManagerSvc
00083   m_pDataManager = serviceLocator()->service(m_storeName);
00084   if( !m_pDataManager.isValid() )   {
00085     log << MSG::FATAL << "Unable to locate IDataManagerSvc interface" << endmsg;
00086     return StatusCode::FAILURE;
00087   }
00088   // Get access to the IncidentService
00089   m_incidentSvc = serviceLocator()->service("IncidentSvc");
00090   if( !m_incidentSvc.isValid() )  {
00091     log << MSG::WARNING << "Error retrieving IncidentSvc." << endmsg;
00092     return StatusCode::FAILURE;
00093   }
00094   // Get access to the assigned data service
00095   m_pDataProvider = serviceLocator()->service(m_storeName);
00096   if( !m_pDataProvider.isValid() )   {
00097     log << MSG::FATAL << "Unable to locate IDataProviderSvc interface of " << m_storeName << endmsg;
00098     return StatusCode::FAILURE;
00099   }
00100   if ( !(m_itemNames.empty() && m_optItemNames.empty()) )  {
00101     StatusCode status = connectConversionSvc();
00102     if( !status.isSuccess() )   {
00103       log << MSG::FATAL << "Unable to connect to conversion service." << endmsg;
00104       if(m_outputName!="" && m_fireIncidents) m_incidentSvc->fireIncident(Incident(m_outputName,
00105                                            IncidentType::FailOutputFile));
00106       return status;
00107     }
00108   }
00109 
00110   // Clear the list with optional items
00111   clearItems(m_optItemList);
00112   // Clear the item list
00113   clearItems(m_itemList);
00114 
00115   ItemNames::iterator i;
00116   // Take the new item list from the properties.
00117   for(i = m_itemNames.begin(); i != m_itemNames.end(); i++)   {
00118     addItem( m_itemList, *i );
00119   }
00120 
00121   // Take the new item list from the properties.
00122   for(i = m_optItemNames.begin(); i != m_optItemNames.end(); i++)   {
00123     addItem( m_optItemList, *i );
00124   }
00125 
00126   // Take the item list to the data service preload list.
00127   if ( m_doPreLoad )    {
00128     for(Items::iterator j = m_itemList.begin(); j != m_itemList.end(); j++)   {
00129       m_pDataProvider->addPreLoadItem( *(*j) ).ignore();
00130     }
00131     // Not working: bad reference counting! pdataSvc->release();
00132   }
00133 
00134   if ( m_doPreLoadOpt )    {
00135     for(Items::iterator j=m_optItemList.begin(); j!=m_optItemList.end(); j++) {
00136       m_pDataProvider->addPreLoadItem( *(*j) );
00137     }
00138   }
00139   log << MSG::INFO << "Data source: " << m_storeName  << " output: " << m_output << endmsg;
00140 
00141   // Decode the accept, required and veto Algorithms. The logic is the following:
00142   //  a. The event is accepted if all lists are empty.
00143   //  b. The event is provisionally accepted if any Algorithm in the accept list
00144   //     has been executed and has indicated that its filter is passed. This
00145   //     provisional acceptance can be overridden by the other lists.
00146   //  c. The event is rejected unless all Algorithms in the required list have
00147   //     been executed and have indicated that their filter passed.
00148   //  d. The event is rejected if any Algorithm in the veto list has been
00149   //     executed and has indicated that its filter has passed.
00150   decodeAcceptAlgs ().ignore();
00151   decodeRequireAlgs().ignore();
00152   decodeVetoAlgs   ().ignore();
00153   return StatusCode::SUCCESS;
00154 }

StatusCode OutputStream::finalize ( void   )  [virtual]

Terminate OutputStream.

Reimplemented from Algorithm.

Reimplemented in RecordStream, RunRecordStream, and TagCollectionStream.

Definition at line 157 of file OutputStream.cpp.

00157                                   {
00158   MsgStream log(msgSvc(), name());
00159   log << MSG::INFO << "Events output: " << m_events << endmsg;
00160   if(m_fireIncidents) m_incidentSvc->fireIncident(Incident(m_outputName,
00161                                        IncidentType::EndOutputFile));
00162   m_incidentSvc.reset();
00163   m_pDataProvider.reset();
00164   m_pDataManager.reset();
00165   m_pConversionSvc.reset();
00166   clearItems(m_optItemList);
00167   clearItems(m_itemList);
00168   return StatusCode::SUCCESS;
00169 }

StatusCode OutputStream::execute (  )  [virtual]

Working entry point.

Reimplemented in RecordStream, RunRecordStream, and SequentialOutputStream.

Definition at line 172 of file OutputStream.cpp.

00172                                  {
00173   // Clear any previously existing item list
00174   clearSelection();
00175   // Test whether this event should be output
00176   if ( isEventAccepted() )  {
00177     StatusCode sc = writeObjects();
00178     clearSelection();
00179     m_events++;
00180     if(sc.isSuccess() && m_fireIncidents) 
00181       m_incidentSvc->fireIncident(Incident(m_outputName,
00182                                            IncidentType::WroteToOutputFile));
00183     else if(m_fireIncidents) 
00184       m_incidentSvc->fireIncident(Incident(m_outputName,
00185                                            IncidentType::FailOutputFile));
00186     return sc;
00187   }
00188   return StatusCode::SUCCESS;
00189 }

StatusCode OutputStream::connectConversionSvc (  )  [virtual]

Definition at line 344 of file OutputStream.cpp.

00344                                                 {
00345   StatusCode status = StatusCode(StatusCode::FAILURE, true);
00346   MsgStream log(msgSvc(), name());
00347   // Get output file from input
00348   std::string dbType, svc, shr;
00349   Tokenizer tok(true);
00350   tok.analyse(m_output, " ", "", "", "=", "'", "'");
00351   for(Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); ++i)   {
00352     const std::string& tag = (*i).tag();
00353     const std::string& val = (*i).value();
00354     switch( ::toupper(tag[0]) )    {
00355     case 'D':
00356       m_outputName = val;
00357       break;
00358     case 'T':
00359       dbType = val;
00360       break;
00361     case 'S':
00362       switch( ::toupper(tag[1]) )   {
00363       case 'V':    svc = val;      break;
00364       case 'H':    shr = "YES";    break;
00365       }
00366       break;
00367     case 'O':   // OPT='<NEW<CREATE,WRITE,RECREATE>, UPDATE>'
00368       switch( ::toupper(val[0]) )   {
00369       case 'R':
00370         if ( ::strncasecmp(val.c_str(),"RECREATE",3)==0 )
00371           m_outputType = "RECREATE";
00372         else if ( ::strncasecmp(val.c_str(),"READ",3)==0 )
00373           m_outputType = "READ";
00374         break;
00375       case 'C':
00376       case 'N':
00377       case 'W':
00378         m_outputType = "NEW";
00379         break;
00380       case 'U':
00381         m_outputType = "UPDATE";
00382         break;
00383       default:
00384         m_outputType = "???";
00385         break;
00386       }
00387       break;
00388     default:
00389       break;
00390     }
00391   }
00392   if ( !shr.empty() ) m_outputType += "|SHARED";
00393   // Get access to the default Persistency service
00394   // The default service is the same for input as for output.
00395   // If this is not desired, then a specialized OutputStream must overwrite
00396   // this value.
00397   if ( dbType.length() > 0 && svc.length()==0 )   {
00398     SmartIF<IPersistencySvc> ipers(serviceLocator()->service(m_persName));
00399     if( !ipers.isValid() )   {
00400       log << MSG::FATAL << "Unable to locate IPersistencySvc interface of " << m_persName << endmsg;
00401       return StatusCode::FAILURE;
00402     }
00403     IConversionSvc *cnvSvc = 0;
00404     status = ipers->getService(dbType, cnvSvc);
00405     if( !status.isSuccess() )   {
00406       log << MSG::FATAL << "Unable to locate IConversionSvc interface of database type " << dbType << endmsg;
00407       return status;
00408     }
00409     // Increase reference count and keep service.
00410     m_pConversionSvc = cnvSvc;
00411   }
00412   else if ( svc.length() > 0 )    {
00413     // On success reference count is automatically increased.
00414     m_pConversionSvc = serviceLocator()->service(svc);
00415     if( !m_pConversionSvc.isValid() )   {
00416       log << MSG::FATAL << "Unable to locate IConversionSvc interface of " << svc << endmsg;
00417       return StatusCode::FAILURE;
00418     }
00419   }
00420   else    {
00421     log << MSG::FATAL
00422         << "Unable to locate IConversionSvc interface (Unknown technology) " << endmsg
00423         << "You either have to specify a technology name or a service name!" << endmsg
00424         << "Please correct the job option \"" << name() << ".Output\" !"     << endmsg;
00425     return StatusCode::FAILURE;
00426   }
00427   return StatusCode::SUCCESS;
00428 }

bool OutputStream::collect ( IRegistry dir,
int  level 
) [virtual]

Store agent's classback.

Definition at line 233 of file OutputStream.cpp.

00233                                                        {
00234   if ( level < m_currentItem->depth() )   {
00235     if ( dir->object() != 0 )   {
00236       /*
00237       std::cout << "Analysing ("
00238                 << dir->name()
00239                 << ") Object:"
00240                 << ((dir->object()==0) ? "UNLOADED" : "LOADED")
00241                 << std::endl;
00242       */
00243       m_objects.push_back(dir->object());
00244       return true;
00245     }
00246   }
00247   return false;
00248 }

StatusCode OutputStream::collectObjects (  )  [virtual]

Collect all objects to be written tio the output stream.

Collect all objects to be written to the output stream.

Reimplemented in InputCopyStream.

Definition at line 251 of file OutputStream.cpp.

00251                                           {
00252   MsgStream log(msgSvc(), name());
00253   StatusCode status = StatusCode::SUCCESS;
00254   Items::iterator i;
00255   // Traverse the tree and collect the requested objects
00256   for ( i = m_itemList.begin(); i != m_itemList.end(); i++ )    {
00257     DataObject* obj = 0;
00258     m_currentItem = (*i);
00259     StatusCode iret = m_pDataProvider->retrieveObject(m_currentItem->path(), obj);
00260     if ( iret.isSuccess() )  {
00261       iret = m_pDataManager->traverseSubTree(obj, m_agent);
00262       if ( !iret.isSuccess() )  {
00263         status = iret;
00264       }
00265     }
00266     else  {
00267       log << MSG::ERROR << "Cannot write mandatory object(s) (Not found) "
00268           << m_currentItem->path() << endmsg;
00269       status = iret;
00270     }
00271   }
00272   // Traverse the tree and collect the requested objects (tolerate missing itmes here)
00273   for ( i = m_optItemList.begin(); i != m_optItemList.end(); i++ )    {
00274     DataObject* obj = 0;
00275     m_currentItem = (*i);
00276     StatusCode iret = m_pDataProvider->retrieveObject(m_currentItem->path(), obj);
00277     if ( iret.isSuccess() )  {
00278       iret = m_pDataManager->traverseSubTree(obj, m_agent);
00279     }
00280     if ( !iret.isSuccess() )    {
00281       log << MSG::DEBUG << "Ignore request to write non-mandatory object(s) "
00282           << m_currentItem->path() << endmsg;
00283     }
00284   }
00285   return status;
00286 }

void OutputStream::clearItems ( Items itms  ) 

Clear item list.

Definition at line 294 of file OutputStream.cpp.

00294                                              {
00295   for ( Items::iterator i = itms.begin(); i != itms.end(); i++ )    {
00296     delete (*i);
00297   }
00298   itms.erase(itms.begin(), itms.end());
00299 }

void OutputStream::addItem ( Items itms,
const std::string descriptor 
)

Add item to output stramer list.

Definition at line 314 of file OutputStream.cpp.

00314                                                                      {
00315         MsgStream log(msgSvc(), name());
00316   int level = 0;
00317   size_t sep = descriptor.rfind("#");
00318   std::string obj_path (descriptor,0,sep);
00319   std::string slevel   (descriptor,sep+1,descriptor.length());
00320   if ( slevel == "*" )  {
00321     level = 9999999;
00322   }
00323   else   {
00324     level = atoi(slevel.c_str());
00325   }
00326   if ( m_verifyItems )  {
00327     size_t idx = obj_path.find("/",1);
00328     while(idx != std::string::npos)  {
00329       std::string sub_item = obj_path.substr(0,idx);
00330       if ( 0 == findItem(sub_item) )   {
00331         addItem(itms, sub_item+"#1");
00332       }
00333       idx = obj_path.find("/",idx+1);
00334     }
00335   }
00336   DataStoreItem* item = new DataStoreItem(obj_path, level);
00337   log << MSG::DEBUG << "Adding OutputStream item " << item->path()
00338       << " with " << item->depth()
00339       << " level(s)." << endmsg;
00340   itms.push_back( item );
00341 }

void OutputStream::clearSelection (  ) 

Clear list of selected objects.

Definition at line 289 of file OutputStream.cpp.

00289                                       {
00290   m_objects.erase(m_objects.begin(), m_objects.end());
00291 }

IDataSelector* OutputStream::selectedObjects (  )  [inline]

Return the list of selected objects.

Definition at line 145 of file OutputStream.h.

00145                                       {
00146     return &m_objects;
00147   }


Friends And Related Function Documentation

friend class AlgFactory< OutputStream > [friend]

Definition at line 33 of file OutputStream.h.

friend class Factory< OutputStream, IAlgorithm *(std::string, ISvcLocator *)> [friend]

Definition at line 34 of file OutputStream.h.


Member Data Documentation

Reference to the indicent service.

Definition at line 41 of file OutputStream.h.

Flag indicating wether data pre-loading should be performed.

Definition at line 43 of file OutputStream.h.

Flag indicating whether optional items should be preloaded.

Definition at line 45 of file OutputStream.h.

Flag to indicate that item consistency should be checked.

Definition at line 47 of file OutputStream.h.

Name of the service managing the data store.

Definition at line 49 of file OutputStream.h.

Name of the persistency service capable to write data from the store.

Definition at line 51 of file OutputStream.h.

Name of the output file specification.

Definition at line 53 of file OutputStream.h.

Name of the output file.

Definition at line 55 of file OutputStream.h.

Output type: NEW(NEW,CREATE,WRITE,RECREATE), UPDATE).

Definition at line 57 of file OutputStream.h.

Keep reference of agent.

Definition at line 59 of file OutputStream.h.

Keep reference to the data provider service.

Definition at line 61 of file OutputStream.h.

Keep reference to the data manager service.

Definition at line 63 of file OutputStream.h.

Keep reference to the data conversion service.

Definition at line 65 of file OutputStream.h.

Keep track of the current item.

Definition at line 67 of file OutputStream.h.

Vector of item names.

Definition at line 69 of file OutputStream.h.

Vector of items to be saved to this stream.

Definition at line 71 of file OutputStream.h.

Vector of item names.

Definition at line 73 of file OutputStream.h.

Vector of optional items to be saved to this stream.

Definition at line 75 of file OutputStream.h.

Collection of objects beeing selected.

Definition at line 77 of file OutputStream.h.

int OutputStream::m_events [protected]

Number of events written to this output stream.

Reimplemented in SequentialOutputStream.

Definition at line 79 of file OutputStream.h.

Vector of names of Algorithms that this stream accepts.

Definition at line 81 of file OutputStream.h.

Vector of names of Algorithms that this stream requires.

Definition at line 83 of file OutputStream.h.

Vector of names of Algorithms that this stream is vetoed by.

Definition at line 85 of file OutputStream.h.

Vector of Algorithms that this stream accepts.

Definition at line 87 of file OutputStream.h.

Vector of Algorithms that this stream requires.

Definition at line 89 of file OutputStream.h.

Vector of Algorithms that this stream is vetoed by.

Definition at line 91 of file OutputStream.h.

should I fire incidents for writing opening/closing etc?

Definition at line 122 of file OutputStream.h.


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

Generated at Wed Mar 17 18:18:43 2010 for Gaudi Framework, version v21r8 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004