// file: $isip/class/search/ContextMap/ContextMap.h // version: $Id: ContextMap.h 8911 2002-12-13 22:25:56Z parihar $ // // make sure definitions are only made once // #ifndef ISIP_CONTEXT_MAP #define ISIP_CONTEXT_MAP // isip include files // #ifndef ISIP_SEARCH_SYMBOL #include #endif #ifndef ISIP_VECTOR #include #endif #ifndef ISIP_PAIR #include #endif #ifndef ISIP_ULONG #include #endif // ContextMap: a class that provides a mapping between a sequence (context // dependent/independent) at the current level of the search hierarchy and // their corresponding subgraphs at the next level. // class ContextMap { //--------------------------------------------------------------------------- // // public constants // //--------------------------------------------------------------------------- public: // define the class name // static const String CLASS_NAME; //---------------------------------------- // // i/o related constants // //---------------------------------------- static const String DEF_PARAM; static const String PARAM_CONTEXT; static const String PARAM_CONTEXT_INDEX; //---------------------------------------- // // default values and arguments // //---------------------------------------- //--------------------------------------- // // error codes // //--------------------------------------- //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // sequence of search symbols // Vector context_d; // subgraph index of the search symbols // Ulong index_d; // 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); // debug methods // bool8 debug(const unichar* message) const; // method: destructor // ~ContextMap() {} // method: default constructor // ContextMap() {} // method: copy constructor // ContextMap(const ContextMap& arg) { assign(arg); } // assign method // bool8 assign(const ContextMap& arg); // method: sofSize // int32 sofSize() const { return context_d.sofSize() + index_d.sofSize(); } // read methods // bool8 read(Sof& sof, int32 tag, const String& cname = CLASS_NAME); bool8 readData(Sof& sof, const String& pname = DEF_PARAM, int32 size = SofParser::FULL_OBJECT, bool8 param = true, bool8 nested = false); // write methods // bool8 write(Sof& sof, int32 tag, const String& cname = CLASS_NAME) const; bool8 writeData(Sof& sof, const String& pname = DEF_PARAM) const; // equality method // bool8 eq(const ContextMap& arg) const; // 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); } // clear method // bool8 clear(Integral::CMODE ctype = Integral::DEF_CMODE); //--------------------------------------------------------------------------- // // class-specific public methods // //--------------------------------------------------------------------------- // method: getContext // Vector& getContext() { return context_d; } // method: setContext // bool8 setContext(Vector& arg) { return context_d.assign(arg); } // method: getContextIndex // Ulong getContextIndex() { return index_d; } // method: setContextIndex // bool8 setContextIndex(ulong arg) { index_d = arg; return true; } //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: }; // end of include file // #endif