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  

/CdbBdbWrapper/CdbBdbWDatabaseItr.cc

Go to the documentation of this file.
00001 /// The implementation of the CdbBdbWDatabaseItr class.
00002 /**
00003   * @see CdbBdbWDatabaseItr
00004   */
00005 
00006 #include "CdbBdbWrapper/CdbBdbWDatabaseItr.hh"
00007 
00008 #include "CdbBase/Cdb.hh"
00009 
00010 #include <assert.h>
00011 
00012 CdbBdbWDatabaseItr::CdbBdbWDatabaseItr( const CdbPtr& theParent ) :
00013     _myParent(theParent),
00014     _isValid(false),
00015     _hasEverBeenAdvanced(false),
00016     _value("")
00017 {
00018     assert( !theParent.isNull( ));
00019 }
00020 
00021 CdbBdbWDatabaseItr::CdbBdbWDatabaseItr( const CdbBdbWDatabaseItr& theItr ) :
00022     _myParent(theItr._myParent),
00023     _isValid(theItr._isValid),
00024     _hasEverBeenAdvanced(theItr._hasEverBeenAdvanced),
00025     _value(theItr._value)
00026 { }
00027 
00028 CdbBdbWDatabaseItr::~CdbBdbWDatabaseItr( )
00029 { }
00030 
00031 CdbStatus
00032 CdbBdbWDatabaseItr::reset( )
00033 {
00034     _isValid             = false;
00035     _hasEverBeenAdvanced = false;
00036 
00037     _value = "";
00038 
00039     return CdbStatus::Success;
00040 }
00041 
00042 bool
00043 CdbBdbWDatabaseItr::next( )
00044 {
00045     if( _hasEverBeenAdvanced )
00046         _isValid = false;
00047     else {
00048         _value = _myParent->defaultDatabase( );
00049 
00050         _isValid             = true;
00051         _hasEverBeenAdvanced = true;
00052     }
00053     return _isValid;
00054 }
00055 
00056 CdbBdbWDatabaseItr::ValueType
00057 CdbBdbWDatabaseItr::value( )
00058 {
00059     if( _isValid ) return _value.c_str( );
00060     return 0;
00061 }
00062 
00063 bool
00064 CdbBdbWDatabaseItr::isValid( )
00065 {
00066     return _isValid;
00067 }
00068 
00069 CdbBdbWDatabaseItr::InterfaceType*
00070 CdbBdbWDatabaseItr::clone( ) const
00071 {
00072     return new CdbBdbWDatabaseItr( *this );
00073 }
00074 
00075 /////////////////
00076 // End Of File //
00077 /////////////////

 


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

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