| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# InputCopyStream Class Reference

`#include <InputCopyStream.h>`

Inheritance diagram for InputCopyStream:

[legend]
Collaboration diagram for InputCopyStream:

[legend]
List of all members.

## Detailed Description

A small to stream Data I/O.

Author: M.Frank Version: 1.0

Definition at line 13 of file InputCopyStream.h.

## 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.
## Friends
class | AlgFactory< InputCopyStream >
class | Factory< InputCopyStream, IAlgorithm *(std::string, ISvcLocator *)>

## Constructor & Destructor Documentation

InputCopyStream::InputCopyStream | ( | const std::string & | name,
|  | ISvcLocator * | pSvcLocator |
| ) |  |  |

Standard algorithm Constructor.

Definition at line 19 of file InputCopyStream.cpp.

    00020  : OutputStream(name, pSvcLocator)
    00021 {
    00022   m_doPreLoad      = false;
    00023   m_doPreLoadOpt   = false;
    00024   m_itemNames.push_back("/Event#99999");
    00025 }

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

Standard Destructor.

Definition at line 28 of file InputCopyStream.cpp.

    00028                                     {
    00029 }

## Member Function Documentation

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

Collect leaves from input file.

Definition at line 32 of file InputCopyStream.cpp.

References StatusCode::FAILURE, StatusCode::isSuccess(), OutputStream::m_objects, OutputStream::m_pDataManager, OutputStream::m_pDataProvider, IDataManagerSvc::objectLeaves(), IDataProviderSvc::retrieveObject(), and StatusCode::SUCCESS.

Referenced by collectObjects().

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

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

Collect all objects to be written tio the output stream.

Reimplemented from OutputStream.

Definition at line 67 of file InputCopyStream.cpp.

References std::vector< _Tp, _Alloc >::begin(), collectLeaves(), MSG::DEBUG, std::vector< _Tp, _Alloc >::end(), endmsg(), MSG::ERROR, StatusCode::isSuccess(), OutputStream::m_currentItem, OutputStream::m_itemList, OutputStream::m_optItemList, OutputStream::m_pDataProvider, Algorithm::msgSvc(), Algorithm::name(), DataStoreItem::path(), IDataProviderSvc::retrieveObject(), and StatusCode::SUCCESS.

    00067                                              {
    00068   MsgStream log(msgSvc(), name());
    00069   StatusCode status = StatusCode::SUCCESS;
    00070   Items::iterator i;
    00071   // Traverse the tree and collect the requested objects
    00072   for ( i = m_itemList.begin(); i != m_itemList.end(); i++ )    {
    00073     DataObject* obj = 0;
    00074     m_currentItem = (*i);
    00075     StatusCode iret = m_pDataProvider->retrieveObject(m_currentItem->path(), obj);
    00076     if ( iret.isSuccess() )  {
    00077       iret = collectLeaves(obj->registry(), 0);
    00078     }
    00079     if ( !iret.isSuccess() )  {
    00080       log << MSG::ERROR << "Cannot write mandatory object(s) (Not found) "
    00081           << m_currentItem->path() << endmsg;
    00082       status = iret;
    00083     }
    00084   }
    00085   // Traverse the tree and collect the requested objects (tolerate missing itmes here)
    00086   for ( i = m_optItemList.begin(); i != m_optItemList.end(); i++ )    {
    00087     DataObject* obj = 0;
    00088     m_currentItem = (*i);
    00089     StatusCode iret = m_pDataProvider->retrieveObject(m_currentItem->path(), obj);
    00090     if ( iret.isSuccess() )  {
    00091       iret = collectLeaves(obj->registry(), 0);
    00092     }
    00093     if ( !iret.isSuccess() )    {
    00094       log << MSG::DEBUG << "Ignore request to write non-mandatory object(s) "
    00095           << m_currentItem->path() << endmsg;
    00096     }
    00097   }
    00098   return status;
    00099 }

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

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiSvc/v17r1/src/PersistencySvc/InputCopyStream.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiSvc/v17r1/src/PersistencySvc/InputCopyStream.cpp