00001 #ifndef CDBBROOREADONLY_REGISTRY_HH 00002 #define CDBBROOREADONLY_REGISTRY_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbRooRoRegistry.hh,v 1.3 2005/06/23 23:44:46 gapon Exp $ 00006 00007 #include "BdbTime/BdbTime.hh" 00008 00009 #include "CdbBase/CdbCPtr.hh" 00010 00011 #include <Rtypes.h> 00012 00013 #include <string> 00014 #include <iostream> 00015 00016 class CdbRooRoRegistryDescriptorR; 00017 class CdbRooRoViewCollectionR; 00018 class CdbRooRoPartitionsLayoutR; 00019 00020 00021 template<class T> class CdbRooRoNameIdCollectionR; 00022 00023 class CdbRooRoOriginR; 00024 typedef CdbRooRoNameIdCollectionR<CdbRooRoOriginR> CdbRooRoOriginCollectionR; 00025 00026 class CdbRooRoClusterR; 00027 typedef CdbRooRoNameIdCollectionR<CdbRooRoClusterR> CdbRooRoClusterCollectionR; 00028 00029 class CdbRooRoRClusterR; 00030 typedef CdbRooRoNameIdCollectionR<CdbRooRoRClusterR> CdbRooRoRClusterCollectionR; 00031 00032 class CdbRooRoConditionR; 00033 typedef CdbRooRoNameIdCollectionR<CdbRooRoConditionR> CdbRooRoConditionCollectionR; 00034 00035 /// A base class for the "Registry"-s of specific types of databases 00036 /** 00037 * This is an abstract class to be extended & implemented by concrete 00038 * subclasses. 00039 * 00040 * DESIGN NOTE: 00041 * 00042 * At the moment it's a base class of a hierarchy of transient classes providing 00043 * a convenience interface to a persistent store. 00044 */ 00045 class CdbRooRoRegistry { 00046 00047 private: 00048 00049 /// Default constructor (NOT IMPLEMENTED)) 00050 00051 CdbRooRoRegistry( ); 00052 00053 protected: 00054 00055 /// Normal constructor 00056 /** 00057 * The "id" of the MASTER database is the same as its creation time. 00058 * The local collections get created only if the corresponding flag is set up. 00059 * 00060 * NOTE: 00061 * 00062 * A resgistry of this class will take an ownership over passed collection objects 00063 * and store using "counted smart pointers". 00064 * 00065 * @see class CdbCPtr 00066 */ 00067 CdbRooRoRegistry( const CdbCPtr< CdbRooRoRegistryDescriptorR >& theDescriptorPtr, /**< the registry descriptor */ 00068 const CdbCPtr< CdbRooRoConditionCollectionR >& theConditionCollectionPtr, /**< the local collection of REGULAR conditions */ 00069 const CdbCPtr< CdbRooRoViewCollectionR >& theViewCollectionPtr, /**< the local collection of views */ 00070 const CdbCPtr< CdbRooRoRClusterCollectionR >& theClusterCollectionPtr /**< th elocal collection of REGULAR clusters */ 00071 ); 00072 00073 public: 00074 00075 /// Destructor 00076 /** 00077 */ 00078 virtual ~CdbRooRoRegistry( ); 00079 00080 // Accessors 00081 00082 UShort_t originId( ) const; 00083 00084 const std::string& originName ( ) const; 00085 const std::string& description( ) const; 00086 00087 BdbTime created( ) const; 00088 BdbTime id ( ) const; 00089 00090 bool hasLocalCollections( ) const; 00091 bool isMaster ( ) const; 00092 00093 00094 // Local collections 00095 00096 CdbCPtr< CdbRooRoConditionCollectionR > conditionCollection( ) const; 00097 CdbCPtr< CdbRooRoViewCollectionR > viewCollection ( ) const; 00098 CdbCPtr< CdbRooRoRClusterCollectionR > clusterCollection ( ) const; 00099 00100 // MASTER-only collections 00101 00102 virtual CdbCPtr< CdbRooRoOriginCollectionR > originCollection ( ) const = 0; 00103 virtual CdbCPtr< CdbRooRoClusterCollectionR > pClusterCollection( ) const = 0; 00104 virtual CdbCPtr< CdbRooRoPartitionsLayoutR > partitionsLayout ( ) const = 0; 00105 00106 /// Dump the contents of the object 00107 00108 virtual void dump( std::ostream& o ) const; 00109 00110 public: 00111 00112 /// Static locator for the MASTER registry 00113 /** 00114 * The method will return CdbStatus::NotFound if the registry is not found. 00115 */ 00116 static CdbStatus findMaster( CdbCPtr< CdbRooRoRegistry >& theRegistryPtr ); 00117 00118 /// Static locator for the local registry 00119 /** 00120 * The "local" registry is the one corresponding to the local origin. 00121 * 00122 * The method will return CdbStatus::NotFound if the registry is not found. 00123 */ 00124 static CdbStatus findLocal( CdbCPtr< CdbRooRoRegistry >& theRegistryPtr ); 00125 00126 /// Static locator for a registry corresponding to specified origin ID 00127 /** 00128 * The method will return CdbStatus::NotFound if the registry is not found. 00129 */ 00130 static CdbStatus findByOrigin( CdbCPtr< CdbRooRoRegistry >& theRegistryPtr, 00131 UShort_t theOriginId ); 00132 00133 /// Static locator for a registry corresponding to specified origin name 00134 /** 00135 * The locator will also support the following pseudo-names for origins: 00136 * 00137 * "<master>" 00138 * "<local>" 00139 * 00140 * The method will return CdbStatus::NotFound if the registry is not found. 00141 */ 00142 static CdbStatus findByOrigin( CdbCPtr< CdbRooRoRegistry >& theRegistryPtr, 00143 const std::string& theOriginName ); 00144 00145 private: 00146 00147 CdbCPtr< CdbRooRoRegistryDescriptorR > _registryDescriptorPtr; 00148 CdbCPtr< CdbRooRoConditionCollectionR > _conditionCollectionPtr; 00149 CdbCPtr< CdbRooRoViewCollectionR > _viewCollectionPtr; 00150 CdbCPtr< CdbRooRoRClusterCollectionR > _clusterCollectionPtr; 00151 }; 00152 00153 #endif /* CDBBROOREADONLY_REGISTRY_HH */
1.3-rc3