Listing 3: Template class ObjFileIter

#include "objfile.h"

template < class ObjType >
class ObjFileIter {
public:

/*Constructors */

    ObjFileIter( ObjFile<ObjType> & iter_file );
    ~ObjFileIter();

// not shown: selectors, file manipulation modifiers, index
// manipulation modifiers, read/write routines, 

ISAMError GetCur (ObjType & obj, boolean lock = FALSE);

    // operators
    // =========

    ObjType & operator++();             // GetNext
    ObjType & operator++(int);          // postfix - not as efficient
    ObjType & operator--();             // GetPrev
    ObjType & operator--(int);          // postfix - not as efficient
    ObjType & operator ()();            // GetCur;
    ObjFileIter<ObjType> & operator=( ObjFileIter<ObjType> & other );
    boolean IsNull( const ObjType & obj ) const; // to check EOF
                                                 // with operators
private:

    ObjIndexKey         curIndexKey_;
    ISAMFile::CountType curObjNum_;
    ISAMError      lastError_;     // valid only with methods which
                                   // don't return error codes
    ObjFile<ObjType> &  iterFile_;
    ISAMFile::AccessID  streamId_;
    ObjType             retObject_; // used by operators ++, --, (),
                                    // and casting operators
};
/* End of File */