Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

RegistryEntry.h

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/GaudiKernel/GaudiKernel/RegistryEntry.h,v 1.1.1.1 2001/04/18 18:14:18 tlindner 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/StatusCode.h"
00011 #include "GaudiKernel/IDataDirectory.h"
00012 
00013 // Forward declarations
00014 class DataObject;
00015 class TransientStore;
00016 class IOpaqueAddress;
00017 class IDataDirectory;
00018 class IDataStoreAgent;
00019 
00032 class RegistryEntry : virtual public IDataDirectory  {
00033 public:
00034 private:
00036   typedef std::vector<IDataDirectory*>          Store;
00038   //typedef std::vector<IDataDirectory::SymLink>  SymLinks;
00040   unsigned long   m_refCount;
00042   bool            m_isSoft;
00044   std::string     m_fullpath;
00046   std::string     m_path;
00048   RegistryEntry*  m_parent;
00050   IOpaqueAddress* m_address;
00052   DataObject*     m_object;
00054   TransientStore* m_transientStore;
00056   Store           m_store;
00057 
00058 public:
00064 
00065   void  assemblePath(std::string& buffer)  const;
00067   const IDataDirectory* i_find ( const IDataDirectory* pDirectory )  const;
00069   const IDataDirectory* i_find ( const std::string& path )  const;
00071   const RegistryEntry*  i_findLeaf(const std::string& path)  const;
00073   const RegistryEntry*  i_findLeaf(const DataObject* pObject)  const;
00075   RegistryEntry* i_add(const std::string& name);
00076 
00077 public:
00079   RegistryEntry(const std::string& path, RegistryEntry* parent = 0);
00081   virtual ~RegistryEntry();
00083   virtual unsigned long release();
00085   virtual unsigned long addRef()    {
00086     return ++m_refCount;
00087   }
00089   const std::string& name()  const  {
00090     return m_path;
00091   }
00093   void setStore(TransientStore* s)    {
00094     m_transientStore = s;
00095   }
00097   virtual TransientStore* store()   {
00098     return m_transientStore;
00099   }
00101   virtual const TransientStore* store()   const {
00102     return m_transientStore;
00103   }
00105   virtual DataObject*     object()   {
00106     return m_object;
00107   }
00109   virtual const DataObject* object()   const  {
00110     return m_object;
00111   }
00113   virtual const CLID&     clID()   const;
00115   virtual IOpaqueAddress* address()    {
00116     return m_address;
00117   }
00119   virtual const IOpaqueAddress* address()   const  {
00120     return m_address;
00121   }
00123   virtual IDataDirectory* parent()   {
00124     return m_parent;
00125   }
00127   virtual const IDataDirectory* parent()   const  {
00128     return m_parent;
00129   }
00131   virtual RegistryEntry* parentEntry()   {
00132     return m_parent;
00133   }
00135   virtual bool isSoft()   const     {
00136     return m_isSoft;
00137   }
00139   virtual int             size()  const   {
00140     return m_store.size();
00141   }
00143   virtual bool            isEmpty()  const    {
00144     return m_store.size() == 0;
00145   }
00147   virtual Iterator          begin   ()    {
00148     return m_store.begin();
00149   }
00151   virtual ConstIterator     begin   ()   const    {
00152     return m_store.begin();
00153   }
00155   virtual Iterator          end     ()    {
00156     return m_store.end();
00157   }
00159   virtual ConstIterator     end     ()   const    {
00160     return m_store.end();
00161   }
00162   // Retrieve next element of the container
00163   virtual Iterator          next    ( Iterator iter )   {
00164     return iter++;
00165   }
00166   // Retrieve next element of the container
00167   virtual ConstIterator     next    ( ConstIterator iter )  const   {
00168     return iter++;
00169   }
00170   // Retrieve next element of the container
00171   virtual ConstIterator     next    ( Iterator iter )  const    {
00172     return iter++;
00173   }
00175   virtual IDataDirectory* find ( const IDataDirectory* obj )  {
00176     const IDataDirectory* entry = i_find(obj);
00177     return const_cast<IDataDirectory*>(entry);
00178   }
00180   virtual const IDataDirectory* find ( const IDataDirectory* obj )  const  {
00181     return i_find(obj);
00182   }
00184   virtual IDataDirectory* find ( const std::string& path )  {
00185     const IDataDirectory* entry = i_find(path);
00186     return const_cast<IDataDirectory*>(entry);
00187   }
00189   virtual const IDataDirectory* find ( const std::string& path )  const  {
00190     return i_find(path);
00191   }
00193   RegistryEntry* findLeaf(const std::string& path)    {
00194     const RegistryEntry* entry = i_findLeaf(path);
00195     return const_cast<RegistryEntry*>(entry);
00196   }
00198   const RegistryEntry* findLeaf(const std::string& path)  const    {
00199     return i_findLeaf(path);
00200   }
00202   RegistryEntry* findLeaf(const DataObject* key)    {
00203     const RegistryEntry* entry = i_findLeaf(key);
00204     return const_cast<RegistryEntry*>(entry);
00205   }
00207   const RegistryEntry* findLeaf(const DataObject* key)  const  {
00208     return i_findLeaf(key);
00209   }
00211   void makeHard (DataObject* pObject);
00213   void makeHard (IOpaqueAddress* pAddress);
00215   void makeSoft (DataObject* pObject);
00217   void makeSoft (IOpaqueAddress* pAddress);
00219   virtual const std::string& location() const;
00221   virtual const std::string& fullpath() const;
00223   void setAddress(IOpaqueAddress* pAddress);
00225   void setObject(DataObject* obj);
00227   RegistryEntry* findParent(const std::string& path);
00229   RegistryEntry* findParent(DataObject* obj);
00231   virtual long add(const std::string& name, DataObject* pObject, bool is_soft = false);
00233   virtual long add(const std::string& name, IOpaqueAddress* pAddress, bool is_soft = false);
00235   virtual long              remove(const std::string& name);
00237   virtual long              add(IDataDirectory* obj);
00239   virtual long              remove(IDataDirectory* obj);
00241   virtual StatusCode        traverseTree(IDataStoreAgent* pAgent, int level = 0);
00243   virtual long              deleteElements();
00244 };
00245 
00246 #endif  // GAUDIKERNEL_REGISTRYENTRY_H

Generated at Wed Nov 21 12:22:05 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000