| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends

# OutputStream Class Reference

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

`#include <OutputStream.h>`

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

List of all members.

## Public Types
typedef std::vector < DataStoreItem * > | Items
typedef std::vector< std::string > | ItemNames
## 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 to the output stream.
void | clearItems (Items &itms)
| Clear item list.
void | addItem (Items &itms, const std::string &descriptor)
| Add item to output streamer list.
void | clearSelection ()
| Clear list of selected objects.
IDataSelector * | selectedObjects ()
| 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.
DataStoreItem * | findItem (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.
virtual bool | hasInput () const
| Tell if the instance has been configured with input items or not.
## Protected Attributes
SmartIF< IIncidentSvc > | m_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)
OutputStreamAgent * | m_agent
| Keep reference of agent.
SmartIF< IDataProviderSvc > | m_pDataProvider
| Keep reference to the data provider service.
SmartIF< IDataManagerSvc > | m_pDataManager
| Keep reference to the data manager service.
SmartIF< IConversionSvc > | m_pConversionSvc
| Keep reference to the data conversion service.
DataStoreItem * | m_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 being 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

typedef std::vector<std::string> OutputStream::ItemNames

Definition at line 38 of file OutputStream.h.

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

Definition at line 37 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 31 of file OutputStream.cpp.

     : Algorithm(name, pSvcLocator)
    {
      m_doPreLoad      = true;
      m_doPreLoadOpt   = false;
      m_verifyItems    = true;
      m_output         = "";
      m_outputName     = "";
      m_outputType     = "UPDATE";
      m_storeName      = "EventDataSvc";
      m_persName       = "EventPersistencySvc";
      m_agent          = new OutputStreamAgent(this);
      m_acceptAlgs     = new std::vector<Algorithm*>();
      m_requireAlgs    = new std::vector<Algorithm*>();
      m_vetoAlgs       = new std::vector<Algorithm*>();
      m_fireIncidents  = true;
      declareProperty("ItemList",         m_itemNames);
      declareProperty("OptItemList",      m_optItemNames);
      declareProperty("Preload",          m_doPreLoad);
      declareProperty("PreloadOptItems",  m_doPreLoadOpt);
      declareProperty("Output",           m_output);
      declareProperty("OutputFile",       m_outputName);
      declareProperty("EvtDataSvc",       m_storeName);
      declareProperty("EvtConversionSvc", m_persName);
      declareProperty("AcceptAlgs",       m_acceptNames);
      declareProperty("RequireAlgs",      m_requireNames);
      declareProperty("VetoAlgs",         m_vetoNames);
      declareProperty("VerifyItems",      m_verifyItems);

      // Associate action handlers with the AcceptAlgs, RequireAlgs & VetoAlgs properties
      m_acceptNames.declareUpdateHandler ( &OutputStream::acceptAlgsHandler , this );
      m_requireNames.declareUpdateHandler( &OutputStream::requireAlgsHandler, this );
      m_vetoNames.declareUpdateHandler   ( &OutputStream::vetoAlgsHandler   , this );
    }

OutputStream::~OutputStream | ( | ) | `[virtual]`

Standard Destructor.

Definition at line 71 of file OutputStream.cpp.

                                  {
      delete m_agent;
      delete m_acceptAlgs;
      delete m_requireAlgs;
      delete m_vetoAlgs;
    }

## Member Function Documentation

void OutputStream::acceptAlgsHandler | ( | Property & | theProp ) | `[protected]`

Handler for AcceptAlgs Property.

Definition at line 445 of file OutputStream.cpp.

                                                                   {
      StatusCode sc = decodeAlgorithms( m_acceptNames, m_acceptAlgs );
      if (sc.isFailure()) {
        throw GaudiException("Failure in OutputStream::decodeAlgorithms",
                             "OutputStream::acceptAlgsHandler",sc);
      }
    }

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

Add item to output streamer list.

