| # Gaudi Framework, version v21r11 |

Home |  | Generated: 30 Sep 2010

# TagCollectionSvc Class Reference

Gaudi tag collection service definition. More...

`#include <TagCollectionSvc.h>`

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

List of all members.

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

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

M.Frank 1.0

Definition at line 26 of file TagCollectionSvc.h.

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

Initialize the service.

Reimplemented from NTupleSvc.

Definition at line 57 of file TagCollectionSvc.cpp.

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

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

DataSvc overrides: stop the service.

Finalize the service.

Reimplemented from NTupleSvc.

Definition at line 63 of file TagCollectionSvc.cpp.

    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.

    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.

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

## 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_v21r11/GaudiSvc/src/NTupleSvc/TagCollectionSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r11/GaudiSvc/src/NTupleSvc/TagCollectionSvc.cpp