Category : C Source Code
Archive   : NIH.ZIP
Filename : ITERATOR.HXX

 
Output of file : ITERATOR.HXX contained in archive : NIH.ZIP
#ifndef ITERATOR_H
#define ITERATOR_H

/* Iterator.hxx -- Declarations for Collection Iterators

THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
"UNITED STATES GOVERNMENT WORK". IT WAS WRITTEN AS A PART OF THE
AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE. THIS MEANS IT
CANNOT BE COPYRIGHTED. THIS SOFTWARE IS FREELY AVAILABLE TO THE
PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.

Author:
K. E. Gorlen
Computer Systems Laboratory, DCRT
National Institutes of Health
Bethesda, MD 20892
December, 1987

$Log: Iterator.hxx,v $
* Revision 1.3 88/02/04 12:59:26 keith
* Make Class class_CLASSNAME const.
*
* Revision 1.2 88/01/16 23:39:24 keith
* Remove pre-RCS modification history
*
*/

#include "Object.hxx"

class Collection;
class Link;

extern const Class class_Iterator;
#ifdef OBJECTIO
overload Iterator_reader;
#endif //OBJECTIO

class Iterator: public Object {
Collection* cltn; // Collection being iterated over
public:
int index; // index of next Object
Object* ptr; // pointer to current Object or NULL
unsigned num; // object number, used by Bags
protected:
#ifdef OBJECTIO
Iterator(fileDescTy&,Iterator&);
Iterator(istream&,Iterator&);
friend void Iterator_reader(istream& strm, Object& where);
friend void Iterator_reader(fileDescTy& fd, Object& where);
virtual void storer(fileDescTy&);
virtual void storer(ostream&);
#endif //OBJECTIO
public:
Iterator(const Collection&);
void reset(); // reset to beginning of Collection
Object* operator++(); // advance to next object in Collection
Collection* collection() { return cltn; }
bool operator==(const Iterator&);
bool operator!=(const Iterator& a) { return !(*this==a); }
virtual Object* copy(); // shallowCopy()
virtual void deepenShallowCopy(); // copy with cltn->deepCopy()
virtual unsigned hash();
virtual const Class* isA();
virtual bool isEqual(const Object&);
#ifdef OBJECTIO
virtual void printOn(ostream& strm);
#endif //OBJECTIO
virtual Object* shallowCopy(); // copy with cltn->copy()
virtual const Class* species();
};

#define DO(cltn,cls,arg)\
{ cls arg; Iterator DO_pos(cltn); while (arg = (cls)DO_pos++) {
#define OD }}

#endif


  3 Responses to “Category : C Source Code
Archive   : NIH.ZIP
Filename : ITERATOR.HXX

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/