Definition at line 332 of file OutputStream.cpp.

                                                                         {
            MsgStream log(msgSvc(), name());
      int level = 0;
      size_t sep = descriptor.rfind("#");
      std::string obj_path (descriptor,0,sep);
      std::string slevel   (descriptor,sep+1,descriptor.length());
      if ( slevel == "*" )  {
        level = 9999999;
      }
      else   {
        level = atoi(slevel.c_str());
      }
      if ( m_verifyItems )  {
        size_t idx = obj_path.find("/",1);
        while(idx != std::string::npos)  {
          std::string sub_item = obj_path.substr(0,idx);
          if ( 0 == findItem(sub_item) )   {
            addItem(itms, sub_item+"#1");
          }
          idx = obj_path.find("/",idx+1);
        }
      }
      DataStoreItem* item = new DataStoreItem(obj_path, level);
      log << MSG::DEBUG << "Adding OutputStream item " << item->path()
          << " with " << item->depth()
          << " level(s)." << endmsg;
      itms.push_back( item );
    }

void OutputStream::clearItems | ( | Items & | itms ) |

Clear item list.

Definition at line 312 of file OutputStream.cpp.

                                                 {
      for ( Items::iterator i = itms.begin(); i != itms.end(); i++ )    {
        delete (*i);
      }
      itms.erase(itms.begin(), itms.end());
    }

void OutputStream::clearSelection | ( | ) |

Clear list of selected objects.

Definition at line 307 of file OutputStream.cpp.

                                          {
      m_objects.erase(m_objects.begin(), m_objects.end());
    }

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

Store agent's classback.

Definition at line 235 of file OutputStream.cpp.

                                                           {
      if ( level < m_currentItem->depth() )   {
        if ( dir->object() != 0 )   {
          /*
          std::cout << "Analysing ("
                    << dir->name()
                    << ") Object:"
                    << ((dir->object()==0) ? "UNLOADED" : "LOADED")
                    << std::endl;
          */
          m_objects.push_back(dir->object());
          return true;
        }
      }
      return false;
    }

StatusCode OutputStream::collectObjects | ( | ) | `[virtual]`

Collect all objects to be written to the output stream.

Reimplemented in InputCopyStream.

Definition at line 253 of file OutputStream.cpp.

                                              {
      MsgStream log(msgSvc(), name());
      StatusCode status = StatusCode::SUCCESS;
      Items::iterator i;
      // Traverse the tree and collect the requested objects
      for ( i = m_itemList.begin(); i != m_itemList.end(); i++ )    {
        DataObject* obj = 0;
        m_currentItem = (*i);
        StatusCode iret = m_pDataProvider->retrieveObject(m_currentItem->path(), obj);
        if ( iret.isSuccess() )  {
          iret = m_pDataManager->traverseSubTree(obj, m_agent);
          if ( !iret.isSuccess() )  {
            status = iret;
          }
        }
        else  {
          log << MSG::ERROR << "Cannot write mandatory object(s) (Not found) "
              << m_currentItem->path() << endmsg;
          status = iret;
        }
      }
      // Traverse the tree and collect the requested objects (tolerate missing items here)
      for ( i = m_optItemList.begin(); i != m_optItemList.end(); i++ )    {
        DataObject* obj = 0;
        m_currentItem = (*i);
        StatusCode iret = m_pDataProvider->retrieveObject(m_currentItem->path(), obj);
        if ( iret.isSuccess() )  {
          iret = m_pDataManager->traverseSubTree(obj, m_agent);
        }
        if ( !iret.isSuccess() )    {
          log << MSG::DEBUG << "Ignore request to write non-mandatory object(s) "
              << m_currentItem->path() << endmsg;
        }
      }

      if (status.isSuccess()){
        // Remove duplicates from the list of objects, preserving the order in the list
        std::set<DataObject*> unique;
        std::vector<DataObject*> tmp; // temporary vector with the reduced list
        tmp.reserve(m_objects.size());
        for (std::vector<DataObject*>::iterator o = m_objects.begin(); o != m_objects.end(); ++o) {
          if (!unique.count(*o)) {
            // if the pointer is not in the set, add it to both the set and the temporary vector
            unique.insert(*o);
            tmp.push_back(*o);
          }
        }
        m_objects.swap(tmp); // swap the data of the two vectors
      }

      return status;
    }

