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

CdbStateId.hh

Go to the documentation of this file.
00001 #ifndef CDB_STATE_ID_HH
00002 #define CDB_STATE_ID_HH
00003 
00004 // File and Version Information:
00005 //      $Id: CdbStateId.hh,v 1.6 2004/08/06 05:54:14 bartoldu Exp $
00006 
00007 #include "CdbBase/CdbId.hh"
00008 
00009 #include "BdbTime/BdbTime.hh"
00010 
00011 #include <iostream>
00012 
00013 /// The "State Identifier" class
00014 /**
00015   * Objects of this class are meant to identify the state of the Condition/DB
00016   * where it seems appropriate.
00017   */
00018 class CdbStateId {
00019 
00020 public:
00021 
00022   /// Default constructor
00023   /**
00024     * Sets an object into unusable state
00025     */
00026     CdbStateId( );
00027 
00028   /// The normal constructor
00029   /**
00030     * Loads an object with both identifier of a view and the most recent
00031     * modification time of the Condition/DB done in teh scope of the view.
00032     */
00033     CdbStateId( const CdbId&   theViewId,
00034                 const BdbTime& theModificationTime );
00035 
00036   /// The copy constructor
00037   /**
00038     * More details...
00039     */
00040     CdbStateId( const CdbStateId& theId );
00041 
00042   /// The asignment operator
00043   /**
00044     * More details...
00045     */
00046     CdbStateId& operator=( const CdbStateId& theId );
00047 
00048   /// The "equal" operator
00049   /**
00050     * Two objects are equal only if they have _exactly_ the same contents.
00051     */
00052     bool operator==( const CdbStateId& theId ) const;
00053 
00054   /// The "not-equal" operator
00055   /**
00056     * @see CdbStateId::operator==()
00057     */
00058     inline bool operator!=( const CdbStateId& theId ) const;
00059 
00060   // Accessors
00061 
00062     inline CdbId   viewId          ( ) const;
00063     inline BdbTime modificationTime( ) const;
00064 
00065   /// Check if the identifier is in the valid state.
00066   /**
00067     * One way the object may get into the non valid state is to initialize
00068     * the object through the default constructor.
00069     */
00070     bool isValid( ) const;
00071 
00072 private:
00073 
00074     CdbId   _viewId;
00075     BdbTime _modificationTime;
00076 };
00077 
00078 // Inline implementations for the methods and operators of the class
00079 
00080 inline
00081 bool
00082 CdbStateId::operator!=( const CdbStateId& theId ) const
00083 {
00084     return ! operator==( theId );
00085 }
00086 
00087 inline
00088 CdbId
00089 CdbStateId::viewId( ) const
00090 {
00091     return _viewId;
00092 }
00093 
00094 inline
00095 BdbTime
00096 CdbStateId::modificationTime( ) const
00097 {
00098     return _modificationTime;
00099 }
00100 
00101 inline
00102 std::ostream&
00103 operator<<( std::ostream&          o,
00104             const CdbStateId& theId )
00105 {
00106     o << theId.viewId( ) << " [ " << theId.modificationTime( ) << " ]";
00107     return o;
00108 }
00109 #endif  // CDB_STATE_ID_HH

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