00001 #ifndef CDB_I_ITR_HH 00002 #define CDB_I_ITR_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbIItr.hh,v 1.4 2005/07/26 00:06:25 gapon Exp $ 00006 00007 #include "CdbBase/CdbCommon.hh" 00008 00009 /// The base interface for the iterator classes 00010 /** 00011 * This is a template base class for the other iterators used in the project. 00012 * The class is parametrized by the object type to be iterated. 00013 */ 00014 template< typename T > 00015 class CdbIItr { 00016 00017 public: 00018 00019 /// This is a type of a base iterator interface 00020 /// 00021 typedef CdbIItr<T> InterfaceType; 00022 00023 /// Introduce a type definition for the purpose of easier reference 00024 /** 00025 * This definition provides access to the type of the parameter used 00026 * for the concrete template instantiation. 00027 */ 00028 typedef T ValueType; 00029 00030 public: 00031 00032 /// Make a clone of itself 00033 /** 00034 * This method has to be implemented by subclasses. It's meant to provide 00035 * a clone of the iterator and return a pointer onto a new object. 00036 * 00037 * @return a pointer onto a clone 00038 */ 00039 virtual CdbIItr<T>* clone( ) const = 0; 00040 00041 /// The destructor 00042 /** 00043 * Making the destructor of this clas virtual reinforces the derived classes 00044 * also have the virtual ones. 00045 */ 00046 virtual ~CdbIItr( ); 00047 00048 /// Reset an iterator to its initial state. 00049 /** 00050 * This will reset an iterator to the state it was before the very first 00051 * call to the CdbIItr::next method. 00052 * 00053 * @see CdbIItr::next 00054 * 00055 * @return the completion status 00056 */ 00057 virtual CdbStatus reset( ) = 0; 00058 00059 /// Advance an iterator to the next position. 00060 /** 00061 * This is the first method to be called upon the initialization of the 00062 * of the iterator's scope. 00063 * 00064 * @return true if the operation succeded 00065 */ 00066 virtual bool next( ) = 0; 00067 00068 /// Obtain the currently reffered value. 00069 /** 00070 * This operation makes only sense if the previously issued CdbIItr::next 00071 * operation succeded. Otherwise an undefined value will be returned. 00072 * 00073 * @see CdbIItr::next 00074 * 00075 * @return a value of the currently reffered value 00076 */ 00077 virtual T value( ) = 0; 00078 00079 /// Check if an iterator is valid. 00080 /** 00081 * "Valid" means that an iterator is in the right scope, is pointing onto 00082 * some valid element and is not past the end of the iterated sequence. 00083 * 00084 * @return true if valid 00085 */ 00086 virtual bool isValid( ) = 0; 00087 }; 00088 00089 #ifdef BABAR_COMP_INST 00090 #include "CdbBase/CdbIItr.cc" 00091 #endif // BABAR_COMP_INST 00092 00093 #endif // CDB_I_ITR_HH
1.3-rc3