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

CdbBdbSSimpleConfigIterator.cc

Go to the documentation of this file.
00001 // File and Version Information:
00002 //      $Id: CdbBdbSSimpleConfigIterator.cc,v 1.1 2004/05/12 17:26:28 gapon Exp $
00003 
00004 /// Implementation file for the CdbBdbSSimpleConfigIterator class
00005 /**
00006   * @see CdbBdbSCi
00007   */
00008 
00009 #include "BaBar/BaBar.hh"
00010 
00011 #include "CdbBdbShared/CdbBdbSSimpleConfigIterator.hh"
00012 
00013 CdbBdbSSimpleConfigIterator::CdbBdbSSimpleConfigIterator( const CdbBdbSSimpleConfigIterator& theItr ) :
00014     _isValid            (theItr._isValid),
00015     _hasEverBeenAdvanced(theItr._hasEverBeenAdvanced),
00016     _value              (theItr._value)
00017 { }
00018 
00019 CdbBdbSSimpleConfigIterator::CdbBdbSSimpleConfigIterator( const CdbBdbSConfigElement& theConfigElement,
00020                                                           const BdbTime&              theBeginTime,
00021                                                           const BdbTime&              theEndTime ) :
00022     _isValid               (false),
00023     _hasEverBeenAdvanced   (false),
00024     _value(CdbBdbSConfigInterval( theConfigElement,
00025                                   theBeginTime,
00026                                   theEndTime ))
00027 { }
00028 
00029 CdbBdbSSimpleConfigIterator::CdbBdbSSimpleConfigIterator( const CdbBdbSConfigInterval& theConfigInterval ) :
00030     _isValid               (false),
00031     _hasEverBeenAdvanced   (false),
00032     _value(theConfigInterval)
00033 { }
00034 
00035 CdbBdbSSimpleConfigIterator::~CdbBdbSSimpleConfigIterator( )
00036 { }
00037 
00038 CdbStatus
00039 CdbBdbSSimpleConfigIterator::reset( )
00040 {
00041     _isValid             = false;
00042     _hasEverBeenAdvanced = false;
00043 
00044     return CdbStatus::Success;
00045 }
00046 
00047 bool
00048 CdbBdbSSimpleConfigIterator::next( )
00049 {
00050     if( _isValid ) {
00051 
00052       // Now we've got into the "PAST_LAST_ELEMENT" state.
00053 
00054         _isValid = false;
00055 
00056     } else {
00057 
00058         if( !_hasEverBeenAdvanced ) {
00059 
00060             _isValid             = true;
00061             _hasEverBeenAdvanced = true;
00062 
00063         } else {
00064 
00065           // Otherwise this iterator should remain at "PAST_LAST_ELEMENT" state.
00066           // The only way to get out of this state is to to call ::reset() method.
00067 
00068             ;
00069         }
00070     }
00071     return _isValid;
00072 }
00073 
00074 CdbBdbSSimpleConfigIterator::ValueType
00075 CdbBdbSSimpleConfigIterator::value( )
00076 {
00077     if( _isValid ) {
00078         return _value;
00079     }
00080 
00081   // Invalid interval initialized with default constructor.
00082 
00083     return CdbBdbSConfigInterval( );
00084 }
00085 
00086 bool
00087 CdbBdbSSimpleConfigIterator::isValid( )
00088 {
00089     return _isValid;
00090 }
00091 
00092 CdbBdbSSimpleConfigIterator::InterfaceType*
00093 CdbBdbSSimpleConfigIterator::clone( ) const
00094 {
00095     return new CdbBdbSSimpleConfigIterator( *this );
00096 }
00097 
00098 /////////////////
00099 // End Of File //
00100 /////////////////

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