00001 #ifndef CDBBDBSHARED_CONDITION_AT_FOLDER_P_HH 00002 #define CDBBDBSHARED_CONDITION_AT_FOLDER_P_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbBdbSConditionAtFolderP.ddl,v 1.8 2004/08/06 05:54:24 bartoldu Exp $ 00006 00007 #include "BdbUtil/Bdb.hh" 00008 00009 #include "CdbBdbShared/CdbBdbSId.hh" 00010 #include "CdbBdbShared/CdbBdbSConfigCollectionP.hh" 00011 00012 #include <iostream> 00013 00014 //----------------------------------------------- 00015 // Forward Declarations for Persistent Classes -- 00016 //----------------------------------------------- 00017 00018 class CdbBdbSViewP; 00019 #pragma ooclassref CdbBdbSViewP "CdbBdbShared/CdbBdbSViewP_ref.hh" 00020 00021 class CdbBdbSFolderP; 00022 #pragma ooclassref CdbBdbSFolderP "CdbBdbShared/CdbBdbSFolderP_ref.hh" 00023 00024 /// Class representing a condition at a view's folder 00025 /** 00026 * Class CdbBdbSConditionAtFolderP. This persistent class represents 00027 * "condition at folder" objects, which are plaing two roles: 00028 * 00029 * - as a representative of the corresponding "physical" conditions 00030 * in the "virtual" namespace of a view. 00031 * 00032 * - as a provider of the configuration information (revision, partition, 00033 * etc.), which is used by clients looking for condition objects through 00034 * the corrsponding view. 00035 */ 00036 class CdbBdbSConditionAtFolderP : public BdbPersObj { 00037 00038 friend class CdbBdbSViewP; // who creates me or/and configures me 00039 friend class CdbBdbSFolderP; // who destroys me 00040 00041 private: 00042 00043 /// Default constructor (NOT IMPLEMENTED)) 00044 /** 00045 * Also see comments about the special constructor defined above. 00046 */ 00047 CdbBdbSConditionAtFolderP( ); 00048 00049 /// Normal constructor 00050 /** 00051 * WARNING: Inappropriate values of the parameters will cause the crash 00052 * of the constructor to avoid creating disformed persistent 00053 * data structures. 00054 */ 00055 CdbBdbSConditionAtFolderP( const char* theName, /**< the name of the condition */ 00056 const char* theDescription, /**< the description of the condition in the context of the parent folder */ 00057 const BdbTime& theCreationTime, /**< the time when the condition entry is supposed to be created */ 00058 const CdbBdbSId& theId, /**< the "extended" identifier of the "physical" condition */ 00059 const BdbRef(CdbBdbSFolderP)& theParentFolderRef, /**< back link to the parent folder */ 00060 const BdbRef(CdbBdbSConfigCollectionP)& theConfigRef = 0 /**< an optional configuration object */ 00061 ); 00062 00063 /// Destructor 00064 /** 00065 */ 00066 virtual ~CdbBdbSConditionAtFolderP( ); 00067 00068 /// Set/override default configuration 00069 /** 00070 * The passed reference can be 0-0-0-0. The previously stored configuration 00071 * object (if any) will be destroyed unless an optional 'dontDestroyConfigObject' 00072 * flag is set to true. 00073 */ 00074 CdbStatus setConfig( const BdbRef(CdbBdbSConfigCollectionP)& theConfigRef, /**< a configuration object */ 00075 bool dontDestroyConfigObject = false /**< an optional flag */ 00076 ); 00077 00078 public: 00079 00080 // Accessors 00081 00082 ooString(32) name ( ) const; 00083 ooString(32) description( ) const; 00084 00085 BdbTime created( ) const; 00086 00087 CdbBdbSId id( ) const; 00088 00089 BdbRef(CdbBdbSFolderP) parentFolder( ) const; 00090 BdbRef(CdbBdbSConfigCollectionP) config ( ) const; 00091 00092 /// Find the value of the configuration and its interval of validity... 00093 /** 00094 * ...where the specified validity time falls into. 00095 * 00096 * NOTES: 00097 * 00098 * - the local configuration (if any) at the condition's level will take precedence 00099 * over the view's default configuration. 00100 * 00101 * - the restriction in the validity interval covered by this view is also taken 00102 * into account. So the returned interval of the configuration will never 00103 * exceed these limits. 00104 * 00105 * - if there is no configuration found for specified time (either due to 00106 * out-of-supported-range value of the time, or due to missing configuration, 00107 * which is basically a sign that the view is incomplete) then Cdbstatus::NotFound 00108 * is returned. 00109 */ 00110 CdbStatus find( const BdbTime& theTime, /**< the validity time */ 00111 CdbBdbSConfigInterval& theConfigInterval /**< the configuration interval to be set up upon completion */ 00112 ) const; 00113 00114 /// Dump the contents of the object 00115 /** 00116 */ 00117 void dump( std::ostream& o ) const; 00118 00119 private: 00120 00121 // Data members 00122 00123 ooString(32) _name; 00124 ooString(32) _description; 00125 00126 BdbTime _created; 00127 00128 CdbBdbSId _id; 00129 00130 BdbRef(CdbBdbSFolderP) _parentFolderRef; 00131 BdbRef(CdbBdbSConfigCollectionP) _configRef; 00132 }; 00133 00134 #endif /* CDBBDBSHARED_CONDITION_AT_FOLDER_P_HH */
1.3-rc3