// file: $isip/class/search/History/History.h // version: $Id: History.h 9029 2003-02-15 17:08:33Z alphonso $ // // make sure definitions are only made once // #ifndef ISIP_HISTORY #define ISIP_HISTORY // isip include files // #ifndef ISIP_STACK #include #endif #ifndef ISIP_VECTOR_ULONG #include #endif // forward class declaration: // class Context; // History: a class to keep track of the history through a search. it acts // like a stack where graph vertices can be push'd onto and pop'd off of // the history list. the majority of the useful interface is inherited // from the Stack class // class History : public Stack { //--------------------------------------------------------------------------- // // public constants // //--------------------------------------------------------------------------- public: // define the class name // static const String CLASS_NAME; //---------------------------------------- // // i/o related constants // //---------------------------------------- //---------------------------------------- // // default values and arguments // //---------------------------------------- // define default arguments to methods // static const ulong DEF_REF_INCR = 1; static const ulong DEF_REF_DECR = 1; //--------------------------------------- // // error codes // //--------------------------------------- static const int32 ERR = (int32)90100; //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // static debug level // static Integral::DEBUG debug_level_d; // static memory manager // static MemoryManager mgr_d; //--------------------------------------------------------------------------- // // required public methods // //--------------------------------------------------------------------------- public: // method: name // static const String& name() { return CLASS_NAME; } // other static methods // static bool8 diagnose(Integral::DEBUG debug_level); // the debug method is inherited from the Stack class // // method: setDebug // static bool8 setDebug(Integral::DEBUG debug_level) { debug_level_d = debug_level; return true; } // method: destructor // ~History() { if (debug_level_d >= Integral::ALL) { fprintf(stdout, "Destructor of history: %p\n", this); fflush(stdout); } } // method: default constructor // History() { if (debug_level_d >= Integral::ALL) { fprintf(stdout, "Constructor of history: %p\n", this); fflush(stdout); } setAllocationMode(DstrBase::USER); } // method: copy constructor // History(const History& copy_history) { if (debug_level_d >= Integral::ALL) { fprintf(stdout, "Constructor of history: %p\n", this); fflush(stdout); } setAllocationMode(DstrBase::USER); assign(copy_history); } // the assign eq and operator= methods are inherited from the Stack class // // method: sofSize // int32 sofSize() const { return Stack::sofSize(); } // method: read // bool8 read(Sof& sof, int32 tag, const String& name = CLASS_NAME) { return Stack::read(sof, tag, name); } // method: write // bool8 write(Sof& sof, int32 tag, const String& name = CLASS_NAME) const { return Stack::write(sof, tag, name); } // method: readData // bool8 readData(Sof& sof, const String& pname = String::EMPTY, int32 size = SofParser::FULL_OBJECT, bool8 param = true, bool8 nested = false) { return Stack::readData(sof, pname, size, param, nested); } // method: writeData // bool8 writeData(Sof& sof, const String& pname = String::EMPTY) const { return Stack::writeData(sof, pname); } // method: new // static void* operator new(size_t size) { return mgr_d.get(); } // method: new[] // static void* operator new[](size_t size) { return mgr_d.getBlock(size); } // method: delete // static void operator delete(void* ptr) { mgr_d.release(ptr); } // method: delete[] // static void operator delete[](void* ptr) { mgr_d.releaseBlock(ptr); } // method: setGrowSize // static bool8 setGrowSize(int32 grow_size) { return mgr_d.setGrow(grow_size); } // the clear method is inherited from the Stack class // //--------------------------------------------------------------------------- // // class-specific public methods // //--------------------------------------------------------------------------- // hash function // int32 hash(int32 capacity) const; //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: }; // include the train node class here circumvent the circular dependency // #ifndef ISIP_CONTEXT #include #endif // end of include file // #endif