1 #define GAUDIKERNEL_CONVERSIONSVC_CPP
3 #include "GaudiKernel/MsgStream.h"
4 #include "GaudiKernel/DataObject.h"
5 #include "GaudiKernel/System.h"
6 #include "GaudiKernel/IConverter.h"
7 #include "GaudiKernel/IDataProviderSvc.h"
8 #include "GaudiKernel/IOpaqueAddress.h"
9 #include "GaudiKernel/ConversionSvc.h"
10 #include "GaudiKernel/Converter.h"
29 if ( pAddress || ignore_add ) {
30 if ( pObject || ignore_obj ) {
31 const CLID& obj_class =
32 ( pObject && !ignore_obj) ? pObject->
clID()
33 : ( pAddress && !ignore_add)
37 if ( !cnv && pObject ) {
48 status = cnv->
createObj(pAddress, pObject);
54 status = cnv->
updateObj(pAddress, pObject);
61 status = cnv->
createRep(pObject, pAddress);
67 status = cnv->
updateRep(pAddress, pObject);
83 log <<
MSG::INFO <<
"No converter for object ";
87 log <<
" CLID= " << obj_class <<
endmsg;
90 return INVALID_OBJECT;
92 return INVALID_ADDRESS;
148 cnv =
i->converter();
155 cnv =
i->converter();
185 auto* cnv =
i.converter();
225 typ = (typ<0xFF) ? typ : typ&0xFFFFFF00;
226 conv_typ = (conv_typ<0xFF) ? conv_typ : conv_typ&0xFFFFFF00;
227 if ( conv_typ == typ && conv_clid == clid ) {
243 m_workers.emplace_back(clid, pConverter);
275 if (
i.converter()->finalize().isFailure() ) {
278 i.converter()->release();
292 const ICnvFactory* ) {
295 typ = (typ<0xFF) ? typ : typ&0xFFFFFF00;
296 pConverter = Converter::Factory::create(
ConverterID(typ,clid), serviceLocator().
get());
305 if ( !pConverter )
return NO_CONVERTER;
340 const std::string& ) {
358 const unsigned long* ,
360 refpAddress =
nullptr;
366 std::string& refAddress)
378 refpAddress =
nullptr;
395 for (
auto &
i :
m_workers )
i.converter()->release();
virtual const CLID & objType() const =0
Retrieve the class type of objects the converter produces.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Implementation of IConverter: Convert the transient object to the requested representation.
virtual SmartIF< IConversionSvc > & conversionSvc() const
Implementation of IConverter: Get conversion service the converter is connected to.
Definition of the MsgStream class used to transmit messages.
StatusCode initialize() override
virtual StatusCode configureConverter(long typ, const CLID &clid, IConverter *cnv)
Configure the new converter before initialize is called.
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Implementation of IConverter: Resolve the references of the created transient object.
StatusCode makeCall(int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
virtual StatusCode commitOutput(const std::string &output, bool do_commit)
Commit pending output.
The data converters are responsible to translate data from one representation into another...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
const CLID & objType() const
Implementation of IConverter: dummy call.
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
StatusCode finalize() override
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Implementation of IConverter: Update the references of an already converted object.
ConversionSvc(const std::string &name, ISvcLocator *svc, long type)
Standard Constructor.
bool isSuccess() const
Test for a status code of SUCCESS.
auto begin(reverse_wrapper< T > &w)
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Implementation of IConverter: Resolve the references of the converted object.
virtual StatusCode addConverter(const CLID &clid)
Add converter object to conversion service.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
IAddressCreator interface definition.
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)
Implementation of IConverter: Update the transient object from the other representation.
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)
Implementation of IConverter: Update the converted representation of a transient object.
virtual StatusCode connectOutput(const std::string &outputFile, const std::string &openMode)
Connect the output file to the service with open mode.
virtual ~ConversionSvc()
Standard Destructor.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
Data provider interface definition.
std::vector< WorkerEntry > m_workers
List of conversion workers.
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
bool isFailure() const
Test for a status code of FAILURE.
virtual void loadConverter(DataObject *pObject)
Load converter or dictionary needed by the converter.
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
virtual StatusCode removeConverter(const CLID &clid)
Remove converter object from conversion service (if present).
virtual StatusCode setConversionSvc(IConversionSvc *pService)=0
Set conversion service the converter is connected to.
virtual StatusCode setConversionSvc(IConversionSvc *svc)
Implementation of IConverter: Set conversion service the converter is connected to.
virtual long repSvcType() const
Retrieve the class type of the data store the converter uses.
virtual const CLID & clID() const
Retrieve reference to class definition structure.
virtual StatusCode finalize()
stop the service.
virtual const CLID & clID() const =0
Retrieve class information from link.
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
auto end(reverse_wrapper< T > &w)
This class is used for returning status codes from appropriate routines.
SmartIF< IConversionSvc > m_cnvSvc
Pointer to the IConversionSvc interface of this.
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
virtual StatusCode setAddressCreator(IAddressCreator *creator)
Set address creator facility.
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
virtual StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress)
Convert an address to string form.
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)
Implementation of IConverter: Create the transient representation of an object.
virtual StatusCode initialize()=0
Initialize the converter.
virtual StatusCode updateServiceState(IOpaqueAddress *pAddress)
Update state of the service.
virtual StatusCode setAddressCreator(IAddressCreator *creator)=0
Set address creator facility.
virtual StatusCode initializeConverter(long typ, const CLID &clid, IConverter *cnv)
Initialize the new converter.
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
virtual unsigned long release()=0
Release Interface instance.
Base class used to extend a class implementing other interfaces.
long m_type
Conversion service type.
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
virtual StatusCode setDataProvider(IDataProviderSvc *pService)
Implementation of IConverter: Set Data provider service.
virtual IConverter * createConverter(long typ, const CLID &clid, const ICnvFactory *fac)
Create new Converter using factory.
virtual SmartIF< IAddressCreator > & addressCreator() const
Retrieve address creator facility.
virtual StatusCode initialize()
Initialize the service.
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
Create a Generic address using explicit arguments to identify a single object.
Opaque address interface definition.
unsigned int CLID
Class ID definition.
virtual IConverter * converter(const CLID &wanted)
Retrieve converter from list.
A DataObject is the base class of any identifiable object on any data store.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
virtual StatusCode activateConverter(long typ, const CLID &clid, IConverter *cnv)
Activate the new converter after initialization.
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to data provider service.
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Implementation of IConverter: Update the references of an updated transient object.
virtual StatusCode finalize()=0
Terminate the converter.
virtual SmartIF< IDataProviderSvc > & dataProvider() const
Implementation of IConverter: Get Data provider service.