| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

Public Member Functions | Protected Member Functions | Friends

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

     : NTupleSvc(name, svc)
    {
    }

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

Standard Destructor.

Definition at line 53 of file TagCollectionSvc.cpp.

                                          {
    }

## Member Function Documentation

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.

                                                                                      {
      MsgStream log ( msgSvc(), name() );
      DataObject* pO = 0;
      StatusCode status = findObject(m_rootName, pO);
      if ( status.isSuccess() )   {
        status = INVALID_ROOT;
        if ( 0 != pO->registry() )   {
          char typ=0;
          Tokenizer tok(true);
          std::vector<Prop> props;
          long loc = ident.find(" ");
          std::string filename, auth, svc = "DbCnvSvc";
          logname = ident.substr(0,loc);
          tok.analyse(ident.substr(loc+1,ident.length()), " ", "", "", "=", "'", "'");
          for ( Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); i++)    {
            const std::string& tag = (*i).tag();
            switch( ::toupper(tag[0]) )   {
            case 'A':
              props.push_back( Prop("Server", (*i).value()));
              break;
            case 'F': /* FILE='<file name>' */
            case 'D': /* DATAFILE='<file name>' */
              filename = (*i).value();
              break;
            case 'O': /* OPT='<NEW<CREATE,WRITE>, UPDATE, READ>' */
              switch( ::toupper((*i).value()[0]) )   {
              case 'C':
              case 'N':
              case 'W':                   typ = 'N';            break;
              case 'U':                   typ = 'U';            break;
              case 'O':
              case 'R':
                switch( ::toupper((*i).value()[2]) )   {
                case 'C': /* RECREATE */  typ = 'R';            break;
                case 'A': /* READ     */
                default:                  typ = 'O';            break;
                }
                break;
              default:                    typ = 0;              break;
              }
              break;
            case 'S':   // SVC='<service type>'
              switch( ::toupper(tag[1]) )   {
              case 'V':                   svc = (*i).value();   break;
              case 'H':
                switch(::toupper((*i).value()[0]))  {
                  case 'Y':
                   props.push_back( Prop("ShareFiles", (*i).value()));
                   break ;
                }
                break;
              }
              break;
            case 'T':   // TYP='<HBOOK,ROOT,OBJY,...>'
              switch(::toupper((*i).value()[0]))  {
              case 'H':
                svc = "HbookCnv::ConvSvc";
                break;
              case 'P':
                props.push_back( Prop("DbType", (*i).value()));
                svc = "PoolDbCnvSvc";
                break;
              default:
                props.push_back( Prop("DbType", (*i).value()));
                svc = "DbCnvSvc";
                break;
              }
              break;
            default:
              props.push_back( Prop((*i).tag(), (*i).value()));
              break;
            }
          }
          if ( 0 != typ )    {
            IConversionSvc* pSvc = 0;
            status = createService(name()+'.'+logname, svc, props, pSvc);
            if ( status.isSuccess() )   {
              status = attachTuple(filename,logname,typ,pSvc->repSvcType());
              if ( status.isSuccess() )    {
                m_connections.insert(Connections::value_type(m_rootName+'/'+logname,Connection(pSvc)));
                return StatusCode::SUCCESS;
              }
            }
          }
        }
      }
      log << MSG::ERROR << "Cannot add " << ident << " invalid filename!" << endmsg;
      return StatusCode::FAILURE;
    }

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 160 of file TagCollectionSvc.cpp.

                                                                          {
      using Gaudi::Utils::TypeNameString;
      SmartIF<ISvcManager> mgr(serviceLocator());

      // TagCollectionSvc has to directly create a ConversionSvc to manage it directly.
      StatusCode status = NO_INTERFACE;
      if ( mgr.isValid() )    {

        SmartIF<IService> &isvc = mgr->createService(TypeNameString(nam, typ));
        if (isvc.isValid())   {
          status = isvc->queryInterface(IConversionSvc::interfaceID(), (void**)&pSvc);
          if ( status.isSuccess() )     {
            SmartIF<IProperty> iprop(isvc);
            status = NO_INTERFACE;
            if ( iprop.isValid( ) )    {
              for ( std::vector<Prop>::const_iterator j = props.begin(); j != props.end(); j++)   {
                iprop->setProperty(StringProperty((*j).first, (*j).second)).ignore();
              }
              // NTupleSvc has to directly create a ConversionSvc to manage it directly.
              status = isvc->sysInitialize();
              if ( status.isSuccess() )   {
                status = pSvc->setDataProvider(this);
                if ( status.isSuccess() )   {
                  return status;
                }
              }
            }
            pSvc->release();
          }
        }
      }
      pSvc = 0;
      return status;
    }

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

DataSvc overrides: stop the service.

Finalize the service.

Reimplemented from NTupleSvc.

Definition at line 63 of file TagCollectionSvc.cpp.

                                              {
      StatusCode status = NTupleSvc::finalize();
      return status;
    }

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

DataSvc overrides: Initialize the service.

Initialize the service.

Reimplemented from NTupleSvc.

Definition at line 57 of file TagCollectionSvc.cpp.

                                                {
      StatusCode status = NTupleSvc::initialize();
      return status;
    }

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines