| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# EvtCollectionStream Class Reference

`#include <EvtCollectionStream.h>`

Inheritance diagram for EvtCollectionStream:

[legend]
Collaboration diagram for EvtCollectionStream:

[legend]

List of all members.

## Detailed Description

A small to stream Data I/O.

Author: M.Frank Version: 1.0

Definition at line 29 of file EvtCollectionStream.h.

## Public Member Functions
virtual StatusCode | initialize ()
| Initialize EvtCollectionStream.
virtual StatusCode | finalize ()
| Terminate EvtCollectionStream.
virtual StatusCode | execute ()
| Working entry point.
## Protected Member Functions
| EvtCollectionStream (const std::string &name, ISvcLocator *pSvcLocator)
| Standard algorithm Constructor.
virtual | ~EvtCollectionStream ()
| Standard Destructor.
void | clearItems ()
| Clear item list.
void | addItem (const std::string &descriptor)
| Add item to output stramer list.
## Protected Attributes
INTupleSvc * | m_pTupleSvc
| Reference to Tuple service for event collection (may or may not be NTuple service).
std::string | m_storeName
| Name of the service managing the data store.
ItemNames | m_itemNames
| Vector of item names.
Items | m_itemList
| Vector of items to be saved to this stream.
## Private Types
typedef std::vector< std::string > | ItemNames
typedef std::vector < DataStoreItem * > | Items
## Friends
class | AlgFactory< EvtCollectionStream >
class | Factory< EvtCollectionStream, IAlgorithm *(std::string, ISvcLocator *)>

## Member Typedef Documentation

typedef std::vector<std::string> EvtCollectionStream::ItemNames`[private]`

Definition at line 33 of file EvtCollectionStream.h.

typedef std::vector<DataStoreItem*> EvtCollectionStream::Items`[private]`

Definition at line 34 of file EvtCollectionStream.h.

## Constructor & Destructor Documentation

EvtCollectionStream::EvtCollectionStream | ( | const std::string & | name,
|  | ISvcLocator * | pSvcLocator |
| ) |  |  | `[protected]`

Standard algorithm Constructor.

Definition at line 25 of file EvtCollectionStream.cpp.

    00026 : Algorithm(name, pSvcLocator)
    00027 {
    00028   m_pTupleSvc = 0;
    00029   m_storeName = "TagCollectionSvc";
    00030   declareProperty("ItemList",   m_itemNames);
    00031   declareProperty("EvtDataSvc", m_storeName);
    00032 }

EvtCollectionStream::~EvtCollectionStream | ( |  | ) | `[protected, virtual]`

Standard Destructor.

Definition at line 35 of file EvtCollectionStream.cpp.

    00035                                             {
    00036 }

## Member Function Documentation

void EvtCollectionStream::clearItems | ( |  | ) | `[protected]`

Clear item list.

Definition at line 85 of file EvtCollectionStream.cpp.

    00085                                          {
    00086   for ( Items::iterator i = m_itemList.begin(); i != m_itemList.end(); i++ )    {
    00087     delete (*i);
    00088   }
    00089   m_itemList.erase(m_itemList.begin(), m_itemList.end());
    00090 }

void EvtCollectionStream::addItem | ( | const std::string & | descriptor | ) | `[protected]`

Add item to output stramer list.

Definition at line 93 of file EvtCollectionStream.cpp.

    00093                                                                {
    00094   MsgStream log(msgSvc(), name());
    00095   int sep = descriptor.rfind("#");
    00096   int level = 0;
    00097   std::string obj_path (descriptor,0,sep);
    00098   std::string slevel   (descriptor,sep+1,descriptor.length());
    00099   if ( slevel == "*" )  {
    00100     level = 9999999;
    00101   }
    00102   else   {
    00103     level = ::atoi(slevel.c_str());
    00104   }
    00105   DataStoreItem* item = new DataStoreItem(obj_path, level);
    00106   log << MSG::INFO << "Adding OutputStream item " << item->path()
    00107       << " with " << item->depth()
    00108       << " level(s)." << endreq;
    00109   m_itemList.push_back( item );
    00110 }

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

Initialize EvtCollectionStream.

Reimplemented from Algorithm.

Definition at line 39 of file EvtCollectionStream.cpp.

    00039                                            {
    00040   MsgStream log(msgSvc(), name());
    00041   // Use the Job options service to set the Algorithm's parameters
    00042   setProperties();
    00043   // Get access to the DataManagerSvc
    00044   StatusCode status = serviceLocator()->service(m_storeName, m_pTupleSvc, true );
    00045   if( !status.isSuccess() )   {
    00046     log << MSG::FATAL << "Unable to locate IDataManagerSvc interface" << endreq;
    00047     return status;
    00048   }
    00049   m_pTupleSvc->addRef();
    00050   // Clear the item list
    00051   clearItems();
    00052   // Take the new item list from the properties.
    00053   for(ItemNames::iterator i = m_itemNames.begin(); i != m_itemNames.end(); i++)   {
    00054     addItem( *i );
    00055   }
    00056   log << MSG::INFO << "Data source:             " << m_storeName  << endreq;
    00057   return status;
    00058 }

StatusCode EvtCollectionStream::finalize | ( | void |  | ) | `[virtual]`

Terminate EvtCollectionStream.

Reimplemented from Algorithm.

Definition at line 61 of file EvtCollectionStream.cpp.

    00061                                             {
    00062   if ( 0 != m_pTupleSvc )   {
    00063     m_pTupleSvc->release();
    00064     m_pTupleSvc = 0;
    00065   }
    00066   clearItems();
    00067   return StatusCode::SUCCESS;
    00068 }

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

Working entry point.

Implements IAlgorithm.

Definition at line 71 of file EvtCollectionStream.cpp.

    00071                                         {
    00072   StatusCode status = (m_pTupleSvc) ? StatusCode::SUCCESS : StatusCode::FAILURE;
    00073   if ( status.isSuccess() )   {
    00074     for ( Items::iterator i = m_itemList.begin(); i != m_itemList.end(); i++ )    {
    00075       StatusCode iret = m_pTupleSvc->writeRecord((*i)->path());
    00076       if ( !iret.isSuccess() )    {
    00077         status = iret;
    00078       }
    00079     }
    00080   }
    00081   return status;
    00082 }

## Friends And Related Function Documentation

friend class AlgFactory< EvtCollectionStream >`[friend]`

Definition at line 30 of file EvtCollectionStream.h.

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

Definition at line 31 of file EvtCollectionStream.h.

## Member Data Documentation

INTupleSvc* EvtCollectionStream::m_pTupleSvc`[protected]`

Reference to Tuple service for event collection (may or may not be NTuple service).

Definition at line 37 of file EvtCollectionStream.h.

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

Name of the service managing the data store.

Definition at line 39 of file EvtCollectionStream.h.

ItemNames EvtCollectionStream::m_itemNames`[protected]`

Vector of item names.

Definition at line 41 of file EvtCollectionStream.h.

Items EvtCollectionStream::m_itemList`[protected]`

Vector of items to be saved to this stream.

Definition at line 43 of file EvtCollectionStream.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r3/GaudiSvc/src/PersistencySvc/EvtCollectionStream.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r3/GaudiSvc/src/PersistencySvc/EvtCollectionStream.cpp