#ifndef _UVMAP_H #define _UVMAP_H #include "map.h" #include "vector.h" #include "uviterator.h" // implement the map class using an unsorted vector of elements // // Owen Astrachan 11/8/95 // // performance: IncludesKey is O(n) for an n-element map // GetValue also O(n), Insert is O(n) because of find // // template class UVMapIterator; template class UVMap : public Map { public: UVMap(int size); // set size of vector ~UVMap(); virtual void Apply(void (*Func) (Pair & p)); // apply Func virtual void Apply(MapBase & obj); // apply obj virtual bool IncludesKey(const Key & key) const; // is key in map? virtual const Value& GetValue(const Key & key) const; // get value virtual Value& GetValue(const Key & key); // get value virtual void GetValue(Pair & pair); // get value virtual void Delete(const Key & key); virtual void Insert(const Key & key, const Value & value); virtual void Insert(const Pair & pair); // add pair to map // (no duplicates) friend class UVMapIterator >; virtual Iterator > * MakeIterator(); protected: virtual int Find(const Key & key) const; // return location of key void CheckSize(); Vector > myList; // storage for table int myNumElts; // # elements stored UVMap(const UVMap & map); // disable copy constructor UVMap& operator=(const UVMap & map); // disable assignments }; #endif // _UVMAP_H undefined