StatusCode OutputStream::connectConversionSvc | ( | ) | `[virtual]`

Definition at line 362 of file OutputStream.cpp.

                                                    {
      StatusCode status = StatusCode(StatusCode::FAILURE, true);
      MsgStream log(msgSvc(), name());
      // Get output file from input
      std::string dbType, svc, shr;
      Tokenizer tok(true);
      tok.analyse(m_output, " ", "", "", "=", "'", "'");
      for(Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); ++i)   {
        const std::string& tag = (*i).tag();
        const std::string& val = (*i).value();
        switch( ::toupper(tag[0]) )    {
        case 'D':
          m_outputName = val;
          break;
        case 'T':
          dbType = val;
          break;
        case 'S':
          switch( ::toupper(tag[1]) )   {
          case 'V':    svc = val;      break;
          case 'H':    shr = "YES";    break;
          }
          break;
        case 'O':   // OPT='<NEW<CREATE,WRITE,RECREATE>, UPDATE>'
          switch( ::toupper(val[0]) )   {
          case 'R':
            if ( ::strncasecmp(val.c_str(),"RECREATE",3)==0 )
              m_outputType = "RECREATE";
            else if ( ::strncasecmp(val.c_str(),"READ",3)==0 )
              m_outputType = "READ";
            break;
          case 'C':
          case 'N':
          case 'W':
            m_outputType = "NEW";
            break;
          case 'U':
            m_outputType = "UPDATE";
            break;
          default:
            m_outputType = "???";
            break;
          }
          break;
        default:
          break;
        }
      }
      if ( !shr.empty() ) m_outputType += "|SHARED";
      // Get access to the default Persistency service
      // The default service is the same for input as for output.
      // If this is not desired, then a specialized OutputStream must overwrite
      // this value.
      if ( dbType.length() > 0 || svc.length() > 0 )   {
        std::string typ = dbType.length()>0 ? dbType : svc;
        SmartIF<IPersistencySvc> ipers(serviceLocator()->service(m_persName));
        if( !ipers.isValid() )   {
          log << MSG::FATAL << "Unable to locate IPersistencySvc interface of " << m_persName << endmsg;
          return StatusCode::FAILURE;
        }
        IConversionSvc *cnvSvc = 0;
        status = ipers->getService(typ, cnvSvc);
        if( !status.isSuccess() )   {
          log << MSG::FATAL << "Unable to locate IConversionSvc interface of database type " << typ << endmsg;
          return status;
        }
        // Increase reference count and keep service.
        m_pConversionSvc = cnvSvc;
      }
      else    {
        log << MSG::FATAL
            << "Unable to locate IConversionSvc interface (Unknown technology) " << endmsg
            << "You either have to specify a technology name or a service name!" << endmsg
            << "Please correct the job option \"" << name() << ".Output\" !"     << endmsg;
        return StatusCode::FAILURE;
      }
      return StatusCode::SUCCESS;
    }

StatusCode OutputStream::decodeAcceptAlgs | ( | ) | `[protected]`

Decode list of Algorithms that this stream accepts.

Definition at line 441 of file OutputStream.cpp.

                                               {
      return decodeAlgorithms( m_acceptNames, m_acceptAlgs );
    }

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

Decode specified list of Algorithms.

Definition at line 477 of file OutputStream.cpp.

    {
      // Reset the list of Algorithms
      theAlgs->clear( );

      MsgStream log( msgSvc( ), name( ) );

      StatusCode result = StatusCode::FAILURE;

      SmartIF<IAlgManager> theAlgMgr(serviceLocator());
      if ( theAlgMgr.isValid() ) {
        // Build the list of Algorithms from the names list
        const std::vector<std::string> nameList = theNames.value( );
        std::vector<std::string>::const_iterator it;
        std::vector<std::string>::const_iterator itend = nameList.end( );
        for (it = nameList.begin(); it != itend; ++it) {
          // Check whether the supplied name corresponds to an existing
          // Algorithm object.
          const std::string &theName = (*it);
          SmartIF<IAlgorithm> &theIAlg = theAlgMgr->algorithm(theName);
          Algorithm*  theAlgorithm;
          if ( theIAlg.isValid() ) {
            result = StatusCode::SUCCESS;
            try{
              theAlgorithm = dynamic_cast<Algorithm*>(theIAlg.get());
            } catch(...){
              result = StatusCode::FAILURE;
            }
          }
          if ( result.isSuccess( ) ) {
            // Check that the specified algorithm doesn't already exist in the list
            std::vector<Algorithm*>::iterator ita;
            std::vector<Algorithm*>::iterator itaend = theAlgs->end( );
            for (ita = theAlgs->begin(); ita != itaend; ++ita) {
              Algorithm* existAlgorithm = (*ita);
              if ( theAlgorithm == existAlgorithm ) {
                result = StatusCode::FAILURE;
                break;
              }
            }
            if ( result.isSuccess( ) ) {
              theAlgorithm->addRef();
              theAlgs->push_back( theAlgorithm );
            }
          }
          else {
            log << MSG::INFO << theName << " doesn't exist - ignored" << endmsg;
          }
        }
        result = StatusCode::SUCCESS;
      }
      else {
        log << MSG::FATAL << "Can't locate ApplicationMgr!!!" << endmsg;
      }
      return result;
    }

StatusCode OutputStream::decodeRequireAlgs | ( | ) | `[protected]`

Decode list of Algorithms that this stream requires.

Definition at line 453 of file OutputStream.cpp.

                                                 {
      return decodeAlgorithms( m_requireNames, m_requireAlgs );
    }

StatusCode OutputStream::decodeVetoAlgs | ( | ) | `[protected]`

Decode list of Algorithms that this stream is vetoed by.

Definition at line 465 of file OutputStream.cpp.

                                              {
      return decodeAlgorithms( m_vetoNames, m_vetoAlgs );
    }

StatusCode OutputStream::execute | ( | ) | `[virtual]`

Working entry point.

Reimplemented in RecordStream, RunRecordStream, and SequentialOutputStream.

Definition at line 174 of file OutputStream.cpp.

                                     {
      // Clear any previously existing item list
      clearSelection();
      // Test whether this event should be output
      if ( isEventAccepted() )  {
        StatusCode sc = writeObjects();
        clearSelection();
        m_events++;
        if(sc.isSuccess() && m_fireIncidents)
          m_incidentSvc->fireIncident(Incident(m_outputName,
                                               IncidentType::WroteToOutputFile));
        else if(m_fireIncidents)
          m_incidentSvc->fireIncident(Incident(m_outputName,
                                               IncidentType::FailOutputFile));
        return sc;
      }
      return StatusCode::SUCCESS;
    }

StatusCode OutputStream::finalize | ( | ) | `[virtual]`

Terminate OutputStream.

Reimplemented from Algorithm.

Reimplemented in InputCopyStream, RecordStream, RunRecordStream, and TagCollectionStream.

Definition at line 159 of file OutputStream.cpp.

                                      {
      MsgStream log(msgSvc(), name());
      log << MSG::INFO << "Events output: " << m_events << endmsg;
      if(m_fireIncidents) m_incidentSvc->fireIncident(Incident(m_outputName,
                                           IncidentType::EndOutputFile));
      m_incidentSvc.reset();
      m_pDataProvider.reset();
      m_pDataManager.reset();
      m_pConversionSvc.reset();
      clearItems(m_optItemList);
      clearItems(m_itemList);
      return StatusCode::SUCCESS;
    }

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

Find single item identified by its path (exact match)

Definition at line 321 of file OutputStream.cpp.

                                                 {
      for(Items::const_iterator i=m_itemList.begin(); i != m_itemList.end(); ++i)  {
        if ( (*i)->path() == path )  return (*i);
      }
      for(Items::const_iterator j=m_optItemList.begin(); j != m_optItemList.end(); ++j)  {
        if ( (*j)->path() == path )  return (*j);
      }
      return 0;
    }

bool OutputStream::hasInput | ( | ) | const`[protected, virtual]`

Tell if the instance has been configured with input items or not.

Reimplemented in InputCopyStream.

Definition at line 581 of file OutputStream.cpp.

                                      {
      return !(m_itemNames.empty() && m_optItemNames.empty());
    }

StatusCode OutputStream::initialize | ( | ) | `[virtual]`

Initialize OutputStream.

Reimplemented from Algorithm.

Reimplemented in InputCopyStream, and TagCollectionStream.

Definition at line 79 of file OutputStream.cpp.

                                        {
      MsgStream log(msgSvc(), name());

      // Reset the number of events written
      m_events = 0;
      // Get access to the DataManagerSvc
      m_pDataManager = serviceLocator()->service(m_storeName);
      if( !m_pDataManager.isValid() )   {
        log << MSG::FATAL << "Unable to locate IDataManagerSvc interface" << endmsg;
        return StatusCode::FAILURE;
      }
      // Get access to the IncidentService
      m_incidentSvc = serviceLocator()->service("IncidentSvc");
      if( !m_incidentSvc.isValid() )  {
        log << MSG::WARNING << "Error retrieving IncidentSvc." << endmsg;
        return StatusCode::FAILURE;
      }
      // Get access to the assigned data service
      m_pDataProvider = serviceLocator()->service(m_storeName);
      if( !m_pDataProvider.isValid() )   {
        log << MSG::FATAL << "Unable to locate IDataProviderSvc interface of " << m_storeName << endmsg;
        return StatusCode::FAILURE;
      }
      if ( hasInput() )  {
        StatusCode status = connectConversionSvc();
        if( !status.isSuccess() )   {
          log << MSG::FATAL << "Unable to connect to conversion service." << endmsg;
          if(m_outputName!="" && m_fireIncidents) m_incidentSvc->fireIncident(Incident(m_outputName,
                                               IncidentType::FailOutputFile));
          return status;
        }
      }

      // Clear the list with optional items
      clearItems(m_optItemList);
      // Clear the item list
      clearItems(m_itemList);

      ItemNames::iterator i;
      // Take the new item list from the properties.
      for(i = m_itemNames.begin(); i != m_itemNames.end(); i++)   {
        addItem( m_itemList, *i );
      }

      // Take the new item list from the properties.
      for(i = m_optItemNames.begin(); i != m_optItemNames.end(); i++)   {
        addItem( m_optItemList, *i );
      }

      // Take the item list to the data service preload list.
      if ( m_doPreLoad )    {
        for(Items::iterator j = m_itemList.begin(); j != m_itemList.end(); j++)   {
          m_pDataProvider->addPreLoadItem( *(*j) ).ignore();
        }
        // Not working: bad reference counting! pdataSvc->release();
      }

      if ( m_doPreLoadOpt )    {
        for(Items::iterator j=m_optItemList.begin(); j!=m_optItemList.end(); j++) {
          m_pDataProvider->addPreLoadItem( *(*j) );
        }
      }
      log << MSG::INFO << "Data source: " << m_storeName  << " output: " << m_output << endmsg;

      // Decode the accept, required and veto Algorithms. The logic is the following:
      //  a. The event is accepted if all lists are empty.
      //  b. The event is provisionally accepted if any Algorithm in the accept list
      //     has been executed and has indicated that its filter is passed. This
      //     provisional acceptance can be overridden by the other lists.
      //  c. The event is rejected unless all Algorithms in the required list have
      //     been executed and have indicated that their filter passed.
      //  d. The event is rejected if any Algorithm in the veto list has been
      //     executed and has indicated that its filter has passed.
      decodeAcceptAlgs ().ignore();
      decodeRequireAlgs().ignore();
      decodeVetoAlgs   ().ignore();
      return StatusCode::SUCCESS;
    }

bool OutputStream::isEventAccepted | ( | ) | const`[protected]`

Test whether this event should be output.

Definition at line 535 of file OutputStream.cpp.

                                               {
      typedef std::vector<Algorithm*>::iterator AlgIter;
      bool result = true;

      // Loop over all Algorithms in the accept list to see
      // whether any have been executed and have their filter
      // passed flag set. Any match causes the event to be
      // provisionally accepted.
      if ( ! m_acceptAlgs->empty() ) {
        result = false;
        for(AlgIter i=m_acceptAlgs->begin(),end=m_acceptAlgs->end(); i != end; ++i) {
          if ( (*i)->isExecuted() && (*i)->filterPassed() ) {
            result = true;
            break;
          }
        }
      }

      // Loop over all Algorithms in the required list to see
      // whether all have been executed and have their filter
      // passed flag set. Any mismatch causes the event to be
      // rejected.
      if ( result && ! m_requireAlgs->empty() ) {
        for(AlgIter i=m_requireAlgs->begin(),end=m_requireAlgs->end(); i != end; ++i) {
          if ( !(*i)->isExecuted() || !(*i)->filterPassed() ) {
            result = false;
            break;
          }
        }
      }

      // Loop over all Algorithms in the veto list to see
      // whether any have been executed and have their filter
      // passed flag set. Any match causes the event to be
      // rejected.
      if ( result && ! m_vetoAlgs->empty() ) {
        for(AlgIter i=m_vetoAlgs->begin(),end=m_vetoAlgs->end(); i != end; ++i) {
          if ( (*i)->isExecuted() && (*i)->filterPassed() ) {
            result = false;
            break;
          }
        }
      }
      return result;
    }

void OutputStream::requireAlgsHandler | ( | Property & | theProp ) | `[protected]`

Handler for RequireAlgs Property.

Definition at line 457 of file OutputStream.cpp.

                                                                    {
      StatusCode sc = decodeAlgorithms( m_requireNames, m_requireAlgs );
      if (sc.isFailure()) {
        throw GaudiException("Failure in OutputStream::decodeAlgorithms",
                             "OutputStream::requireAlgsHandler",sc);
      }
    }

IDataSelector* OutputStream::selectedObjects | ( | ) | `[inline]`

Return the list of selected objects.

Definition at line 147 of file OutputStream.h.

                                          {
        return &m_objects;
      }

void OutputStream::vetoAlgsHandler | ( | Property & | theProp ) | `[protected]`

Handler for VetoAlgs Property.

Definition at line 469 of file OutputStream.cpp.

                                                                 {
      StatusCode sc = decodeAlgorithms( m_vetoNames, m_vetoAlgs );
      if (sc.isFailure()) {
        throw GaudiException("Failure in OutputStream::decodeAlgorithms",
                             "OutputStream::vetoAlgsHandler",sc);
      }
    }

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

Select the different objects and write them to file.

Reimplemented in SequentialOutputStream, and TagCollectionStream.

Definition at line 194 of file OutputStream.cpp.

                                           {
      // Connect the output file to the service
      StatusCode status = collectObjects();
      if ( status.isSuccess() )   {
        IDataSelector*  sel = selectedObjects();
        if ( sel->begin() != sel->end() )  {
          status = m_pConversionSvc->connectOutput(m_outputName, m_outputType);
          if ( status.isSuccess() )   {
            // Now pass the collection to the persistency service
            IDataSelector::iterator j;
            IOpaqueAddress* pAddress = 0;
            for ( j = sel->begin(); j != sel->end(); j++ )    {
              StatusCode iret = m_pConversionSvc->createRep( *j, pAddress );
              if ( !iret.isSuccess() )      {
                status = iret;
                continue;
              }
              IRegistry* pReg = (*j)->registry();
              pReg->setAddress(pAddress);
            }
            for ( j = sel->begin(); j != sel->end(); j++ )    {
              IRegistry* pReg = (*j)->registry();
              StatusCode iret = m_pConversionSvc->fillRepRefs( pReg->address(), *j );
              if ( !iret.isSuccess() )      {
                status = iret;
              }
            }
            // Commit the data if there was no error; otherwise possibly discard
            if ( status.isSuccess() )  {
              status = m_pConversionSvc->commitOutput(m_outputName, true);
            }
            else   {
              m_pConversionSvc->commitOutput(m_outputName, false).ignore();
            }
          }
        }
      }
      return status;
    }

## 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

std::vector<Algorithm*>* OutputStream::m_acceptAlgs`[protected]`

Vector of Algorithms that this stream accepts.

Definition at line 87 of file OutputStream.h.

StringArrayProperty OutputStream::m_acceptNames`[protected]`

Vector of names of Algorithms that this stream accepts.

Definition at line 81 of file OutputStream.h.

OutputStreamAgent* OutputStream::m_agent`[protected]`

Keep reference of agent.

Definition at line 59 of file OutputStream.h.

DataStoreItem* OutputStream::m_currentItem`[protected]`

Keep track of the current item.

Definition at line 67 of file OutputStream.h.

bool OutputStream::m_doPreLoad`[protected]`

Flag indicating wether data pre-loading should be performed.

Definition at line 43 of file OutputStream.h.

bool OutputStream::m_doPreLoadOpt`[protected]`

Flag indicating whether optional items should be preloaded.

Definition at line 45 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.

bool OutputStream::m_fireIncidents`[protected]`

should I fire incidents for writing opening/closing etc?

Definition at line 122 of file OutputStream.h.

SmartIF<IIncidentSvc> OutputStream::m_incidentSvc`[protected]`

Reference to the indicent service.

Definition at line 41 of file OutputStream.h.

Items OutputStream::m_itemList`[protected]`

Vector of items to be saved to this stream.

Definition at line 71 of file OutputStream.h.

ItemNames OutputStream::m_itemNames`[protected]`

Vector of item names.

Definition at line 69 of file OutputStream.h.

IDataSelector OutputStream::m_objects`[protected]`

Collection of objects being selected.

Definition at line 77 of file OutputStream.h.

Items OutputStream::m_optItemList`[protected]`

Vector of optional items to be saved to this stream.

Definition at line 75 of file OutputStream.h.

ItemNames OutputStream::m_optItemNames`[protected]`

Vector of item names.

Definition at line 73 of file OutputStream.h.

std::string OutputStream::m_output`[protected]`

Name of the output file specification.

Definition at line 53 of file OutputStream.h.

std::string OutputStream::m_outputName`[protected]`

Name of the output file.

Definition at line 55 of file OutputStream.h.

std::string OutputStream::m_outputType`[protected]`

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

Definition at line 57 of file OutputStream.h.

SmartIF<IConversionSvc> OutputStream::m_pConversionSvc`[protected]`

Keep reference to the data conversion service.

Definition at line 65 of file OutputStream.h.

SmartIF<IDataManagerSvc> OutputStream::m_pDataManager`[protected]`

Keep reference to the data manager service.

Definition at line 63 of file OutputStream.h.

SmartIF<IDataProviderSvc> OutputStream::m_pDataProvider`[protected]`

Keep reference to the data provider service.

Definition at line 61 of file OutputStream.h.

std::string OutputStream::m_persName`[protected]`

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

Definition at line 51 of file OutputStream.h.

std::vector<Algorithm*>* OutputStream::m_requireAlgs`[protected]`

Vector of Algorithms that this stream requires.

Definition at line 89 of file OutputStream.h.

StringArrayProperty OutputStream::m_requireNames`[protected]`

Vector of names of Algorithms that this stream requires.

Definition at line 83 of file OutputStream.h.

std::string OutputStream::m_storeName`[protected]`

Name of the service managing the data store.

Definition at line 49 of file OutputStream.h.

bool OutputStream::m_verifyItems`[protected]`

Flag to indicate that item consistency should be checked.

Definition at line 47 of file OutputStream.h.

std::vector<Algorithm*>* OutputStream::m_vetoAlgs`[protected]`

Vector of Algorithms that this stream is vetoed by.

Definition at line 91 of file OutputStream.h.

StringArrayProperty OutputStream::m_vetoNames`[protected]`

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

Definition at line 85 of file OutputStream.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiCommonSvc/src/PersistencySvc/OutputStream.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiCommonSvc/src/PersistencySvc/OutputStream.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines