📄 anchor.h
字号:
// file: $isip/class/asr/Anchor/Anchor.h// version: $Id: Anchor.h,v 1.4 2002/09/01 18:41:56 alphonso Exp $//// make sure definitions are only made once//#ifndef ISIP_ANCHOR#define ISIP_ANCHOR#ifndef ISIP_STRING#include <String.h>#endif#ifndef ISIP_BOOLEAN#include <Boolean.h>#endif#ifndef ISIP_HASH_TABLE#include <HashTable.h>#endif#ifndef ISIP_DOUBLE_LINKED_LIST#include <DoubleLinkedList.h>#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 boolean diagnose(Integral::DEBUG debug_level); // debug methods // boolean debug(const unichar* msg) const; // method: setDebug // static boolean 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 // boolean assign(const Anchor& arg); // method: sofSize // long sofSize() const { return (offset_d.sofSize() + unit_d.sofSize() + anchored_d.sofSize()); } // method: read // boolean read(Sof& sof, long tag) { return read(sof, tag, name()); } // other read methods // boolean read(Sof& sof, long tag, const String& name); boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false); // method: write // boolean write(Sof& sof, long tag) const { return write(sof, tag, name()); } // other write methods // boolean write(Sof& sof, long tag, const String& name) const; boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const; // method: eq // boolean 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 boolean setGrowSize(long arg) { return mgr_d.setGrow(arg); } // method: clear // boolean clear(Integral::CMODE cmode = Integral::DEF_CMODE); //--------------------------------------------------------------------------- // // class-specific public methods // //--------------------------------------------------------------------------- // method: constructor // Anchor(String& id, float 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 // float getOffset() const { return offset_d; } // method: setOffset // boolean setOffset(float arg) { offset_d = arg; anchored_d = true; return true; } // method: getAnchored // boolean getAnchored() const { return anchored_d; } // method: setUnit // boolean setUnit(String& arg) { unit_d.assign(arg); return true; } // method: getUnit // String getUnit() const { return unit_d; } // method: unsetOffset // boolean unsetOffset() { anchored_d = false; return true; } //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: // method: compare // boolean compare(const String& arg1, const String& arg2) const; // friend class // friend class AnnotationGraph; };//end of include file//#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -