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

CdbItr.cc

Go to the documentation of this file.
00001 // File and Version Information:
00002 //      $Id: CdbItr.cc,v 1.9 2005/07/26 00:06:25 gapon Exp $
00003 
00004 /// The implementation of the CdbItr class.
00005 /**
00006   * @see CdbItr
00007   */
00008 
00009 #include "BaBar/BaBar.hh"
00010 
00011 #include "CdbBase/CdbItr.hh"
00012 
00013 #include "ErrLogger/ErrLog.hh"
00014 
00015 template < typename T >
00016 CdbItr<T>::CdbItr( ) :
00017     _myItr(0)
00018 { }
00019 
00020 template < typename T >
00021 CdbItr<T>::CdbItr( const CdbItr<T>& theItr ) :
00022     _myItr(0)
00023 {
00024     set( theItr._myItr );
00025 }
00026 
00027 template < typename T >
00028 CdbItr<T>::CdbItr( CdbIItr<T>* thePtr ) :
00029     _myItr(thePtr)
00030 { }
00031 
00032 template < typename T >
00033 CdbItr<T>::~CdbItr( )
00034 {
00035     if( 0 != _myItr ) delete _myItr;
00036 }
00037 
00038 template < typename T >
00039 CdbItr<T>&
00040 CdbItr<T>::operator=( const CdbItr<T>& theItr )
00041 {
00042     if( this != &theItr ) set( theItr._myItr );
00043     return *this;
00044 }
00045 
00046 template < typename T >
00047 CdbStatus
00048 CdbItr<T>::reset( )
00049 {
00050     if( 0 == _myItr ) return CdbStatus::Error;
00051     return _myItr->reset( );
00052 }
00053 
00054 template < typename T >
00055 bool
00056 CdbItr<T>::next( )
00057 {
00058     if( 0 == _myItr ) return false;
00059     return _myItr->next( );
00060 }
00061 
00062 template < typename T >
00063 T
00064 CdbItr<T>::value( )
00065 {
00066     if( 0 == _myItr ) ErrMsg(fatal) << "Using inproperly initialized iterator." << endmsg;
00067     return _myItr->value( );
00068 }
00069 
00070 template < typename T >
00071 bool
00072 CdbItr<T>::isValid( )
00073 {
00074     return ( 0 != _myItr ) && _myItr->isValid( );
00075 }
00076 
00077 template < typename T >
00078 CdbIItr<T>*
00079 CdbItr<T>::clone( ) const
00080 {
00081     return new CdbItr<T>( *this );
00082 }
00083 
00084 template < typename T >
00085 void
00086 CdbItr<T>::set( const CdbIItr<T>* thePtr )
00087 {
00088     if( thePtr != _myItr ) {
00089         if( 0 != _myItr ) {
00090             delete _myItr;
00091             _myItr = 0;
00092         }
00093         if( 0 != thePtr ) _myItr = thePtr->clone( );
00094     }
00095 }
00096 
00097 /////////////////
00098 // End Of File //
00099 /////////////////

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