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

# TagCollectionSvc Class Reference

`#include <TagCollectionSvc.h>`

Inheritance diagram for TagCollectionSvc:

[legend]
Collaboration diagram for TagCollectionSvc:

[legend]
List of all members.

## Detailed Description

Gaudi tag collection service definition.

Description: See the base class definition files for more detailed documentation of the implementing class. The basic functionality of the implementation is enhanced to allow for more general N-tuples, which can be used also as event tag collections.

Author:
  M.Frank

Version:
  1.0

Definition at line 26 of file TagCollectionSvc.h.

## Public Member Functions
virtual StatusCode | initialize ()
| DataSvc overrides: Initialize the service.
virtual StatusCode | finalize ()
| DataSvc overrides: stop the service.
| TagCollectionSvc (const std::string &name, ISvcLocator *svc)
| Standard Constructor.
virtual | ~TagCollectionSvc ()
| Standard Destructor.
## Protected Member Functions
virtual StatusCode | connect (const std::string &ident, std::string &logname)
| Add file to list I/O list.
virtual StatusCode | createService (const std::string &nam, const std::string &typ, const std::vector< Prop > &props, IConversionSvc *&pSvc)
| Create conversion service.
## Friends
class | SvcFactory< TagCollectionSvc >

## Constructor & Destructor Documentation

TagCollectionSvc::TagCollectionSvc | ( | const std::string & | name,
|  | ISvcLocator * | svc |
| ) |  |  |

Standard Constructor.

Definition at line 47 of file TagCollectionSvc.cpp.

    00048  : NTupleSvc(name, svc)
    00049 {
    00050 }

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

Standard Destructor.

Definition at line 53 of file TagCollectionSvc.cpp.

    00053                                       {
    00054 }

## Member Function Documentation

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

DataSvc overrides: Initialize the service.

Reimplemented from NTupleSvc.

Definition at line 57 of file TagCollectionSvc.cpp.

References NTupleSvc::initialize().

    00057                                             {
    00058   StatusCode status = NTupleSvc::initialize();
    00059   return status;
    00060 }

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

DataSvc overrides: stop the service.

Reimplemented from NTupleSvc.

Definition at line 63 of file TagCollectionSvc.cpp.

References NTupleSvc::finalize().

    00063                                           {
    00064   StatusCode status = NTupleSvc::finalize();
    00065   return status;
    00066 }

StatusCode TagCollectionSvc::connect | ( | const std::string & | ident,
|  | std::string & | logname |
| ) |  |  | `[protected, virtual]`

Add file to list I/O list.

Reimplemented from NTupleSvc.

Definition at line 69 of file TagCollectionSvc.cpp.

References Tokenizer::analyse(), NTupleSvc::attachTuple(), createService(), endmsg(), MSG::ERROR, StatusCode::FAILURE, std::basic_string< _CharT, _Traits, _Alloc >::find(), DataSvc::findObject(), IDataProviderSvc::INVALID_ROOT, StatusCode::isSuccess(), Tokenizer::items(), std::basic_string< _CharT, _Traits, _Alloc >::length(), NTupleSvc::m_connections, DataSvc::m_rootName, Service::msgSvc(), Service::name(), std::vector< _Tp, _Alloc >::push_back(), DataObject::registry(), IConverter::repSvcType(), std::basic_string< _CharT, _Traits, _Alloc >::substr(), StatusCode::SUCCESS, and toupper().

    00069                                                                                   {
    00070   MsgStream log ( msgSvc(), name() );
    00071   DataObject* pO = 0;
    00072   StatusCode status = findObject(m_rootName, pO);
    00073   if ( status.isSuccess() )   {
    00074     status = INVALID_ROOT;
    00075     if ( 0 != pO->registry() )   {
    00076       char typ=0;
    00077       Tokenizer tok(true);
    00078       std::vector<Prop> props;
    00079       long loc = ident.find(" ");
    00080       std::string filename, auth, svc = "DbCnvSvc";
    00081       logname = ident.substr(0,loc);
    00082       tok.analyse(ident.substr(loc+1,ident.length()), " ", "", "", "=", "'", "'");
    00083       for ( Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); i++)    {
    00084         const std::string& tag = (*i).tag();
    00085         switch( ::toupper(tag[0]) )   {
    00086         case 'A':
    00087           props.push_back( Prop("Server", (*i).value()));
    00088           break;
    00089         case 'F': /* FILE='<file name>' */
    00090         case 'D': /* DATAFILE='<file name>' */
    00091           filename = (*i).value();
    00092           break;
    00093         case 'O': /* OPT='<NEW<CREATE,WRITE>, UPDATE, READ>' */
    00094           switch( ::toupper((*i).value()[0]) )   {
    00095           case 'C':
    00096           case 'N':
    00097           case 'W':                   typ = 'N';            break;
    00098           case 'U':                   typ = 'U';            break;
    00099           case 'O':
    00100           case 'R':
    00101             switch( ::toupper((*i).value()[2]) )   {
    00102             case 'C': /* RECREATE */  typ = 'R';            break;
    00103             case 'A': /* READ     */
    00104             default:                  typ = 'O';            break;
    00105             }
    00106             break;
    00107           default:                    typ = 0;              break;
    00108           }
    00109           break;
    00110         case 'S':   // SVC='<service type>'
    00111           switch( ::toupper(tag[1]) )   {
    00112           case 'V':                   svc = (*i).value();   break;
    00113           case 'H':
    00114             switch(::toupper((*i).value()[0]))  {
    00115               case 'Y':
    00116                props.push_back( Prop("ShareFiles", (*i).value()));
    00117             }
    00118             break;
    00119           }
    00120           break;
    00121         case 'T':   // TYP='<HBOOK,ROOT,OBJY,...>'
    00122           switch(::toupper((*i).value()[0]))  {
    00123           case 'H':
    00124             svc = "HbookCnv::ConvSvc";
    00125             break;
    00126           case 'P':
    00127             props.push_back( Prop("DbType", (*i).value()));
    00128             svc = "PoolDbCnvSvc";
    00129             break;
    00130           default:
    00131             props.push_back( Prop("DbType", (*i).value()));
    00132             svc = "DbCnvSvc";
    00133             break;
    00134           }
    00135           break;
    00136         default:
    00137           props.push_back( Prop((*i).tag(), (*i).value()));
    00138           break;
    00139         }
    00140       }
    00141       if ( 0 != typ )    {
    00142         IConversionSvc* pSvc = 0;
    00143         status = createService(name()+'.'+logname, svc, props, pSvc);
    00144         if ( status.isSuccess() )   {
    00145           status = attachTuple(filename,logname,typ,pSvc->repSvcType());
    00146           if ( status.isSuccess() )    {
    00147             m_connections.insert(Connections::value_type(m_rootName+'/'+logname,Connection(pSvc)));
    00148             return StatusCode::SUCCESS;
    00149           }
    00150         }
    00151       }
    00152     }
    00153   }
    00154   log << MSG::ERROR << "Cannot add " << ident << " invalid filename!" << endmsg;
    00155   return StatusCode::FAILURE;
    00156 }

StatusCode TagCollectionSvc::createService | ( | const std::string & | nam,
|  | const std::string & | typ,
|  | const std::vector< Prop > & | props,
|  | IConversionSvc *& | pSvc |
| ) |  |  | `[protected, virtual]`

Create conversion service.

Parameters:

  | nam | Name of the service to be created
  | svc | Service type if sepecified in the options
  | props |

Reimplemented from NTupleSvc.

Definition at line 159 of file TagCollectionSvc.cpp.

References std::vector< _Tp, _Alloc >::begin(), std::vector< _Tp, _Alloc >::end(), IID_IConversionSvc, IID_IProperty, IID_ISvcManager, StatusCode::isSuccess(), SmartIFBase< TYPE >::isValid(), IInterface::NO_INTERFACE, and Service::serviceLocator().

Referenced by connect().

    00162                                                                       {
    00163   SmartIF<ISvcManager> mgr(IID_ISvcManager, serviceLocator());
    00164
    00165   // FIXME: (MCl) why TagCollectionSvc has to directly create a ConversionSvc?
    00166   StatusCode status = NO_INTERFACE;
    00167   if ( mgr.isValid( ) )    {
    00168     IService* isvc = 0;
    00169     status = mgr->createService(typ, nam, isvc);
    00170     if ( status.isSuccess() )   {
    00171       status = isvc->queryInterface(IID_IConversionSvc, (void**)&pSvc);
    00172       if ( status.isSuccess() )     {
    00173         SmartIF<IProperty> iprop(IID_IProperty,isvc);
    00174         status = NO_INTERFACE;
    00175         if ( iprop.isValid( ) )    {
    00176           for ( std::vector<Prop>::const_iterator j = props.begin(); j != props.end(); j++)   {
    00177             iprop->setProperty(StringProperty((*j).first, (*j).second)).ignore();
    00178           }
    00179           // FIXME: (MCl) why NTupleSvc has to directly create a ConversionSvc?
    00180           status = isvc->sysInitialize();
    00181           if ( status.isSuccess() )   {
    00182             status = pSvc->setDataProvider(this);
    00183             if ( status.isSuccess() )   {
    00184               isvc->release();
    00185               return status;
    00186             }
    00187           }
    00188         }
    00189         pSvc->release();
    00190       }
    00191       isvc->release();
    00192     }
    00193   }
    00194   pSvc = 0;
    00195   return status;
    00196 }

## Friends And Related Function Documentation

friend class SvcFactory< TagCollectionSvc >`[friend]`

Definition at line 28 of file TagCollectionSvc.h.

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

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