// file: $isip/class/asr/Anchor/Anchor.h // version: $Id: Anchor.h 8665 2002-09-01 18:42:02Z alphonso $ // // make sure definitions are only made once // #ifndef ISIP_ANCHOR #define ISIP_ANCHOR #ifndef ISIP_STRING #include #endif #ifndef ISIP_BOOLEAN #include #endif #ifndef ISIP_HASH_TABLE #include #endif #ifndef ISIP_DOUBLE_LINKED_LIST #include #endif // Anchor: a class used to represent time offsets in the annotation graph // // Reference: // // [1] S. Bird, M. Liberman, A Formal Framework for Linguistic Annotation, // Linguistic Data Consortium, University of Pennsylvania, Philadelphia, // Pennsylvania, USA, 2000. // // [2] K. Maeda, X. Ma, H. Lee, S. Bird, The Annotation Graph Toolkit: // Application Developer's Manual (Draft), Linguistic Data Consortium, // University of Pennsylvania, Philadelphia, Pennsylvania, USA, 2001. // class Anchor { //-------------------------------------------------------------------------- // // 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_ID; static const String PARAM_OFFSET; static const String PARAM_UNIT; static const String PARAM_ANCHORED; //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // declare the anchor id // String id_d; // declare the anchor offset // Float offset_d; // declare the anchor time unit // String unit_d; // declare a flag that indicates if the anchor is anchored // Boolean anchored_d; // declare a static debug level for all class instantiations // static Integral::DEBUG debug_level_d; // a static memory manager // static MemoryManager mgr_d; //--------------------------------------------------------------------------- // // required public methods // //--------------------------------------------------------------------------- public: // method: name // static const String& name() { return CLASS_NAME; } static bool8 diagnose(Integral::DEBUG debug_level); // debug methods // bool8 debug(const unichar* msg) const; // method: setDebug // static bool8 setDebug(Integral::DEBUG arg) { debug_level_d = arg; return true; } // method: destructor // ~Anchor(); // method: default constructor // Anchor(); // method: copy constructor // Anchor(const Anchor& arg) { assign(arg); } // method: assign // bool8 assign(const Anchor& arg); // method: sofSize // int32 sofSize() const { return (offset_d.sofSize() + unit_d.sofSize() + anchored_d.sofSize()); } // method: read // bool8 read(Sof& sof, int32 tag) { return read(sof, tag, name()); } // other read methods // bool8 read(Sof& sof, int32 tag, const String& name); bool8 readData(Sof& sof, const String& pname = DEF_PARAM, int32 size = SofParser::FULL_OBJECT, bool8 param = true, bool8 nested = false); // method: write // bool8 write(Sof& sof, int32 tag) const { return write(sof, tag, name()); } // other write methods // bool8 write(Sof& sof, int32 tag, const String& name) const; bool8 writeData(Sof& sof, const String& pname = DEF_PARAM) const; // method: eq // bool8 eq(const Anchor& arg) const; // method: new // static void* operator new(size_t arg) { return mgr_d.get(); } // method: new[] // static void* operator new[](size_t arg) { return mgr_d.getBlock(arg); } // method: delete // static void operator delete(void* arg) { mgr_d.release(arg); } // method: delete[] // static void operator delete[](void* arg) { mgr_d.releaseBlock(arg); } // method: setGrowSize // static bool8 setGrowSize(int32 arg) { return mgr_d.setGrow(arg); } // method: clear // bool8 clear(Integral::CMODE cmode = Integral::DEF_CMODE); //--------------------------------------------------------------------------- // // class-specific public methods // //--------------------------------------------------------------------------- // method: constructor // Anchor(String& id, float32 offset, String& unit); // method: constructor // Anchor(String& id, String& unit); // method: constructor // Anchor(String& id, const Anchor*); // method: getId // const String getId() const { return id_d; } // method: getOffset // float32 getOffset() const { return offset_d; } // method: setOffset // bool8 setOffset(float32 arg) { offset_d = arg; anchored_d = true; return true; } // method: getAnchored // bool8 getAnchored() const { return anchored_d; } // method: setUnit // bool8 setUnit(String& arg) { unit_d.assign(arg); return true; } // method: getUnit // String getUnit() const { return unit_d; } // method: unsetOffset // bool8 unsetOffset() { anchored_d = false; return true; } //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: // method: compare // bool8 compare(const String& arg1, const String& arg2) const; // friend class // friend class AnnotationGraph; }; //end of include file // #endif