00001 #ifndef CDBBDBSHARED_FOLDER_P_HH 00002 #define CDBBDBSHARED_FOLDER_P_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbBdbSFolderP.ddl,v 1.8 2004/08/06 05:54:24 bartoldu Exp $ 00006 00007 #include "BdbUtil/Bdb.hh" 00008 #include "ooMap.h" 00009 00010 #include "CdbBase/CdbItr.hh" 00011 #include "CdbBdbShared/CdbBdbSConditionAtFolderP.hh" 00012 00013 #include <iostream> 00014 00015 class CdbPathName; 00016 00017 //----------------------------------------------- 00018 // Forward Declarations for Persistent Classes -- 00019 //----------------------------------------------- 00020 00021 class CdbBdbSViewP; 00022 #pragma ooclassref CdbBdbSViewP "CdbBdbShared/CdbBdbSViewP_ref.hh" 00023 00024 /// Persistent folder class at teh persistent view 00025 /** 00026 * Folders may own other folders or persistent conditions. 00027 */ 00028 class CdbBdbSFolderP : public BdbPersObj { 00029 00030 friend class CdbBdbSViewP; 00031 00032 private: 00033 00034 /// Default constructor (NOT IMPLEMENTED)) 00035 /** 00036 * Also see comments about the special constructor defined above. 00037 */ 00038 CdbBdbSFolderP( ); 00039 00040 /// Normal constructor 00041 /** 00042 * WARNING: Inappropriate values of the parameters will cause the crash 00043 * of the constructor to avoid creating disformed persistent 00044 * data structures. 00045 */ 00046 CdbBdbSFolderP( const char* theName, /**< the name of the folder */ 00047 const char* theDescription, /**< the description of the folder */ 00048 const BdbTime& theCreationTime, /**< the time when the folder is supposed to be created */ 00049 const BdbRef(CdbBdbSViewP)& theParentViewRef, /**< back link to the parent view */ 00050 const BdbRef(CdbBdbSFolderP)& theParentFolderRef /**< an optional back link to the parent folder */ 00051 ); 00052 00053 /// Destructor 00054 /** 00055 */ 00056 virtual ~CdbBdbSFolderP( ); 00057 00058 /// Insert a folder 00059 /** 00060 * The passed object will be asked to provide its name. This name will be used 00061 * to register passed object in the current folder. This name must be unique 00062 * in the list of folders at the current folder's scope. 00063 */ 00064 CdbStatus insert( const BdbRef(CdbBdbSFolderP)& theRef ); 00065 00066 /// Insert a condition 00067 /** 00068 * The passed object will be asked to provide its name. This name will be used 00069 * to register passed object in the current folder. This name must be unique 00070 * in the list of conditions at the current folder's scope. 00071 */ 00072 CdbStatus insert( const BdbRef(CdbBdbSConditionAtFolderP)& theRef ); 00073 00074 /// Create new folder (RECURSIVE) 00075 /** 00076 * This operation creates the specified folder path, including intermediate subdirectories 00077 * if they still do not exist. 00078 * 00079 * NOTE: The specified "description" and "creation" timestamp will be assigned to all 00080 * newely created folders. 00081 */ 00082 CdbStatus createFolder( const char* theFullPathName, /**< the path name of the folder to be created */ 00083 const char* theDescription, /**< the description of the folder */ 00084 const BdbTime& theCreationTime /**< the time when the folder is supposed to be created */ 00085 ); 00086 00087 /// Remove the folder 00088 /** 00089 * If the "forceFlag" is set FALSE then only an empty folder with no other subfolders 00090 * or conditions in it can be removed. Otherwise both the folder itself and its contents 00091 * will be exterminated. 00092 * 00093 * This operation requires the name of the folder, which is _directly_ connected 00094 * to the current object. If there is no such folder then CdbStatus::NotFound 00095 * will be returned. Other status values are as usual. 00096 */ 00097 CdbStatus removeFolder( const CdbPathName& thePathName, /**< the path name of the folder to be removed */ 00098 bool forceFlag = false /**< force removal if the folder is not empty */ 00099 ); 00100 00101 /// Remove the condition 00102 /** 00103 * This operation requires the name of the condition, which is _directly_ connected 00104 * to the current object. If there is no such condition then CdbStatus::NotFound 00105 * will be returned. Other status values are as usual. 00106 */ 00107 CdbStatus removeCondition( const CdbPathName& thePathName /**< the path name of the folder to be removed */ 00108 ); 00109 public: 00110 00111 // Accessors 00112 00113 ooString(32) name ( ) const; 00114 ooString(32) description( ) const; 00115 00116 BdbTime created( ) const; 00117 00118 BdbRef(CdbBdbSViewP) parentView ( ) const; 00119 BdbRef(CdbBdbSFolderP) parentFolder( ) const; 00120 00121 /// Find the folder 00122 /** 00123 * This operation requires the relative path to the required object. Upon successfull 00124 * completion it will return CdbStatus::Success. If the object is not found 00125 * CdbStatus::NotFound will be returned, The error status will be returned in other cases. 00126 */ 00127 CdbStatus findFolder( const CdbPathName& thePathName, /**< the relative path name to the folder */ 00128 BdbRef(CdbBdbSFolderP)& theRef /**< the reference to the found object to be set up */ 00129 ) const; 00130 00131 /// Find the condition 00132 /** 00133 * This operation requires the relative path to the required object. Upon successfull 00134 * completion it will return CdbStatus::Success. If the object is not found 00135 * CdbStatus::NotFound will be returned, The error status will be returned in other cases. 00136 */ 00137 CdbStatus findCondition( const CdbPathName& thePathName, /**< the relative path name to the condition */ 00138 BdbRef(CdbBdbSConditionAtFolderP)& theRef /**< the reference to the found object to be set up */ 00139 ) const; 00140 00141 /// Set up an iterator of folder names 00142 /** 00143 */ 00144 CdbStatus folderIterator( CdbItr< const char* >& theItr /**< the value of the iterator be set up */ 00145 ) const; 00146 00147 /// Set up an iterator of condition names 00148 /** 00149 */ 00150 CdbStatus conditionIterator( CdbItr< const char* >& theItr /**< the value of the iterator be set up */ 00151 ) const; 00152 00153 /// Dump the contents of the object 00154 /** 00155 */ 00156 void dump( std::ostream& o ) const; 00157 00158 private: 00159 00160 // Data members 00161 00162 ooString(32) _name; 00163 ooString(32) _description; 00164 00165 BdbTime _created; 00166 00167 BdbRef(CdbBdbSViewP) _parentViewRef; 00168 BdbRef(CdbBdbSFolderP) _parentFolderRef; 00169 00170 BdbRef(ooMap) _foldersMapRef; 00171 BdbRef(ooMap) _conditionsMapRef; 00172 }; 00173 00174 #endif /* CDBBDBSHARED_FOLDER_P_HH */
1.3-rc3