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  

/CdbBdbShared/CdbBdbSDatabaseItr.cc

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

 


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

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