1 #define GAUDIKERNEL_CONVERSIONSVC_CPP
3 #include "GaudiKernel/MsgStream.h"
4 #include "GaudiKernel/CnvFactory.h"
5 #include "GaudiKernel/DataObject.h"
6 #include "GaudiKernel/System.h"
7 #include "GaudiKernel/IConverter.h"
8 #include "GaudiKernel/IDataProviderSvc.h"
9 #include "GaudiKernel/IOpaqueAddress.h"
10 #include "GaudiKernel/ConversionSvc.h"
11 #include "GaudiKernel/Converter.h"
30 if ( 0 != pAddress || ignore_add ) {
31 if ( 0 != pObject || ignore_obj ) {
32 const CLID& obj_class =
33 (0 != pObject && !ignore_obj) ? pObject->
clID()
34 : (0 != pAddress && !ignore_add)
38 if ( !cnv && pObject ) {
49 status = cnv->
createObj(pAddress, pObject);
55 status = cnv->
updateObj(pAddress, pObject);
62 status = cnv->
createRep(pObject, pAddress);
68 status = cnv->
updateRep(pAddress, pObject);
84 log <<
MSG::INFO <<
"No converter for object ";
88 log <<
" CLID= " << obj_class <<
endmsg;
149 cnv = (*i).converter();
156 cnv = (*i).converter();
171 for(Workers::iterator
i=start;
i !=
stop;
i++ ) {
193 for(Workers::iterator
i=start;
i !=
stop;
i++ ) {
225 if ( 0 != pConverter ) {
234 typ = (typ<0xFF) ? typ : typ&0xFFFFFF00;
235 conv_typ = (conv_typ<0xFF) ? conv_typ : conv_typ&0xFFFFFF00;
236 if ( conv_typ == typ && conv_clid == clid ) {
249 if ( 0 != pConverter ) {
264 for(Workers::iterator
i=start;
i !=
stop;
i++ ) {
266 (*i).converter()->finalize().ignore();
267 (*i).converter()->release();
270 Workers::iterator j = std::remove_if(start, stop, test);
289 if ( (*i).converter()->finalize().isFailure() ) {
292 (*i).converter()->release();
306 const ICnvFactory* ) {
309 if ( 0 == pConverter ) {
310 typ = (typ<0xFF) ? typ : typ&0xFFFFFF00;
320 if ( 0 != pConverter ) {
343 if ( 0 != pConverter ) {
361 const std::string& ) {
379 const unsigned long* ,
387 std::string& refAddress)
418 (*i).converter()->release();
virtual const CLID & objType() const =0
Retrieve the class type of objects the converter produces.
Invalid address information.
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.
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...
const CLID & objType() const
Implementation of IConverter: dummy call.
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
virtual StatusCode stop()
Stop (from RUNNING to INITIALIZED).
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Implementation of IConverter: Update the references of an already converted object.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
ConversionSvc(const std::string &name, ISvcLocator *svc, long type)
Standard Constructor.
bool isSuccess() const
Test for a status code of SUCCESS.
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.
No proper converter is available to the service.
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.
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.
Object to be converted is invalid.
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.
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.
unsigned int CLID
Class ID definition.
virtual StatusCode initialize()=0
Initialize the converter.
virtual const std::string & name() const
Retrieve name of the service.
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.
Workers * m_workers
List of conversion workers.
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 StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
long m_type
Conversion service type.
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Templated class to add the standard messaging functionalities.
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.
virtual StatusCode start()
Start (from INITIALIZED to RUNNING).
Opaque address interface 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 finalize()
Finalize (from INITIALIZED to CONFIGURED).
std::vector< WorkerEntry > Workers
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Implementation of IConverter: Update the references of an updated transient object.
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
virtual SmartIF< IDataProviderSvc > & dataProvider() const
Implementation of IConverter: Get Data provider service.