| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

# ConversionSvc.h

Go to the documentation of this file.

    00001 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/ConversionSvc.h,v 1.15 2007/06/01 17:24:21 marcocle Exp $
    00002 #ifndef GAUDIKERNEL_CONVERSIONSVC_H
    00003 #define GAUDIKERNEL_CONVERSIONSVC_H 1
    00004
    00005 // Include files
    00006 #include <vector>
    00007 #include <algorithm>
    00008 #include <functional>
    00009 #include "GaudiKernel/Kernel.h"
    00010 #include "GaudiKernel/Service.h"
    00011 #include "GaudiKernel/IConversionSvc.h"
    00012 #include "GaudiKernel/IAddressCreator.h"
    00013 #include "GaudiKernel/IDataProviderSvc.h"
    00014
    00015
    00047 class GAUDI_API ConversionSvc: public extends2<Service, IConversionSvc, IAddressCreator>
    00048 {
    00049 public:
    00050   class WorkerEntry {
    00051   private:
    00052     CLID        m_class;
    00053     IConverter* m_converter;
    00054   public:
    00055     WorkerEntry(const CLID& cl, IConverter* cnv)
    00056       : m_class(cl), m_converter(cnv)       {
    00057     }
    00058     WorkerEntry(const WorkerEntry& copy)
    00059       : m_class(copy.m_class), m_converter(copy.m_converter)    {
    00060     }
    00061     WorkerEntry& operator = (const WorkerEntry& copy)   {
    00062       m_class     = copy.m_class;
    00063       m_converter = copy.m_converter;
    00064       return *this;
    00065     }
    00066     virtual ~WorkerEntry()  {
    00067     }
    00068     IConverter*     converter()  {
    00069       return m_converter;
    00070     }
    00071     const CLID&     clID()  const {
    00072       return m_class;
    00073     }
    00074   };
    00075   typedef std::vector<WorkerEntry> Workers;
    00076
    00077   class CnvTest : public std::unary_function<WorkerEntry, bool>   {
    00078   protected:
    00079     const CLID m_test;
    00080   public:
    00081     CnvTest(const CLID& test) : m_test(test)    {
    00082     }
    00083     virtual ~CnvTest()    {
    00084     }
    00085     bool operator()( const WorkerEntry& testee )  {
    00086         return (m_test == testee.clID()) ? true : false;
    00087     }
    00088   };
    00089
    00090 public:
    00091
    00093   virtual StatusCode initialize();
    00094
    00096   virtual StatusCode finalize();
    00097
    00099   virtual long repSvcType() const;
    00100
    00102   const CLID& objType() const;
    00103
    00108   virtual StatusCode setDataProvider(IDataProviderSvc* pService);
    00109
    00113   virtual SmartIF<IDataProviderSvc>& dataProvider()  const;
    00114
    00116   virtual StatusCode setConversionSvc(IConversionSvc* svc);
    00117
    00119   virtual SmartIF<IConversionSvc>& conversionSvc()    const;
    00120
    00122   virtual StatusCode setAddressCreator(IAddressCreator* creator);
    00123
    00125   virtual SmartIF<IAddressCreator>& addressCreator()   const;
    00126
    00128   virtual StatusCode createObj(IOpaqueAddress* pAddress,DataObject*& refpObject);
    00129
    00131   virtual StatusCode fillObjRefs(IOpaqueAddress* pAddress, DataObject* pObject);
    00132
    00134   virtual StatusCode updateObj(IOpaqueAddress* pAddress, DataObject* refpObject);
    00135
    00137   virtual StatusCode updateObjRefs(IOpaqueAddress* pAddress, DataObject* pObject);
    00138
    00140   virtual StatusCode createRep(DataObject* pObject, IOpaqueAddress*& refpAddress);
    00141
    00143   virtual StatusCode fillRepRefs(IOpaqueAddress* pAddress,DataObject* pObject);
    00144
    00146   virtual StatusCode updateRep(IOpaqueAddress* pAddress, DataObject* pObject);
    00147
    00149   virtual StatusCode updateRepRefs(IOpaqueAddress* pAddress, DataObject* pObject);
    00150
    00152   virtual StatusCode addConverter(const CLID& clid);
    00153
    00155   virtual StatusCode addConverter(IConverter* pConverter);
    00156
    00158   virtual StatusCode removeConverter(const CLID& clid);
    00159
    00161   virtual IConverter* converter(const CLID& wanted);
    00162
    00164   virtual StatusCode connectOutput(const std::string& outputFile,
    00165                                    const std::string& openMode);
    00166
    00168   virtual StatusCode connectOutput(const std::string& output);
    00169
    00171   virtual StatusCode commitOutput(const std::string& output, bool do_commit);
    00172
    00174   virtual StatusCode createAddress( long svc_type,
    00175                                     const CLID& clid,
    00176                                     const std::string* par,
    00177                                     const unsigned long* ip,
    00178                                     IOpaqueAddress*& refpAddress);
    00179
    00181   virtual StatusCode convertAddress( const IOpaqueAddress* pAddress,
    00182                                      std::string& refAddress);
    00183
    00185   virtual StatusCode createAddress( long svc_type,
    00186                                     const CLID& clid,
    00187                                     const std::string& refAddress,
    00188                                     IOpaqueAddress*& refpAddress);
    00189
    00191   virtual StatusCode updateServiceState(IOpaqueAddress* pAddress);
    00192
    00194   ConversionSvc(const std::string& name, ISvcLocator* svc, long type);
    00195
    00196 protected:
    00198   virtual ~ConversionSvc();
    00199
    00201   virtual IConverter* createConverter(long typ, const CLID& clid, const ICnvFactory* fac);
    00202
    00204   virtual StatusCode configureConverter(long typ, const CLID& clid, IConverter* cnv);
    00205
    00207   virtual StatusCode initializeConverter(long typ, const CLID& clid, IConverter* cnv);
    00208
    00210   virtual StatusCode activateConverter(long typ, const CLID& clid, IConverter* cnv);
    00211
    00213   virtual void loadConverter(DataObject* pObject);
    00214
    00216   virtual SmartIF<IAddressCreator>& addressCreator()   {
    00217     return m_addressCreator;
    00218   }
    00219
    00220 protected:
    00221   StatusCode makeCall( int typ,
    00222                        bool ignore_add,
    00223                        bool ignore_obj,
    00224                        bool update,
    00225                        IOpaqueAddress*& pAddress,
    00226                        DataObject*& pObject);
    00227
    00229   mutable SmartIF<IDataProviderSvc>   m_dataSvc;
    00231   mutable SmartIF<IAddressCreator>    m_addressCreator;
    00233   mutable SmartIF<IConversionSvc>     m_cnvSvc;
    00235   long                m_type;
    00237   Workers*            m_workers;
    00238
    00239 private:
    00241   ConversionSvc(const ConversionSvc&);
    00243   ConversionSvc& operator= (const ConversionSvc&);
    00244 };
    00245 #endif // GAUDIKERNEL_CONVERSIONSVC_H

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines