1 #define GAUDIKERNEL_CONVERSIONSVC_CPP 15 auto CnvTest = [](
CLID clid ) {
return [clid](
const auto& i ) {
return i.clID() == clid; }; };
32 if ( !pAddress && !ignore_add )
return Status::INVALID_ADDRESS;
33 if ( !pObject && !ignore_obj )
return Status::INVALID_OBJECT;
34 const CLID& obj_class =
35 ( pObject && !ignore_obj ) ? pObject->
clID() : ( pAddress && !ignore_add ) ? pAddress->
clID() : CLID_NULL;
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 );
82 info() <<
"No converter for object ";
87 return Status::NO_CONVERTER;
147 if ( i !=
m_workers.end() ) cnv = i->converter();
152 if ( i !=
m_workers.end() ) cnv = i->converter();
180 auto* cnv = i.converter();
214 typ = ( typ < 0xFF ) ? typ : typ & 0xFFFFFF00;
215 conv_typ = ( conv_typ < 0xFF ) ? conv_typ : conv_typ & 0xFFFFFF00;
216 if ( conv_typ == typ && conv_clid == clid ) {
224 return Status::NO_CONVERTER;
233 m_workers.emplace_back( clid, pConverter );
236 return Status::NO_CONVERTER;
244 [f = CnvTest( clid )](
const WorkerEntry& we ) {
return !f( we ); } );
259 if ( i.converter()->finalize().isFailure() ) {
276 typ = ( typ < 0xFF ) ? typ : typ & 0xFFFFFF00;
285 if ( !pConverter )
return Status::NO_CONVERTER;
295 return pConverter ? pConverter->
initialize() : Status::NO_CONVERTER;
327 refpAddress =
nullptr;
342 refpAddress =
nullptr;
constexpr static const auto FAILURE
StatusCode initialize() override
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
virtual StatusCode configureConverter(long typ, const CLID &clid, IConverter *cnv)
Configure the new converter before initialize is called.
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...
The data converters are responsible to translate data from one representation into another...
virtual const CLID & clID() const =0
Retrieve class information from link.
const std::string & name() const override
Retrieve name of the service.
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
StatusCode finalize() override
StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the references of an updated transient object.
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
virtual const CLID & objType() const =0
Retrieve the class type of objects the converter produces.
StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the converted representation of a transient object.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
ConversionSvc(const std::string &name, ISvcLocator *svc, long type)
Standard Constructor.
StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress) override
Implementation of IConverter: Convert the transient object to the requested representation.
IAddressCreator interface definition.
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the references of an already converted object.
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
Data provider interface definition.
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
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 setConversionSvc(IConversionSvc *pService)=0
Set conversion service the converter is connected to.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
IConverter * converter(const CLID &wanted) override
Retrieve converter from list.
virtual const CLID & clID() const
Retrieve reference to class definition structure.
StatusCode removeConverter(const CLID &clid) override
Remove converter object from conversion service (if present).
StatusCode setAddressCreator(IAddressCreator *creator) override
Set address creator facility.
This class is used for returning status codes from appropriate routines.
void clear(STATE_TYPE _i=std::ios_base::failbit)
SmartIF< IDataProviderSvc > & dataProvider() const override
Implementation of IConverter: Get Data provider service.
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Resolve the references of the converted object.
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress) override
Create a Generic address using explicit arguments to identify a single object.
unsigned int CLID
Class ID definition.
virtual StatusCode initialize()=0
Initialize the converter.
constexpr static const auto SUCCESS
StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress) override
Convert an address to string form.
virtual StatusCode updateServiceState(IOpaqueAddress *pAddress)
Update state of the service.
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to data provider service.
StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject) override
Implementation of IConverter: Create the transient representation of an object.
virtual StatusCode setAddressCreator(IAddressCreator *creator)=0
Set address creator facility.
StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Resolve the references of the created transient object.
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.
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
const StatusCode & ignore() const
Ignore/check StatusCode.
SmartIF< IConversionSvc > m_cnvSvc
Pointer to the IConversionSvc interface of this.
StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject) override
Implementation of IConverter: Update the transient object from the other representation.
StatusCode setDataProvider(IDataProviderSvc *pService) override
Implementation of IConverter: Set Data provider service.
long m_type
Conversion service type.
MsgStream & msgStream() const
Return an uninitialized MsgStream.
long repSvcType() const override
Retrieve the class type of the data store the converter uses.
StatusCode commitOutput(const std::string &output, bool do_commit) override
Commit pending output.
virtual IConverter * createConverter(long typ, const CLID &clid, const ICnvFactory *fac)
Create new Converter using factory.
Opaque address interface definition.
StatusCode addConverter(const CLID &clid) override
Add converter object to conversion service.
std::vector< WorkerEntry > m_workers
List of conversion workers.
StatusCode setConversionSvc(IConversionSvc *svc) override
Implementation of IConverter: Set conversion service the converter is connected to.
A DataObject is the base class of any identifiable object on any data store.
StatusCode finalize() override
stop the service.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
virtual StatusCode activateConverter(long typ, const CLID &clid, IConverter *cnv)
Activate the new converter after initialization.
const CLID & objType() const override
Implementation of IConverter: dummy call.
StatusCode initialize() override
Initialize the service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode connectOutput(const std::string &outputFile, const std::string &openMode) override
Connect the output file to the service with open mode.
virtual StatusCode finalize()=0
Terminate the converter.
SmartIF< IConversionSvc > & conversionSvc() const override
Implementation of IConverter: Get conversion service the converter is connected to.