| # Gaudi Framework, version v20r4
Generated: 8 Jan 2009

# Converter Class Reference

`#include <GaudiKernel/Converter.h>`

Inheritance diagram for Converter:

[legend]
Collaboration diagram for Converter:

[legend]

List of all members.

## Detailed Description

Converter base class.

See interface for detailed description, arguments and return values

Author:
  Markus Frank

Version:
  1.0

Definition at line 25 of file Converter.h.

## Public Member Functions
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface)
| Query interfaces of Interface.
virtual unsigned long | addRef ()
| Reference Interface instance.
virtual unsigned long | release ()
| Release Interface instance.
virtual StatusCode | initialize ()
| Initialize the converter.
virtual StatusCode | finalize ()
| Initialize the converter.
virtual StatusCode | setDataProvider (IDataProviderSvc *svc)
| Set Data provider service.
virtual IDataProviderSvc * | dataProvider () const
| Get Data provider service.
virtual StatusCode | setConversionSvc (IConversionSvc *svc)
| Set conversion service the converter is connected to.
virtual IConversionSvc * | conversionSvc () const
| Get conversion service the converter is connected to.
virtual StatusCode | setAddressCreator (IAddressCreator *creator)
| Set address creator facility.
virtual IAddressCreator * | addressCreator () const
| Retrieve address creator facility.
virtual const CLID & | objType () const
| Retrieve the class type of objects the converter produces.
virtual long | i_repSvcType () const
| Retrieve the class type of the data store the converter uses.
virtual StatusCode | createObj (IOpaqueAddress *pAddress, DataObject *&refpObject)
| Create the transient representation of an object.
virtual StatusCode | fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Resolve the references of the created transient object.
virtual StatusCode | updateObj (IOpaqueAddress *pAddress, DataObject *refpObject)
| Update the transient object from the other representation.
virtual StatusCode | updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Update the references of an updated transient object.
virtual StatusCode | createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
| Convert the transient object to the requested representation.
virtual StatusCode | fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Resolve the references of the converted object.
virtual StatusCode | updateRep (IOpaqueAddress *pAddress, DataObject *pObject)
| Update the converted representation of a transient object.
virtual StatusCode | updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Update the references of an already converted object.
| Converter (long storage_type, const CLID &class_type, ISvcLocator *svc)
| Standard Constructor.
template<class T>
StatusCode | service (const std::string &name, T *&psvc, bool createIf=false) const
| Access a service by name, creating it if it doesn't already exist.
template<class T>
StatusCode | service (const std::string &type, const std::string &name, T *&psvc) const
| Access a service by name, type creating it if it doesn't already exist.
## Protected Member Functions
virtual | ~Converter ()
| Standard Destructor.
ISvcLocator * | serviceLocator () const
| Retrieve pointer to service locator.
IMessageSvc * | msgSvc () const
| Retrieve pointer to message service.
IMessageSvc * | messageService () const
IDataManagerSvc * | dataManager () const
| Get Data Manager service.
## Private Member Functions
StatusCode | service_i (const std::string &svcName, bool createIf, const InterfaceID &iid, void **ppSvc) const
| implementation of service method
StatusCode | service_i (const std::string &svcType, const std::string &svcName, const InterfaceID &iid, void **ppSvc) const
## Private Attributes
unsigned long | m_refCount
| Reference counter.
long | m_storageType
| Storage type.
const CLID | m_classType
| Class type the converter can handle.
IAddressCreator * | m_addressCreator
| Pointer to the address creation service interface.
IDataProviderSvc * | m_dataProvider
| Pointer to data provider service.
IDataManagerSvc * | m_dataManager
| Pointer to data manager service.
IConversionSvc * | m_conversionSvc
| Pointer to the connected conversion service.
ISvcLocator * | m_svcLocator
| Service Locator reference.
IMessageSvc * | m_messageSvc
| MessageSvc reference.

## Constructor & Destructor Documentation

Converter::Converter | ( | long | storage_type,
|  | const CLID & | class_type,
|  | ISvcLocator * | svc = `0` |
| ) |  |  |

Standard Constructor.

Definition at line 196 of file Converter.cpp.

    00196                                                                                   :
    00197   m_refCount(0),
    00198   m_storageType(storage_type),
    00199   m_classType(class_type),
    00200   m_dataProvider(0),
    00201   m_dataManager(0),
    00202   m_conversionSvc(0),
    00203   m_svcLocator(svc),
    00204   m_messageSvc(0)
    00205 {
    00206   if ( 0 != m_svcLocator ) m_svcLocator->addRef();
    00207 }

Converter::~Converter | ( |  | ) | `[protected, virtual]`

Standard Destructor.

Definition at line 210 of file Converter.cpp.

    00210                         {
    00211   if ( 0 != m_svcLocator ) m_svcLocator->release();
    00212 }

## Member Function Documentation

StatusCode Converter::queryInterface | ( | const InterfaceID & | riid,
|  | void ** | ppvInterface |
| ) |  |  | `[virtual]`

Query interfaces of Interface.

Implements IInterface.

Definition at line 30 of file Converter.cpp.

    00030                                                                                   {
    00031   if ( IID_IInterface.versionMatch(riid) )   {
    00032     *ppvInterface = (IInterface*)this;
    00033   }
    00034   else if ( IID_IConverter.versionMatch(riid) )  {
    00035     *ppvInterface = (IConverter*)this;
    00036   }
    00037   else   {
    00038      return NO_INTERFACE;
    00039   }
    00040   addRef();
    00041   return StatusCode::SUCCESS;
    00042 }

unsigned long Converter::addRef | ( |  | ) | `[virtual]`

Reference Interface instance.

Implements IInterface.

Definition at line 15 of file Converter.cpp.

    00015                                   {
    00016   m_refCount++;
    00017   return m_refCount;
    00018 }

unsigned long Converter::release | ( |  | ) | `[virtual]`

Release Interface instance.

Implements IInterface.

Definition at line 21 of file Converter.cpp.

    00021                                    {
    00022   long count = --m_refCount;
    00023   if ( count <= 0 ) {
    00024     delete this;
    00025   }
    00026   return count;
    00027 }

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

Initialize the converter.

Implements IConverter.

Reimplemented in PoolDbBaseCnv, HbookCnv::HFileCnv, HbookCnv::HNTupleCnv, and RootHistCnv::RNTupleCnv.

Definition at line 96 of file Converter.cpp.

    00096                                     {
    00097   StatusCode status = StatusCode::SUCCESS;
    00098   // Get a reference to the Message Service
    00099   status = serviceLocator()->service("MessageSvc",m_messageSvc, true );
    00100   if ( status.isFailure() )   {
    00101     return status;
    00102   }
    00103   return status;
    00104 }

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

Initialize the converter.

Finalize the converter.

Implements IConverter.

Reimplemented in PoolDbBaseCnv, HbookCnv::HNTupleCnv, and RootHistCnv::RNTupleCnv.

Definition at line 107 of file Converter.cpp.

    00107                                   {
    00108   if ( 0 != m_messageSvc )    {
    00109     m_messageSvc->release();
    00110     m_messageSvc = 0;
    00111   }
    00112   if ( 0 != m_dataManager )  {
    00113     m_dataManager->release();
    00114     m_dataManager = 0;
    00115   }
    00116   if ( 0 != m_dataProvider )  {
    00117     m_dataProvider->release();
    00118     m_dataProvider = 0;
    00119   }
    00120   return StatusCode::SUCCESS;
    00121 }

StatusCode Converter::setDataProvider | ( | IDataProviderSvc * | svc | ) | `[virtual]`

Set Data provider service.

Set data provider service.

Implements IConverter.

Definition at line 124 of file Converter.cpp.

    00124                                                             {
    00125   IDataManagerSvc* oldDataManager = m_dataManager;
    00126   IDataProviderSvc* oldDataProvider = m_dataProvider;
    00127   m_dataProvider = svc;
    00128   m_dataManager  = 0;
    00129   if ( 0 != m_dataProvider )  {
    00130     m_dataProvider->addRef();
    00131     svc->queryInterface(IDataManagerSvc::interfaceID(), pp_cast<void>(&m_dataManager)).ignore();
    00132   }
    00133   if ( oldDataManager )  {
    00134     oldDataManager->release();
    00135   }
    00136   if ( oldDataProvider )  {
    00137     oldDataProvider->release();
    00138   }
    00139   return StatusCode::SUCCESS;
    00140 }

IDataProviderSvc * Converter::dataProvider | ( |  | ) | const`[virtual]`

Get Data provider service.

Get data provider service.

Implements IConverter.

Definition at line 143 of file Converter.cpp.

    00143                                                     {
    00144   return m_dataProvider;
    00145 }

StatusCode Converter::setConversionSvc | ( | IConversionSvc * | svc | ) | `[virtual]`

Set conversion service the converter is connected to.

Implements IConverter.

Definition at line 153 of file Converter.cpp.

    00153                                                             {
    00154   m_conversionSvc = svc;
    00155   return StatusCode::SUCCESS;
    00156 }

IConversionSvc * Converter::conversionSvc | ( |  | ) | const`[virtual]`

Get conversion service the converter is connected to.

Get data conversion service the converter is connected to.

Implements IConverter.

Definition at line 159 of file Converter.cpp.

    00159                                                    {
    00160   return m_conversionSvc;
    00161 }

StatusCode Converter::setAddressCreator | ( | IAddressCreator * | creator | ) | `[virtual]`

Set address creator facility.

Implements IConverter.

Definition at line 164 of file Converter.cpp.

    00164                                                                   {
    00165   m_addressCreator = creator;
    00166   return StatusCode::SUCCESS;
    00167 }

IAddressCreator * Converter::addressCreator | ( |  | ) | const`[virtual]`

Retrieve address creator facility.

Access the transient store.

Implements IConverter.

Definition at line 170 of file Converter.cpp.

    00170                                                     {
    00171   return m_addressCreator;
    00172 }

const CLID & Converter::objType | ( |  | ) | const`[virtual]`

Retrieve the class type of objects the converter produces.

Implements IConverter.

Definition at line 45 of file Converter.cpp.

    00045                                         {
    00046   return m_classType;
    00047 }

long Converter::i_repSvcType | ( |  | ) | const`[virtual]`

Retrieve the class type of the data store the converter uses.

Definition at line 50 of file Converter.cpp.

    00050                                      {
    00051   return m_storageType;
    00052 }

StatusCode Converter::createObj | ( | IOpaqueAddress * | pAddress,
|  | DataObject *& | refpObject |
| ) |  |  | `[virtual]`

Create the transient representation of an object.

Implements IConverter.

Reimplemented in PoolDbBaseCnv, PoolDbDatabaseCnv, PoolDbDirectoryCnv, PoolDbNTupleCnv, HbookCnv::H1DCnv, HbookCnv::H2DCnv, HbookCnv::HDirectoryCnv, HbookCnv::HFileCnv, HbookCnv::HNTupleCnv, RootHistCnv::DirectoryCnv, RootHistCnv::RDirectoryCnv, RootHistCnv::RFileCnv, RootHistCnv::RHistogramCnv< T, S, Q >, and RootHistCnv::RNTupleCnv.

Definition at line 55 of file Converter.cpp.

    00055                                                                {
    00056   return StatusCode::SUCCESS;
    00057 }

StatusCode Converter::fillObjRefs | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject |
| ) |  |  | `[virtual]`

Resolve the references of the created transient object.

Implements IConverter.

Reimplemented in PoolDbBaseCnv, PoolDbDirectoryCnv, PoolDbNTupleCnv, HbookCnv::HDirectoryCnv, and RootHistCnv::RDirectoryCnv.

Definition at line 61 of file Converter.cpp.

    00061                                                                  {
    00062   return StatusCode::SUCCESS;
    00063 }

StatusCode Converter::updateObj | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | refpObject |
| ) |  |  | `[virtual]`

Update the transient object from the other representation.

Implements IConverter.

Reimplemented in PoolDbBaseCnv, PoolDbDirectoryCnv, PoolDbNTupleCnv, HbookCnv::H1DCnv, HbookCnv::H2DCnv, HbookCnv::HNTupleCnv, RootHistCnv::RHistogramCnv< T, S, Q >, and RootHistCnv::RNTupleCnv.

Definition at line 66 of file Converter.cpp.

    00066                                                               {
    00067   return StatusCode::SUCCESS;
    00068 }

StatusCode Converter::updateObjRefs | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject |
| ) |  |  | `[virtual]`

Update the references of an updated transient object.

Implements IConverter.

Reimplemented in PoolDbBaseCnv, PoolDbDirectoryCnv, PoolDbKeyedContainerCnv, and PoolDbNTupleCnv.

Definition at line 71 of file Converter.cpp.

    00071                                                                  {
    00072   return StatusCode::SUCCESS;
    00073 }

StatusCode Converter::createRep | ( | DataObject * | pObject,
|  | IOpaqueAddress *& | refpAddress |
| ) |  |  | `[virtual]`

Convert the transient object to the requested representation.

Implements IConverter.

Reimplemented in PoolDbBaseCnv, PoolDbDirectoryCnv, PoolDbNTupleCnv, HbookCnv::HConverter, HbookCnv::HDirectoryCnv, HbookCnv::HFileCnv, HbookCnv::HNTupleCnv, RootHistCnv::DirectoryCnv, RootHistCnv::RConverter, RootHistCnv::RDirectoryCnv, RootHistCnv::RFileCnv, and RootHistCnv::RNTupleCnv.

Definition at line 76 of file Converter.cpp.

    00076                                                               {
    00077   return StatusCode::SUCCESS;
    00078 }

StatusCode Converter::fillRepRefs | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject |
| ) |  |  | `[virtual]`

Resolve the references of the converted object.

Implements IConverter.

Reimplemented in PoolDbBaseCnv, and PoolDbNTupleCnv.

Definition at line 81 of file Converter.cpp.

    00081                                                                {
    00082   return StatusCode::SUCCESS;
    00083 }

StatusCode Converter::updateRep | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject |
| ) |  |  | `[virtual]`

Update the converted representation of a transient object.

Implements IConverter.

Reimplemented in PoolDbBaseCnv, PoolDbDirectoryCnv, PoolDbNTupleCnv, HbookCnv::H1DCnv, HbookCnv::H2DCnv, HbookCnv::HDirectoryCnv, HbookCnv::HFileCnv, HbookCnv::HNTupleCnv, RootHistCnv::RDirectoryCnv, RootHistCnv::RFileCnv, and RootHistCnv::RNTupleCnv.

Definition at line 86 of file Converter.cpp.

    00086                                                              {
    00087   return StatusCode::SUCCESS;
    00088 }

StatusCode Converter::updateRepRefs | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject |
| ) |  |  | `[virtual]`

Update the references of an already converted object.

Implements IConverter.

Reimplemented in PoolDbBaseCnv, PoolDbDirectoryCnv, and PoolDbNTupleCnv.

Definition at line 91 of file Converter.cpp.

    00091                                                                    {
    00092   return StatusCode::SUCCESS;
    00093 }

template<class T>

StatusCode Converter::service | ( | const std::string & | name,
|  | T *& | psvc,
|  | bool | createIf = `false` |
| ) |  |  | const`[inline]`

Access a service by name, creating it if it doesn't already exist.

Definition at line 98 of file Converter.h.

    00098                                                                                      {
    00099     return service_i(name, createIf, T::interfaceID(), (void**)&psvc);
    00100   }

template<class T>

StatusCode Converter::service | ( | const std::string & | type,
|  | const std::string & | name,
|  | T *& | psvc |
| ) |  |  | const`[inline]`

Access a service by name, type creating it if it doesn't already exist.

Definition at line 104 of file Converter.h.

    00104                                                                                     {
    00105     return service_i(type, name, T::interfaceID(), (void**)&psvc);
    00106   }

ISvcLocator * Converter::serviceLocator | ( |  | ) | const`[protected]`

Retrieve pointer to service locator.

--- Retrieve pointer to service locator

Definition at line 175 of file Converter.cpp.

    00175                                                   {
    00176   return m_svcLocator;
    00177 }

IMessageSvc * Converter::msgSvc | ( |  | ) | const`[protected]`

Retrieve pointer to message service.

--- Retrieve pointer to message service

Definition at line 180 of file Converter.cpp.

    00180                                         {
    00181   if ( 0 == m_messageSvc ) {
    00182     StatusCode sc = serviceLocator()->service( "MessageSvc", m_messageSvc, true );
    00183     if( sc.isFailure() ) {
    00184       throw GaudiException("Service [MessageSvc] not found", "Converter", sc);
    00185     }
    00186   }
    00187   return m_messageSvc;
    00188 }

IMessageSvc * Converter::messageService | ( |  | ) | const`[protected]`

Definition at line 191 of file Converter.cpp.

    00191                                                 {
    00192   return m_messageSvc;
    00193 }

IDataManagerSvc * Converter::dataManager | ( |  | ) | const`[protected]`

Get Data Manager service.

Get data manager service.

Definition at line 148 of file Converter.cpp.

    00148                                                   {
    00149   return m_dataManager;
    00150 }

StatusCode Converter::service_i | ( | const std::string & | svcName,
|  | bool | createIf,
|  | const InterfaceID & | iid,
|  | void ** | ppSvc |
| ) |  |  | const`[private]`

implementation of service method

Definition at line 215 of file Converter.cpp.

    00216                                                                  {
    00217   StatusCode sc(StatusCode::FAILURE);
    00218   // Check for name of conversion service
    00219   ConversionSvc* cnvsvc =
    00220     dynamic_cast<ConversionSvc*> (Converter::conversionSvc());
    00221   if( cnvsvc != 0 ) {
    00222     MsgStream log(msgSvc(),"Converter");
    00223     ServiceLocatorHelper helper(*serviceLocator(), log, cnvsvc->name());
    00224     sc = helper.getService(svcName, createIf, iid, ppSvc);
    00225   }
    00226   return sc;
    00227 }

StatusCode Converter::service_i | ( | const std::string & | svcType,
|  | const std::string & | svcName,
|  | const InterfaceID & | iid,
|  | void ** | ppSvc |
| ) |  |  | const`[private]`

Definition at line 230 of file Converter.cpp.

    00231                                                                  {
    00232   StatusCode sc(StatusCode::FAILURE);
    00233   // Check for name of conversion service
    00234   ConversionSvc* cnvsvc =
    00235     dynamic_cast<ConversionSvc*> (Converter::conversionSvc());
    00236   if( cnvsvc != 0 ) {
    00237     MsgStream log(msgSvc(),"Converter");
    00238     ServiceLocatorHelper helper(*serviceLocator(), log, cnvsvc->name());
    00239     sc = helper.createService(svcType, svcName, iid, ppSvc);
    00240   }
    00241   return sc;
    00242 }

## Member Data Documentation

unsigned long Converter::m_refCount`[private]`

Reference counter.

Definition at line 125 of file Converter.h.

long Converter::m_storageType`[private]`

Storage type.

Definition at line 127 of file Converter.h.

const CLID Converter::m_classType`[private]`

Class type the converter can handle.

Definition at line 129 of file Converter.h.

IAddressCreator* Converter::m_addressCreator`[private]`

Pointer to the address creation service interface.

Definition at line 131 of file Converter.h.

IDataProviderSvc* Converter::m_dataProvider`[private]`

Pointer to data provider service.

Definition at line 133 of file Converter.h.

IDataManagerSvc* Converter::m_dataManager`[private]`

Pointer to data manager service.

Definition at line 135 of file Converter.h.

IConversionSvc* Converter::m_conversionSvc`[private]`

Pointer to the connected conversion service.

Definition at line 137 of file Converter.h.

ISvcLocator* Converter::m_svcLocator`[private]`

Service Locator reference.

Definition at line 139 of file Converter.h.

IMessageSvc* Converter::m_messageSvc`[mutable, private]`

MessageSvc reference.

Definition at line 141 of file Converter.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r4/GaudiKernel/GaudiKernel/Converter.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r4/GaudiKernel/src/Lib/Converter.cpp