![]() |
|
|
Bdb packages | Design docs | Source docs | Guidelines | Recent releases |
|
Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members /CdbBdbShared/CdbBdbSConfigElement.hh
Go to the documentation of this file.00001 #ifndef CDBBDBSHARED_CONFIG_ELEMENT_HH 00002 #define CDBBDBSHARED_CONFIG_ELEMENT_HH 00003 00004 //----------------------------------------------------------------------------- 00005 // 00006 // File and Version Information: 00007 // $Id: CdbBdbSConfigElement.hh,v 1.4 2002/07/19 23:25:51 gapon Exp $ 00008 // 00009 // Description: 00010 // Class CdbBdbSConfigElement. Objects of this embedded class represent 00011 // simple condition configuration elements. 00012 // 00013 // Environment: 00014 // Software developed for the BaBar Detector at the SLAC B-Factory. 00015 // 00016 // Author List: 00017 // Igor A. Gaponenko Original author 00018 // 00019 // Copyright Information: 00020 // Copyright (C) 2002 Lawrence Berkeley Laboratory 00021 // 00022 //----------------------------------------------------------------------------- 00023 00024 //-------------------- 00025 // Database Headers -- 00026 //-------------------- 00027 00028 #include "BdbUtil/Bdb.hh" 00029 00030 //------------------------------- 00031 // Collaborating Class Headers -- 00032 //------------------------------- 00033 00034 #include "CdbBase/CdbCommon.hh" 00035 00036 #include "BdbTime/BdbTime.hh" 00037 00038 //--------------- 00039 // C++ Headers -- 00040 //--------------- 00041 00042 #include <iostream.h> 00043 00044 /// Objects of this class represent simple condition configuration elements 00045 /** 00046 * This is an embedded class. 00047 */ 00048 class CdbBdbSConfigElement { 00049 00050 public: 00051 00052 /// Normal & default constructor 00053 /** 00054 * The default constructor will put the element into the "NO ACCESS" state. 00055 * This state can be checked by calling the corresponding method defined below. 00056 * 00057 * @see CdbBdbSConfigElement::accessIsAllowed( ) 00058 */ 00059 CdbBdbSConfigElement( const BdbTime& theRevisionId = BdbTime::minusInfinity, 00060 d_UShort thePartitionId = 0, 00061 bool useRevisionFlag = true ) : 00062 revision (theRevisionId), 00063 partition (thePartitionId), 00064 useRevision(useRevisionFlag) 00065 { } 00066 00067 /// Copy constructor 00068 /** 00069 */ 00070 CdbBdbSConfigElement( const CdbBdbSConfigElement& theElement ) : 00071 revision (theElement.revision), 00072 partition (theElement.partition), 00073 useRevision(theElement.useRevision) 00074 { } 00075 00076 /// The destructor 00077 /** 00078 * NOTE: The destructor is NOT virtual because this is an embedded 00079 * class. 00080 */ 00081 ~CdbBdbSConfigElement( ) { } 00082 00083 /// The assignment operator 00084 /** 00085 */ 00086 CdbBdbSConfigElement& operator=( const CdbBdbSConfigElement& theElement ) 00087 { 00088 if( this != &theElement ) { 00089 revision = theElement.revision; 00090 partition = theElement.partition; 00091 useRevision = theElement.useRevision; 00092 } 00093 return *this; 00094 } 00095 00096 /// Check if the current element is not in the "NO ACCESS" state 00097 00098 bool accessIsAllowed( ) const { 00099 return BdbTime::minusInfinity != revision; 00100 } 00101 00102 public: 00103 00104 BdbTime revision; // Revision ID 00105 d_UShort partition; // Partition ID 00106 00107 // The following flag is indicating if specified revision is supposed 00108 // to be used for partitioned conditions rather than its (the partition's) 00109 // "modification time". 00110 // 00111 // NOTE: This flag does not make any sense for the non-partitioned 00112 // conditions. 00113 00114 d_Boolean useRevision; 00115 }; 00116 00117 inline 00118 ostream& 00119 operator<<( ostream& o, 00120 const CdbBdbSConfigElement& theElement ) 00121 { 00122 o << "REVISION: " << theElement.revision.getGmtSec( ) << "." << theElement.revision.getGmtNsec( ) << ", " 00123 << "PARTITION: " << theElement.partition << ", " 00124 << "USE REVISION: " << ( theElement.useRevision ? "Yes" : "No" ); 00125 return o; 00126 } 00127 00128 #endif // CDBBDBSHARED_CONFIG_ELEMENT_HH
BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us
Page Owner: Jacek Becla
Last Update: October 04, 2002