#include <CdbAdapterItr.hh>
Inheritance diagram for CdbAdapterItr< T, I >:

Public Member Functions | |
| virtual | ~CdbAdapterItr () |
| The destructor. | |
| virtual CdbStatus | reset () |
| Reset an iterator to its initial state. | |
| virtual bool | next () |
| Advance an iterator to the next position. | |
| virtual T | value () |
| Obtain the currently reffered value. | |
| virtual bool | isValid () |
| Check if an iterator is valid. | |
Protected Member Functions | |
| CdbAdapterItr (CdbIItr< I > *theInputItrPtr) | |
| The normal constructor. | |
| CdbAdapterItr (const CdbAdapterItr< T, I > &theItr) | |
| The copy constructor. | |
| virtual T | toValue (const I &) const=0 |
| User defined translation for the currently referred value. | |
| virtual bool | isAccepted (const I &) const |
| Optional user defined filter for input objects. | |
This abstract class is meant to be used for rapid building of CDB API iterators of the "output" type out of input iterators of the "input" type of elements. The class is parameterized by two parameters:
T - "output" type of the iterator values produced by the current iterator I - "input" type of an input iterator's elements
A basic idea is that a value of the I type needs to be translated into the corresponding value of the T type. The translation is done through a special virtual method to be overloaded by a subclass.
In addition, the iterator provides an optional filtering mechanism to evaluate each input object withing the iterator's "::next()" method. That would allow (if needed by a subclass) to exclude certain objects out of the input sequence from being translated and delivered though the "::value()" and "::toValue()" method. The name of the method is "::isAccepted()". If the method returns "true" then the object is accepted, otherwise - it's rejected, and the iterator will go to the next object input object and so on. By default the method will accept all objects.
#include "CdbBase/CdbAdapterItr.hh"
class MyItr : public CdbAdapterItr<std::string, unsigned int> { public: MyItr( const CdbIItr<unsigned int>& theInputItr ) : CdbAdapterItr<std::string, unsigned int>( theInputItr ) { } protected: virtual std::string toValue( const unsigned int& theValue ) const { ... } virtual bool isAccepted( const unsigned int& theValue ) const { return ( theValue >= 0 ); } };
IMPLEMENTATION NOTE:
This particular implementation of the iterator has not been optimized to cache the translated values locally. This feature will be implemented later. Just keep this performance issue in mind when using the iterator.
Definition at line 59 of file CdbAdapterItr.hh.
|
||||||||||
|
The normal constructor. We'll take an input iterator whose values need to be retranslated to deliver values of specified "output" type as the iterator will advance. DESIGN NOTE: The iterator will take over the specified one. Definition at line 19 of file CdbAdapterItr.cc. |
|
||||||||||
|
The copy constructor.
Definition at line 32 of file CdbAdapterItr.cc. |
|
|||||||||
|
The destructor.
Definition at line 38 of file CdbAdapterItr.cc. |
|
||||||||||
|
Optional user defined filter for input objects. This method is being called by the "::next()" method of the current implementation of the itarator for each input object in order to determine if that object needs to be translated or filtered out. If the method returns "true" then the object is accepted, otherwise - it's rejected, and the iterator will go to the next object input object and so on. The default implementation of the method would accept all objects. The method can be optionally implemented by a subclass.
Definition at line 158 of file CdbAdapterItr.hh. Referenced by CdbAdapterItr< T, I >::next(). |
|
|||||||||
|
Check if an iterator is valid. This implements the corresponding method of the base class.
Implements CdbIItr< T >. Definition at line 86 of file CdbAdapterItr.cc. References CdbIItr< I >::isValid(). |
|
|||||||||
|
Advance an iterator to the next position. This implements the corresponding method of the base class.
Implements CdbIItr< T >. Definition at line 57 of file CdbAdapterItr.cc. References CdbAdapterItr< T, I >::isAccepted(), CdbIItr< I >::next(), and CdbIItr< I >::value(). |
|
|||||||||
|
Reset an iterator to its initial state. This implements the corresponding method of the base class.
Implements CdbIItr< T >. Definition at line 49 of file CdbAdapterItr.cc. References CdbIItr< I >::reset(). |
|
||||||||||
|
User defined translation for the currently referred value. This method is being called by the current implementation of the itarator to translate the desired information out of the currently refered element of the input iterator passed to the class's constructor. The method is supposed to be implemented by a subclass.
Implemented in CdbSTD2CStrAdapterItr. Referenced by CdbAdapterItr< T, I >::value(). |
|
|||||||||
|
Obtain the currently reffered value. This implements the corresponding method of the base class.
Implements CdbIItr< T >. Definition at line 71 of file CdbAdapterItr.cc. References CdbIItr< I >::isValid(), CdbAdapterItr< T, I >::toValue(), and CdbIItr< I >::value(). |
1.3-rc3