Gaudi Framework, version v21r9

Home   Generated: 3 May 2010

InputCopyStream Class Reference

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

#include <InputCopyStream.h>

Inheritance diagram for InputCopyStream:

Inheritance graph
[legend]
Collaboration diagram for InputCopyStream:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 InputCopyStream (const std::string &name, ISvcLocator *pSvcLocator)
 Standard algorithm Constructor.
virtual ~InputCopyStream ()
 Standard Destructor.
virtual StatusCode collectLeaves (IRegistry *dir, int level)
 Collect leaves from input file.
virtual StatusCode collectObjects ()
 Collect all objects to be written tio the output stream.

Private Attributes

bool m_takeOptionalFromTES
 Allow optional items to be on TES instead of input file.

Friends

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


Detailed Description

A small to stream Data I/O.

Author: M.Frank Version: 1.0

Definition at line 13 of file InputCopyStream.h.


Constructor & Destructor Documentation

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

Standard algorithm Constructor.

Definition at line 20 of file InputCopyStream.cpp.

00021  : OutputStream(name, pSvcLocator)
00022 {
00023   m_doPreLoad      = false;
00024   m_doPreLoadOpt   = false;
00025   m_itemNames.push_back("/Event#99999");
00026   declareProperty("TakeOptionalFromTES", m_takeOptionalFromTES = false, 
00027                   "Allow optional items to be on TES instead of input file") ;
00028 }

InputCopyStream::~InputCopyStream (  )  [virtual]

Standard Destructor.

Definition at line 31 of file InputCopyStream.cpp.

00031                                     {
00032 }


Member Function Documentation

StatusCode InputCopyStream::collectLeaves ( IRegistry dir,
int  level 
) [virtual]

Collect leaves from input file.

Definition at line 35 of file InputCopyStream.cpp.

00035                                                                       {
00036   MsgStream log(msgSvc(), name());
00037   if ( level < m_currentItem->depth() )   {
00038     if ( dir )  {
00039       // dir->object != 0, because was retrived in previous recursion
00040       m_objects.push_back(dir->object());
00041       if ( dir->address() )  {
00042         std::vector<IRegistry*> lfs;
00043         const std::string& dbase = dir->address()->par()[0];
00044         // Cololect all pending leaves
00045         StatusCode iret, sc = m_pDataManager->objectLeaves(dir,lfs);
00046         if ( sc.isSuccess() )  {
00047           std::vector<IRegistry*>::iterator i=lfs.begin();
00048           for(; i!=lfs.end(); ++i)  {
00049             // Continue if the leaf has the same database as the parent
00050             if ( (*i)->address() && (*i)->address()->par()[0] == dbase )  {
00051               DataObject* obj = 0;
00052               iret = m_pDataProvider->retrieveObject(dir, (*i)->name(), obj);
00053               if (  iret.isSuccess() )  {
00054                 log << MSG::VERBOSE << "::collectLeaves Success retrieving " << (*i)->name() << endmsg ;
00055                 iret = collectLeaves(*i, level+1);
00056               }
00057               if ( !iret.isSuccess() )  {
00058                 log << MSG::VERBOSE << "::collectLeaves Failure retrieving " << (*i)->name() << endmsg ;
00059                 sc = iret;
00060               }
00061             }
00062           }
00063         }
00064         return sc;
00065       }
00066     }
00067     return StatusCode::FAILURE;
00068   }
00069   return StatusCode::SUCCESS;
00070 }

StatusCode InputCopyStream::collectObjects (  )  [virtual]

Collect all objects to be written tio the output stream.

Reimplemented from OutputStream.

Definition at line 73 of file InputCopyStream.cpp.

00073                                              {
00074   MsgStream log(msgSvc(), name());
00075   StatusCode status = StatusCode::SUCCESS;
00076   Items::iterator i;
00077   // Traverse the tree and collect the requested objects
00078   for ( i = m_itemList.begin(); i != m_itemList.end(); i++ )    {
00079     DataObject* obj = 0;
00080     m_currentItem = (*i);
00081     log << MSG::VERBOSE << "::collectObjects Looping over mandatory " << m_currentItem->path() << endmsg ;
00082     StatusCode iret = m_pDataProvider->retrieveObject(m_currentItem->path(), obj);
00083     if ( iret.isSuccess() )  {
00084       log << MSG::VERBOSE << "::collectObjects Success retrieving mandatory " << (*i)->path() << endmsg ;
00085       iret = collectLeaves(obj->registry(), 0);
00086     }
00087     if ( !iret.isSuccess() )  {
00088       log << MSG::ERROR << "Cannot write mandatory object(s) (Not found) "
00089           << m_currentItem->path() << endmsg;
00090       status = iret;
00091     }
00092   }
00093   // Traverse the tree and collect the requested objects (tolerate missing itmes here)
00094   for ( i = m_optItemList.begin(); i != m_optItemList.end(); i++ )    {
00095     DataObject* obj = 0;
00096     m_currentItem = (*i);
00097     StatusCode iret = m_pDataProvider->retrieveObject(m_currentItem->path(), obj);
00098     if ( iret.isSuccess() )  {
00099       log << MSG::VERBOSE << "::collectObjects Success retrieving optional " << (*i)->path() << endmsg ;
00100       if ( m_takeOptionalFromTES ){ // look into TES
00101         iret = m_pDataManager->traverseSubTree(obj, m_agent);      
00102       } else { // look only at DST
00103         iret = collectLeaves(obj->registry(), 0);
00104       }
00105     }
00106     if ( !iret.isSuccess() )    {
00107       log << MSG::DEBUG << "Ignore request to write non-mandatory object(s) "
00108           << m_currentItem->path() << endmsg;
00109     }
00110   }
00111   return status;
00112 }


Friends And Related Function Documentation

friend class AlgFactory< InputCopyStream > [friend]

Definition at line 14 of file InputCopyStream.h.

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

Definition at line 15 of file InputCopyStream.h.


Member Data Documentation

Allow optional items to be on TES instead of input file.

Definition at line 29 of file InputCopyStream.h.


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

Generated at Mon May 3 12:25:14 2010 for Gaudi Framework, version v21r9 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004