00001 // File and Version Information: 00002 // $Id: CdbBdbSConditionAtFolderPItr.cc,v 1.4 2002/09/23 22:41:07 gapon Exp $ 00003 00004 /// The implementation of the CdbBdbSConditionAtFolderPItr class. 00005 /** 00006 * @see CdbBdbSConditionAtFolderPItr 00007 */ 00008 00009 #include "BaBar/BaBar.hh" 00010 00011 #include "CdbBdbShared/CdbBdbSConditionAtFolderPItr.hh" 00012 #include "CdbBdbShared/CdbBdbSConditionAtFolderP.hh" 00013 00014 #include <assert.h> 00015 00016 CdbBdbSConditionAtFolderPItr::CdbBdbSConditionAtFolderPItr( const BdbRef(BdbMap)& theMapRef ) : 00017 _isValid(false), 00018 _hasEverBeenAdvanced(false), 00019 _mapRef(theMapRef) 00020 { 00021 assert( ! BdbIsNull(theMapRef)); 00022 } 00023 00024 CdbBdbSConditionAtFolderPItr::~CdbBdbSConditionAtFolderPItr( ) 00025 { } 00026 00027 CdbStatus 00028 CdbBdbSConditionAtFolderPItr::reset( ) 00029 { 00030 _isValid = false; 00031 _hasEverBeenAdvanced = false; 00032 00033 return CdbStatus::Success; 00034 } 00035 00036 bool 00037 CdbBdbSConditionAtFolderPItr::next( ) 00038 { 00039 if( ! _hasEverBeenAdvanced ) _mapItr = _mapRef; 00040 00041 if( _mapItr.next( )) { 00042 00043 BdbHandle(CdbBdbSConditionAtFolderP) conditionH; 00044 conditionH = (const BdbRef(CdbBdbSConditionAtFolderP)&) (_mapItr->oid( )); 00045 00046 if( ! BdbIsNull(conditionH) && conditionH.isValid( )) { 00047 00048 _value = conditionH->name( ); 00049 00050 _isValid = true; 00051 _hasEverBeenAdvanced = true; 00052 } 00053 00054 } else { 00055 00056 // We're beyond the end of the collection 00057 00058 _isValid = false; 00059 _hasEverBeenAdvanced = false; 00060 } 00061 return _isValid; 00062 } 00063 00064 CdbBdbSConditionAtFolderPItr::ValueType 00065 CdbBdbSConditionAtFolderPItr::value( ) 00066 { 00067 if( ! _isValid ) { 00068 assert( 0 ); // FATAL ERROR: Inproper use of the iterator!!! 00069 return 0; 00070 } 00071 return _value.head( ); 00072 } 00073 00074 bool 00075 CdbBdbSConditionAtFolderPItr::isValid( ) 00076 { 00077 return _isValid; 00078 } 00079 00080 CdbBdbSConditionAtFolderPItr::InterfaceType* 00081 CdbBdbSConditionAtFolderPItr::clone( ) const 00082 { 00083 // Note, that the resulting iterator will always be at the initial 00084 // state, even if the current one is not. See more details at the 00085 // header file. 00086 00087 return new CdbBdbSConditionAtFolderPItr( _mapRef ); 00088 } 00089 00090 ///////////////// 00091 // End Of File // 00092 /////////////////
1.3-rc3