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

CdbFolder.hh

Go to the documentation of this file.
00001 #ifndef CDB_FOLDER_HH
00002 #define CDB_FOLDER_HH
00003 
00004 // File and Version Information:
00005 //      $Id: CdbFolder.hh,v 1.9 2003/08/13 23:34:13 gapon Exp $
00006 
00007 #include "CdbBase/CdbStateControl.hh"
00008 #include "CdbBase/CdbFolderLocator.hh"
00009 #include "CdbBase/CdbCloneable.hh"
00010 
00011 #include "CdbBase/CdbCPtrBase.hh"
00012 #include "CdbBase/CdbFolderPtrFwd.hh"
00013 #include "CdbBase/CdbViewPtrFwd.hh"
00014 #include "CdbBase/CdbConditionPtrFwd.hh"
00015 #include "CdbBase/CdbConditionItr.hh"
00016 
00017 #include <string>
00018 
00019 class CdbId;
00020 class BdbTime;
00021 
00022 /// The transient representation for the persistent folder.
00023 /**
00024   * This class also includes the CdbStateControl, CdbFolderLocator
00025   * and CdbCloneable interfaces.
00026   *
00027   * Note, that this is an abstract class specifying the interface to the folder.
00028   * It also maintains the general status of an object of the CdbFolder class as it's seen to its
00029   * clients through the API.
00030   *
00031   * @see CdbStateControl
00032   * @see CdbFolderLocator
00033   * @see CdbCloneable
00034   */
00035 class CdbFolder : public    CdbStateControl,
00036                   public    CdbFolderLocator,
00037                   protected CdbCloneable< CdbFolder > {
00038 
00039 friend class CdbCPtrBase< CdbFolder >;
00040 
00041 private:
00042 
00043   /// The default constructor (NOT IMPLEMENTED)
00044   /**
00045     * Is disabled...
00046     */
00047     CdbFolder( );
00048 
00049 protected:
00050 
00051   /// The normally used constructor will set the internal parameters
00052   /// of an object.
00053   /**
00054     * Initialize the context of the Folder with specified set of parameters. This
00055     * will also validate the internal state of the object.
00056     *
00057     * If the folder was already open it will be closed before replacing the
00058     * parameters.
00059     *
00060     * @see CdbView
00061     * @see CdbViewPtr
00062     * @see CdbFolderPtr
00063     */
00064     CdbFolder( const CdbViewPtr&   theViewPtr,      /**< the smart pointer providing a back link to the parent view */
00065                const CdbFolderPtr& theFolderPtr,    /**< the smart pointer providing a back link to the parent folder */
00066                const char*         theName          /**< the name of the folder */
00067              );
00068 
00069   /// The copy constructor
00070   /**
00071     * Details...
00072     */
00073     CdbFolder( const CdbFolder& theFolder );
00074 
00075   /// The destructor.
00076   /**
00077     * Is only available for the derived classes and friends to prevent accidental
00078     * deletion of objects.
00079     */
00080     virtual ~CdbFolder( );
00081 
00082   /// The assignment operator
00083   /**
00084     * Details...
00085     */
00086     CdbFolder& operator=( const CdbFolder& theFolder );
00087 
00088 public:
00089 
00090   /// Static locator for a folder object
00091   /**
00092     * Locates specified folder object and returns a smart pointer to the transient
00093     * object of the current class. This "shortcut" allows to avoid the complicated
00094     * multi-staged process of the object location, which is useless when
00095     * the intermediate objects are not needed.
00096     *
00097     * The last parameter (a pointer to the top-level Cdb singleton) is optional. If 0 is
00098     * passed then a default instance is used.
00099     *
00100     * Note, that if specified object is not found then a smart pointer is initialized
00101     * to point to 0.
00102     *
00103     * @see Cdb
00104     * @see CdbFolderPtr
00105     * @see CdbStatus
00106     *
00107     * @return a completion status
00108     */
00109     static CdbStatus instance( CdbFolderPtr& theFolderPtr,              /**< the smart pointer to be initialized */
00110                                const char*   theFullPathName,           /**< the full path name of the folder */
00111                                const char*   theViewName           = 0, /**< the view name */
00112                                const char*   theDatabaseName       = 0, /**< the database name */
00113                                const char*   theImplementationName = 0, /**< the implementation name */
00114                                const char*   theTechnologyName     = 0  /**< the technology name */
00115                              );
00116 
00117   /// Static locator for a folder object
00118   /**
00119     * Unlike the previous method this one requires extended identifier
00120     * of a view.
00121     *
00122     * @see CdbId
00123     */
00124     static CdbStatus instance( CdbFolderPtr& theFolderPtr,              /**< the smart pointer to be initialized */
00125                                const char*   theFullPathName,           /**< the full path name of the folder */
00126                                const CdbId&  theViewId,                 /**< the view identifier */
00127                                const char*   theDatabaseName       = 0, /**< the database name */
00128                                const char*   theImplementationName = 0, /**< the implementation name */
00129                                const char*   theTechnologyName     = 0  /**< the technology name */
00130                              );
00131 
00132 public:
00133 
00134   /// Return a smart pointer to the parent CdbView object.
00135   /**
00136     * @see CdbView
00137     * @see CdbViewPtr
00138     */
00139     const CdbViewPtr& parentView( ) const;
00140 
00141   /// Return a smart pointer to the parent CdbFolder object.
00142   /**
00143     * @see CdbFolder
00144     * @see CdbFolderPtr
00145     */
00146     const CdbFolderPtr& parentFolder( ) const;
00147 
00148   /// Obtain the current name of the CdbFolder.
00149   /**
00150     * It's guranteed that the returned pointer will point onto non 0 string.
00151     *
00152     * @return a const pointer on to the object's name
00153     */
00154     const char* name( ) const;
00155 
00156   /// Obtain the creation time of the folder
00157   /**
00158     * This method is supposed to be implemented by the corresponding subclass.
00159     *
00160     * @return a string with the object's description
00161     */
00162     virtual BdbTime created( ) const = 0;
00163 
00164   /// Obtain the folder description
00165   /**
00166     * This method is supposed to be implemented by the corresponding subclass.
00167     *
00168     * @return a string with the object's description
00169     */
00170     virtual std::string description( ) const = 0;
00171 
00172   /// Find the specified condition
00173   /**
00174     * This method is supposed to be implemented by the corresponding subclass.
00175     *
00176     * This method initializes a smart pointer to a transient object of
00177     * the CdbCondition class representing the found condition. It will
00178     * initialize the smart pointer to point onto 0 and return the corresponding
00179     * error statuswhen specified object is not found or is not awailable for some
00180     * other reason.
00181     *
00182     * The only characteristics of the condition is its name. This name should not be
00183     * a 0 pointer.
00184     *
00185     * @see CdbCondition
00186     * @see CdbConditionPtr
00187     * @see CdbStatus
00188     *
00189     * @return a completion status of the operation
00190     */
00191     virtual CdbStatus findCondition( CdbConditionPtr& theConditionPtr,  /**< a smart pointer to an object to be initialized */
00192                                      const char*      theName           /**< the name of an object to be found */
00193                                    ) = 0;
00194 
00195   /// Initialize an instance of an iterator for the known conditions names
00196   /**
00197     * This method is supposed to be implemented by the corresponding subclass.
00198     *
00199     * The iterator will be set into a "valid" state upon successfull completion.
00200     *
00201     * @see CdbIItr::isValid()
00202     * @see CdbCondition
00203     * @see CdbConditionItr
00204     * @see CdbStatus
00205     *
00206     * @return completion status
00207     */
00208     virtual CdbStatus conditionIterator( CdbConditionItr& theItr ) = 0;
00209 
00210 private:
00211 
00212     CdbViewPtr   _myViewPtr;
00213     CdbFolderPtr _myFolderPtr;
00214 
00215     std::string _myName;
00216 };
00217 
00218 #endif  // CDB_FOLDER_HH

Generated on Mon Dec 5 18:22:05 2005 for CDB by doxygen1.3-rc3