#ifndef Date_OS_SEEN #define Date_OS_SEEN /////// File Date_OS.h /////// #include "Date.h" #include "OrderedSeq.h" class Date_OS : public OrderedSeq { public: Date_OS() : len(0) { } // default constructor Uint length() { return(len); } // current length of seq Date* operator[](Uint i); // overloading [] void remove(Uint i); // remove by index protected: int append(void* date); // add any at end, -1 failed private: void swap(Uint i, Uint j); // interchange elements int cmp(Uint i, Uint j); // compare elements int cmp(void* date, Uint j); // compare key to element enum {Max=256}; Date* dates[Max]; // pointer array Uint len; // total no. of dates }; inline void Date_OS::swap(Uint i, Uint j) { Date* tmp = dates[i]; dates[i] = dates[j]; dates[j] = tmp; } inline int Date_OS::cmp(Uint i, Uint j) { return dates[i]->cmp(*dates[j]); } inline int Date_OS::cmp(void* date, Uint j) { Date* tmp = (Date*) date; return tmp->cmp(*dates[j]); } #endif