Bdb packages | Design docs | Source docs | Guidelines | Recent releases

Search | Site Map .

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

/CdbBase/CdbStateControl.hh

Go to the documentation of this file.
00001 #ifndef CDB_STATE_CONTROL_HH
00002 #define CDB_STATE_CONTROL_HH
00003 
00004 #include "CdbBase/CdbCommon.hh"
00005 
00006 /// The state control interface for the API classes
00007 /**
00008   * This interface incorporates external controls for the API components,
00009   * whose instances maintain dynamic relaishionship with the corresponding
00010   * persistent entities.
00011   *
00012   * In the current design of the API only the following groups
00013   * of controls are defined:
00014   *
00015   * - the one providing opening, closing and enquiering the current state of
00016   *   a connection with the corresponding persistent entity.
00017   *
00018   * - the one providing the "validity" of an interface's instance. Here the idea
00019   *   is that at some point of time an API component may become "invalid" (which
00020   *   means non-usable in given context) even if this component was created
00021   *   "valid" at the beginning.
00022   *
00023   */
00024 class CdbStateControl {
00025 
00026 protected:
00027 
00028   /// The destructor.
00029   /**
00030     * Is only available for the derived classes and friends to prevent accidental
00031     * deletion of objects.
00032     */
00033     virtual ~CdbStateControl( );
00034 
00035 public:
00036 
00037   /// Check if the current API context is valid.
00038   /**
00039     * The precise definition of the "valid" depends on an API component
00040     * implementing this interface. However the general assumption is that
00041     * it is "usable" to communicate with the corresponding persistent
00042     * counterpart.
00043     *
00044     * @return true if a component is valid
00045     */
00046     virtual bool isValid( ) = 0;
00047 
00048   /// Check if the current API component is open.
00049   /**
00050     * This flag makes a sense only if the database is "valid".
00051     * It's role is to indicate if the current API component has
00052     * established reliable and consistent communication with
00053     * the corresponding persistent entity.
00054     *
00055     * @return true if the component is open
00056     */
00057     virtual bool isOpen( ) = 0;
00058 
00059   /// Open the component.
00060   /**
00061     * This will connect the API component with the corresponding
00062     * persistent entity.
00063     *
00064     * @see CdbStatus
00065     *
00066     * @return the completion status
00067     */
00068     virtual CdbStatus open( ) = 0;
00069 
00070   /// Close the component.
00071   /**
00072     * Drop the open onnection with the corresponding persistent entity.
00073     *
00074     * @see CdbStatus
00075     *
00076     * @return the completion status
00077     */
00078     virtual CdbStatus close( ) = 0;
00079 };
00080 
00081 #endif  // CDB_STATE_CONTROL_HH

 


BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us

Page Owner: Jacek Becla
Last Update: October 04, 2002