| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

# RegistryEntry.h

Go to the documentation of this file.

    00001 // $Id: RegistryEntry.h,v 1.8 2005/07/18 16:34:05 hmd Exp $
    00002 #ifndef GAUDIKERNEL_REGISTRYENTRY_H
    00003 #define GAUDIKERNEL_REGISTRYENTRY_H
    00004
    00005 // STL include files
    00006 #include <vector>
    00007
    00008 // Framework include files
    00009 #include "GaudiKernel/Kernel.h"
    00010 #include "GaudiKernel/IRegistry.h"
    00011
    00012 // Forward declarations
    00013 class DataSvc;
    00014 class DataObject;
    00015 class IDataProviderSvc;
    00016 class IOpaqueAddress;
    00017 class IDataStoreAgent;
    00018
    00019
    00020 namespace DataSvcHelpers   {
    00034   class GAUDI_API RegistryEntry : public IRegistry  {
    00035   private:
    00037     typedef std::vector<IRegistry*> Store;
    00038   public:
    00039     friend class ::DataSvc;
    00041     typedef Store::const_iterator Iterator;
    00042   private:
    00044     unsigned long     m_refCount;
    00046     bool              m_isSoft;
    00048     std::string       m_fullpath;
    00050     std::string       m_path;
    00052     RegistryEntry*    m_pParent;
    00054     IOpaqueAddress*   m_pAddress;
    00056     DataObject*       m_pObject;
    00058     IDataProviderSvc* m_pDataProviderSvc;
    00060     Store             m_store;
    00061
    00062   private:
    00068
    00069     void  assemblePath(std::string& buffer)  const;
    00071     IRegistry* i_find ( const IRegistry* pDirectory )  const;
    00073     RegistryEntry* i_find ( const std::string& path )  const;
    00075     RegistryEntry* i_find ( const DataObject* pObject )  const;
    00077     RegistryEntry* i_add ( const std::string& name );
    00079     void setParent(RegistryEntry* pParent);
    00081     void setDataSvc(IDataProviderSvc* s)    {
    00082       m_pDataProviderSvc = s;
    00083     }
    00085     virtual RegistryEntry* parentEntry()   {
    00086       return m_pParent;
    00087     }
    00089     RegistryEntry* findLeaf(const std::string& path)  const    {
    00090       return i_find(path);
    00091     }
    00093     RegistryEntry* findLeaf(const DataObject* key)  const  {
    00094       return i_find(key);
    00095     }
    00097     void makeHard (DataObject* pObject);
    00099     void makeHard (IOpaqueAddress* pAddress);
    00101     void makeSoft (DataObject* pObject);
    00103     void makeSoft (IOpaqueAddress* pAddress);
    00104   public:
    00106     RegistryEntry(const std::string& path, RegistryEntry* parent = 0);
    00108     virtual ~RegistryEntry();
    00110     virtual unsigned long release();
    00112     virtual unsigned long addRef()    {
    00113       return ++m_refCount;
    00114     }
    00116     const std::string& name()  const  {
    00117       return m_path;
    00118     }
    00120     virtual const std::string& identifier()   const  {
    00121       return m_fullpath;
    00122     }
    00124     virtual IDataProviderSvc* dataSvc()  const {
    00125       return m_pDataProviderSvc;
    00126     }
    00128     virtual DataObject*     object()  const {
    00129       return m_pObject;
    00130     }
    00132     virtual IOpaqueAddress* address()   const  {
    00133       return m_pAddress;
    00134     }
    00136     virtual IRegistry* parent()   const  {
    00137       return m_pParent;
    00138     }
    00140     virtual bool isSoft()   const     {
    00141       return m_isSoft;
    00142     }
    00144     const Store& leaves()  const   {
    00145       return m_store;
    00146     }
    00148     virtual int             size()  const   {
    00149       return m_store.size();
    00150     }
    00152     virtual bool            isEmpty()  const    {
    00153       return m_store.size() == 0;
    00154     }
    00156     virtual Iterator   begin   ()   const  {
    00157       return m_store.begin();
    00158     }
    00160     virtual Iterator   end     ()   const  {
    00161       return m_store.end();
    00162     }
    00164     virtual IRegistry* find ( const IRegistry* obj )  const  {
    00165       return i_find(obj);
    00166     }
    00168     virtual IRegistry* find ( const std::string& path )  const  {
    00169       return i_find(path);
    00170     }
    00172     void setAddress(IOpaqueAddress* pAddress);
    00174     void setObject(DataObject* obj);
    00175
    00177     virtual long add(const std::string& name,
    00178                      DataObject* pObject,
    00179                      bool is_soft = false);
    00181     virtual long add(const std::string& name,
    00182                      IOpaqueAddress* pAddress,
    00183                      bool is_soft = false);
    00185     virtual long remove(const std::string& name);
    00187     virtual long add(IRegistry* obj);
    00189     virtual long remove(IRegistry* obj);
    00191     virtual long deleteElements();
    00193     virtual long traverseTree(IDataStoreAgent* pAgent, int level = 0);
    00194   };
    00195 }
    00196 #endif  // GAUDIKERNEL_REGISTRYENTRY_H