The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
Converter.cpp
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
20
22const CLID& Converter::objType() const { return m_classType; }
23
25long Converter::i_repSvcType() const { return m_storageType; }
26
29
32
35
38
41
44
47
50
53 // Get a reference to the Message Service
54 if ( !msgSvc() ) { return StatusCode::FAILURE; }
56}
57
60 // release services
61 m_messageSvc = nullptr;
62 m_dataManager = nullptr;
63 m_dataProvider = nullptr;
64 m_conversionSvc = nullptr;
65 m_addressCreator = nullptr;
67}
68
75
78
81
87
90
96
99
102
105 if ( !m_messageSvc ) {
107 if ( !m_messageSvc ) { throw GaudiException( "Service [MessageSvc] not found", "Converter", StatusCode::FAILURE ); }
108 }
109 return m_messageSvc;
110}
111
113Converter::Converter( long storage_type, const CLID& class_type, ISvcLocator* svc )
114 : m_storageType( storage_type ), m_classType( class_type ), m_svcLocator( svc ) {}
115
116SmartIF<IService> Converter::service( const std::string& name, const bool createIf ) const {
119 if ( cnvsvc ) {
120 const ServiceLocatorHelper helper( *serviceLocator(), "Converter", cnvsvc->name() );
121 svc = helper.service( name, false, createIf );
122 }
123 return svc;
124}
unsigned int CLID
Class ID definition.
Definition ClassID.h:16
StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Resolve the references of the converted object.
Definition Converter.cpp:43
StatusCode setAddressCreator(IAddressCreator *creator) override
Set address creator facility.
Definition Converter.cpp:92
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition Converter.h:112
StatusCode initialize() override
Initialize the converter.
Definition Converter.cpp:52
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
const CLID m_classType
Class type the converter can handle.
Definition Converter.h:110
StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Update the references of an already converted object.
Definition Converter.cpp:49
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
SmartIF< IDataManagerSvc > & dataManager() const
Get Data Manager service.
Definition Converter.cpp:80
SmartIF< IDataProviderSvc > m_dataProvider
Pointer to data provider service.
Definition Converter.h:114
SmartIF< IDataProviderSvc > & dataProvider() const override
Get Data provider service.
Definition Converter.cpp:77
StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject) override
Update the transient object from the other representation.
Definition Converter.cpp:34
SmartIF< IConversionSvc > & conversionSvc() const override
Get conversion service the converter is connected to.
Definition Converter.cpp:89
StatusCode finalize() override
Initialize the converter.
Definition Converter.cpp:59
SmartIF< IConversionSvc > m_conversionSvc
Pointer to the connected conversion service.
Definition Converter.h:118
StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Update the references of an updated transient object.
Definition Converter.cpp:37
StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject) override
Create the transient representation of an object.
Definition Converter.cpp:28
StatusCode setDataProvider(IDataProviderSvc *svc) override
Set Data provider service.
Definition Converter.cpp:70
const CLID & objType() const override
Retrieve the class type of objects the converter produces.
Definition Converter.cpp:22
SmartIF< IMessageSvc > m_messageSvc
MessageSvc reference.
Definition Converter.h:122
StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject) override
Update the converted representation of a transient object.
Definition Converter.cpp:46
SmartIF< IService > service(const std::string &name, const bool createIf=true) const
Return a pointer to the service identified by name (or "type/name")
StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress) override
Convert the transient object to the requested representation.
Definition Converter.cpp:40
Converter(long storage_type, const CLID &class_type, ISvcLocator *svc=0)
Standard Constructor.
SmartIF< ISvcLocator > m_svcLocator
Service Locator reference.
Definition Converter.h:120
long m_storageType
Storage type.
Definition Converter.h:108
SmartIF< IDataManagerSvc > m_dataManager
Pointer to data manager service.
Definition Converter.h:116
StatusCode setConversionSvc(IConversionSvc *svc) override
Set conversion service the converter is connected to.
Definition Converter.cpp:83
virtual long i_repSvcType() const
Retrieve the class type of the data store the converter uses.
Definition Converter.cpp:25
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
Definition Converter.cpp:98
StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Resolve the references of the created transient object.
Definition Converter.cpp:31
A DataObject is the base class of any identifiable object on any data store.
Definition DataObject.h:37
Define general base for Gaudi exception.
IAddressCreator interface definition.
Data provider interface definition.
Opaque address interface definition.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
an helper to share the implementation of service() among the various kernel base classes
SmartIF< IService > service(std::string_view name, const bool quiet=false, const bool createIf=true) const
Small smart pointer class with automatic reference counting for IInterface.
Definition SmartIF.h:28
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
constexpr static const auto SUCCESS
Definition StatusCode.h:99
constexpr static const auto FAILURE
Definition StatusCode.h:100