00001 #ifndef CDB_PARTITION_HH 00002 #define CDB_PARTITION_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbPartition.hh,v 1.5 2004/08/06 05:54:14 bartoldu Exp $ 00006 00007 #include "CdbBase/CdbCPtrBase.hh" 00008 #include "CdbBase/CdbPartitionPtrFwd.hh" 00009 #include "CdbBase/CdbDatabasePtrFwd.hh" 00010 00011 #include "BdbTime/BdbTime.hh" 00012 00013 #include <string> 00014 00015 /// The transient interface to a partition object. 00016 /** 00017 * More details to come... 00018 */ 00019 class CdbPartition { 00020 00021 friend class CdbCPtrBase< CdbPartition >; // Who destroys me 00022 00023 private: 00024 00025 /// The constructor (NOT IMPLEMENTED) 00026 /** 00027 * Is disabled... 00028 */ 00029 CdbPartition( ); 00030 00031 /// The copy constructor (NOT IMPLEMENTED) 00032 /** 00033 * Is disabled... 00034 */ 00035 CdbPartition( const CdbPartition& thePartition ); 00036 00037 /// The assignment operator (NOT IMPLEMENTED) 00038 /** 00039 * Is disabled... 00040 */ 00041 CdbPartition& operator=( const CdbPartition& thePartition ); 00042 00043 protected: 00044 00045 /// The normal constructor. 00046 /** 00047 * Initialize context with specified "stable" parameters (those ones that 00048 * could not be changed during the life time of the partition.). The "dynamic" 00049 * parameters of the partition are available through the virtual methods. 00050 */ 00051 CdbPartition( const CdbDatabasePtr& theDatabasePtr, /**< the smart pointer providing a back back link to the parent database object */ 00052 unsigned short theId, /**< the partition identifier */ 00053 unsigned short theOwnerId, /**< the owner origin of the partiton */ 00054 const char* theOwnerName, /**< the owner origin of the partiton */ 00055 const char* theDescription, /**< the description of the partition */ 00056 const BdbTime& theCreationTime, /**< the creation time */ 00057 const BdbTime& theBeginValidity, /**< where the "validity" interval begins */ 00058 const BdbTime& theEndValidity, /**< where the "validity" interval std::ends */ 00059 const BdbTime& theBeginInsertion /**< where the "insertion" interval begins */ 00060 ); 00061 00062 /// The destructor. 00063 /** 00064 * More details... 00065 */ 00066 virtual ~CdbPartition( ); 00067 00068 public: 00069 00070 /// Return a smart pointer to the parent condition object. 00071 /** 00072 * @see CdbCondition 00073 * @see CdbConditionPtr 00074 */ 00075 const CdbDatabasePtr& parent( ) const; 00076 00077 /// The identifier of the partition 00078 00079 unsigned short id( ) const; 00080 00081 /// The identifier of the partition's owner 00082 00083 unsigned short ownerId( ) const; 00084 00085 /// The name of the partition's owner 00086 00087 std::string ownerName( ) const; 00088 00089 /// The name of the partition's owner 00090 00091 std::string description( ) const; 00092 00093 /// The creation time of the partition 00094 00095 BdbTime created( ) const; 00096 00097 /// The begin time in the "validity" dimension 00098 00099 BdbTime beginValidity( ) const; 00100 00101 /// The end time in the "validity" dimension 00102 00103 BdbTime endValidity( ) const; 00104 00105 /// The begin time in the "insertion" dimension 00106 00107 BdbTime beginInsertion( ) const; 00108 00109 /// The begin time in the "insertion" dimension 00110 00111 virtual BdbTime endInsertion( ) const = 0; 00112 00113 /// The recent modification time of the partition 00114 /** 00115 * This time is increased when any of partitionable conditions 00116 * are updated (new objects are written, new revisions get created) 00117 * within the validity/insertion time limits of the partition. 00118 * Only "open" partitions can be updated. 00119 */ 00120 virtual BdbTime modified( ) const = 0; 00121 00122 /// The status of the partition 00123 /** 00124 * The partiton is "closed" if it's not allowed for writing into it even by its 00125 * owner origin. Normally a partition gets into this state when a new one is created 00126 * above it in the "insertion" time dimension. Eeffectively a "closed" partition 00127 * becomes the read-only one. 00128 */ 00129 virtual bool isClosed( ) const = 0; 00130 00131 /// The status of the partition 00132 /** 00133 * The partiton can only be "instantiated" by its owner origin to allow 00134 * writing into or reading from it. Non-ownes of a partition are not allowed 00135 * to read from a partition untill it gets "instantiated" by the owner and shipped 00136 * to a local origin (database). 00137 */ 00138 virtual bool isInstantiated( ) const = 0; 00139 00140 private: 00141 00142 CdbDatabasePtr _myParent; 00143 unsigned short _id; 00144 00145 unsigned short _ownerId; 00146 std::string _ownerName; 00147 00148 std::string _description; 00149 00150 BdbTime _created; 00151 00152 BdbTime _beginValidity; 00153 BdbTime _endValidity; 00154 BdbTime _beginInsertion; 00155 }; 00156 00157 #endif // CDB_PARTITION_HH
1.3-rc3