Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:08:59

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #ifndef GAUDIKERNEL_ICONVERTER_H
0012 #define GAUDIKERNEL_ICONVERTER_H
0013 
0014 // Include files
0015 #include "GaudiKernel/ClassID.h"
0016 #include "GaudiKernel/IInterface.h"
0017 
0018 // Forward declarations
0019 class IDataProviderSvc;
0020 class IAddressCreator;
0021 class IConversionSvc;
0022 class IOpaqueAddress;
0023 class DataObject;
0024 template <class T>
0025 class SmartIF;
0026 
0027 /** @class IConverter IConverter.h GaudiKernel/IConverter.h
0028 
0029     The data converters are responsible to translate data from one
0030     representation into another. Concrete examples are e.g. converters
0031     creating transient objects representing parts of an event from
0032     the persistent (and disk based) representations. Converters will
0033     have to deal with the technology both representations are based on:
0034         in the upper example they have to know about the database internals
0035           as well as the structure of the transient representations.
0036     The converters know about the mechanism to retrieve persistent objects
0037           (ZEBRA, Objectivity, ) and only pass abstract instances of the converted
0038           objects, hence shielding the calling service from internals.
0039 
0040     Data converters are meant to be light. This means there should
0041     not be all-in-one converters, which are able to convert the "world",
0042     but rather many converters. Each converter is then able to create a
0043     representation of a given type.
0044 
0045     In order to function a converter must be able to
0046     <UL>
0047     <LI>Answer (when asked) which kind of representation the converter
0048     is able to create.
0049     <LI>Retrieve the source object from the source store.
0050     <LI>Create the requested representation using the information contained
0051     in the source object.
0052     <LI>Inform the registry entry of  the created object that the object
0053     is now loaded.
0054     <LI>This registry entry is located in the data store which is supposed
0055     to manage the requested object.
0056     <LI>Register all leafs of the created object with the data store which
0057     is supposed to manage the requested object.
0058     Registering does not mean to create these representations,
0059     but rather to inform about the existence.
0060     </UL>
0061 
0062     The interface should cover the entry points of concrete
0063     converter instances in order to serve conversion requests.
0064 
0065     @author Markus Frank
0066     @version 1.0
0067 */
0068 class GAUDI_API IConverter : virtual public IInterface {
0069 public:
0070   /// InterfaceID
0071   DeclareInterfaceID( IConverter, 3, 0 );
0072 
0073   /** Initialize the converter
0074       @return    Status code indicating success or failure
0075       @exception exception (STL standard) in case of fatal errors
0076   */
0077   virtual StatusCode initialize() = 0;
0078 
0079   /** Terminate the converter
0080       @return    Status code indicating success or failure
0081       @exception exception (STL standard) in case of fatal errors
0082   */
0083   virtual StatusCode finalize() = 0;
0084 
0085   /** Retrieve the class type of objects the converter produces.
0086       @return Class type of the created object.
0087   */
0088   virtual const CLID& objType() const = 0;
0089 
0090   /** Retrieve the class type of the data store the converter uses.
0091       @return Class type information about the source data store type the
0092               converter will use to retrieve the information.
0093    */
0094   virtual long repSvcType() const = 0;
0095 
0096   /** Set Data provider service
0097       @return    Status code indicating success or failure
0098       @param     pService   Pointer to data provider service
0099   */
0100   virtual StatusCode setDataProvider( IDataProviderSvc* pService ) = 0;
0101 
0102   /** Get Data provider service
0103       @return    Pointer to data provider service
0104   */
0105   virtual SmartIF<IDataProviderSvc>& dataProvider() const = 0;
0106 
0107   /** Set conversion service the converter is connected to
0108       @return    Status code indicating success or failure
0109       @param     pService   Pointer to IConversionSvc interface
0110   */
0111   virtual StatusCode setConversionSvc( IConversionSvc* pService ) = 0;
0112 
0113   /** Get conversion service the converter is connected to
0114       @return    Pointer to IConversionSvc interface
0115   */
0116   virtual SmartIF<IConversionSvc>& conversionSvc() const = 0;
0117 
0118   /** Set address creator facility.
0119       @param      creator     Reference to address creator interface
0120       @return     Status code indicating success or failure.
0121   */
0122   virtual StatusCode setAddressCreator( IAddressCreator* creator ) = 0;
0123 
0124   /** Get address creation interface needed to resolve links between objects
0125       @return    Pointer to IAddressCreator interface
0126   */
0127   virtual SmartIF<IAddressCreator>& addressCreator() const = 0;
0128 
0129   /** Create the transient representation of an object.
0130       The transient representation is created by loading the
0131       persistent object using the source information
0132       contained in the address.
0133       @return    Status code indicating success or failure
0134       @param     pAddress   Opaque address information to retrieve the
0135                             requested object from the store in order to
0136                             produce the transient object.
0137       @param     refpObject Reference to location of pointer of the
0138                             created object.
0139    */
0140   virtual StatusCode createObj( IOpaqueAddress* pAddress, DataObject*& refpObject ) = 0;
0141 
0142   /** Resolve the references of the created transient object.
0143       After the object creation references of the objects pointing
0144       to objects outside its scope will have to be filled. The actual
0145       objects will not be loaded, but the recipe to load them will be present.
0146       @return    Status code indicating success or failure
0147       @param     pAddress   Opaque address information to retrieve the
0148                             requested object from the store.
0149       @param     pObject    Pointer to location of the object
0150    */
0151   virtual StatusCode fillObjRefs( IOpaqueAddress* pAddress, DataObject* pObject ) = 0;
0152 
0153   /** Update the transient object from the other representation.
0154       The transient representation will be updated by loading the
0155       persistent object using the source information
0156       contained in the address and then refill transient data.
0157       @return    Status code indicating success or failure
0158       @param     pAddress   Opaque address information to retrieve the
0159                             requested object from the store.
0160       @param     pObject    Pointer to the object to be updated.
0161    */
0162   virtual StatusCode updateObj( IOpaqueAddress* pAddress, DataObject* refpObject ) = 0;
0163 
0164   /** Update the references of an updated transient object.
0165       After the object was updated also the references of the objects pointing
0166       to objects outside its scope will have to be filled. The actual pointers
0167       to objects will only be filled if already present. Otherwise
0168       only the recipe to load them will be present.
0169       @return    Status code indicating success or failure
0170       @param     pAddress   Opaque address information to retrieve the
0171                             requested object from the store.
0172       @param     pObject    Pointer to location of the object
0173    */
0174   virtual StatusCode updateObjRefs( IOpaqueAddress* pAddress, DataObject* pObject ) = 0;
0175 
0176   /** Convert the transient object to the requested representation.
0177       e.g. conversion to persistent objects.
0178       @return    Status code indicating success or failure
0179       @param     pObject     Pointer to location of the object
0180       @param     refpAddress Reference to location of pointer with the
0181                              object address.
0182    */
0183   virtual StatusCode createRep( DataObject* pObject, IOpaqueAddress*& refpAddress ) = 0;
0184 
0185   /** Resolve the references of the converted object.
0186       After the requested representation was created the references in this
0187       representation must be resolved.
0188       @return    Status code indicating success or failure
0189       @param     pObject    Pointer to location of the object
0190    */
0191   virtual StatusCode fillRepRefs( IOpaqueAddress* pAddress, DataObject* pObject ) = 0;
0192 
0193   /** Update the converted representation of a transient object.
0194       @return    Status code indicating success or failure
0195       @param     pObject     Pointer to location of the object
0196       @param     refpAddress Reference to location of pointer with the
0197                              object address.
0198    */
0199   virtual StatusCode updateRep( IOpaqueAddress* pAddress, DataObject* pObject ) = 0;
0200 
0201   /** Update the references of an already converted object.
0202       The object must be retrieved before it can be updated.
0203       @return    Status code indicating success or failure
0204       @param     pAddress   Pointer to location of object address with the
0205                             store.
0206       @param     pObject    Pointer to location of the object
0207    */
0208   virtual StatusCode updateRepRefs( IOpaqueAddress* pAddress, DataObject* pObject ) = 0;
0209 };
0210 
0211 #endif // GAUDIKERNEL_ICONVERTER_H