Go to the documentation of this file.
11 #define GAUDIKERNEL_CONVERSIONSVC_CPP
24 auto CnvTest = [](
CLID clid ) {
return [clid](
const auto& i ) {
return i.clID() == clid; }; };
40 if ( !pAddress && !ignore_add )
return Status::INVALID_ADDRESS;
41 if ( !pObject && !ignore_obj )
return Status::INVALID_OBJECT;
42 const CLID& obj_class = ( pObject && !ignore_obj ) ? pObject->
clID()
43 : ( pAddress && !ignore_add ) ? pAddress->
clID()
46 if ( !cnv && pObject ) {
57 status = cnv->
createObj( pAddress, pObject );
63 status = cnv->
updateObj( pAddress, pObject );
70 status = cnv->
createRep( pObject, pAddress );
76 status = cnv->
updateRep( pAddress, pObject );
89 info() <<
"No converter for object ";
91 msgStream() <<
" CLID= " << obj_class <<
endmsg;
92 return Status::NO_CONVERTER;
143 if ( i !=
m_workers.end() ) cnv = i->converter();
148 if ( i !=
m_workers.end() ) cnv = i->converter();
172 auto* cnv = i.converter();
174 if ( cnv->setAddressCreator(
m_addressCreator ).isFailure() ) { error() <<
"setting Address Creator" <<
endmsg; }
203 typ = ( typ < 0xFF ) ? typ : typ & 0xFFFFFF00;
204 conv_typ = ( conv_typ < 0xFF ) ? conv_typ : conv_typ & 0xFFFFFF00;
205 if ( conv_typ == typ && conv_clid == clid ) {
return addConverter( pConverter ); }
211 return Status::NO_CONVERTER;
219 m_workers.emplace_back( clid, pConverter );
222 return Status::NO_CONVERTER;
229 [f = CnvTest( clid )](
const WorkerEntry& we ) {
return !f( we ); } );
243 if ( i.converter()->finalize().isFailure() ) { error() <<
"finalizing worker" <<
endmsg; }
257 typ = ( typ < 0xFF ) ? typ : typ & 0xFFFFFF00;
265 if ( !pConverter )
return Status::NO_CONVERTER;
274 return pConverter ? pConverter->
initialize() : Status::NO_CONVERTER;
302 refpAddress =
nullptr;
315 refpAddress =
nullptr;
StatusCode addConverter(const CLID &clid) override
Add converter object to conversion service.
StatusCode initialize() override
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
const CLID & objType() const override
Implementation of IConverter: dummy call.
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.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
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)
ConversionSvc(const std::string &name, ISvcLocator *svc, long type)
Standard Constructor.
virtual StatusCode setConversionSvc(IConversionSvc *pService)=0
Set conversion service the converter is connected to.
get
decorate the vector of properties
StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject) override
Implementation of IConverter: Create the transient representation of an object.
IConverter * converter(const CLID &wanted) override
Retrieve converter from list.
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
virtual StatusCode activateConverter(long typ, const CLID &clid, IConverter *cnv)
Activate the new converter after initialization.
virtual void loadConverter(DataObject *pObject)
Load converter or dictionary needed by the converter.
StatusCode finalize() override
StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Resolve the references of the created transient object.
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the references of an updated transient object.
virtual StatusCode updateServiceState(IOpaqueAddress *pAddress)
Update state of the service.
StatusCode removeConverter(const CLID &clid) override
Remove converter object from conversion service (if present).
StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress) override
Convert an address to string form.
SmartIF< IConversionSvc > & conversionSvc() const override
Implementation of IConverter: Get conversion service the converter is connected to.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
StatusCode connectOutput(const std::string &outputFile, const std::string &openMode) override
Connect the output file to the service with open mode.
StatusCode setConversionSvc(IConversionSvc *svc) override
Implementation of IConverter: Set conversion service the converter is connected to.
virtual StatusCode setAddressCreator(IAddressCreator *creator)=0
Set address creator facility.
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
virtual const CLID & clID() const =0
Retrieve class information from link.
StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject) override
Implementation of IConverter: Update the transient object from the other representation.
long m_type
Conversion service type.
unsigned int CLID
Class ID definition.
StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the converted representation of a transient object.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the references of an already converted object.
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
SmartIF< IConversionSvc > m_cnvSvc
Pointer to the IConversionSvc interface of this.
StatusCode setDataProvider(IDataProviderSvc *pService) override
Implementation of IConverter: Set Data provider service.
constexpr static const auto SUCCESS
StatusCode initialize() override
Initialize the service.
virtual IConverter * createConverter(long typ, const CLID &clid, const ICnvFactory *fac)
Create new Converter using factory.
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
StatusCode finalize() override
stop the service.
StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Resolve the references of the converted object.
StatusCode commitOutput(const std::string &output, bool do_commit) override
Commit pending output.
StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress) override
Implementation of IConverter: Convert the transient object to the requested representation.
virtual StatusCode initialize()=0
Initialize the converter.
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
virtual const CLID & objType() const =0
Retrieve the class type of objects the converter produces.
constexpr static const auto FAILURE
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
virtual StatusCode initializeConverter(long typ, const CLID &clid, IConverter *cnv)
Initialize the new converter.
StatusCode setAddressCreator(IAddressCreator *creator) override
Set address creator facility.
virtual unsigned long release()=0
Release Interface instance.
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to data provider service.
virtual const CLID & clID() const
Retrieve reference to class definition structure.
long repSvcType() const override
Retrieve the class type of the data store the converter uses.
SmartIF< IDataProviderSvc > & dataProvider() const override
Implementation of IConverter: Get Data provider service.
std::vector< WorkerEntry > m_workers
List of conversion workers.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator