// file: $isip/class/asr/Identifier/Identifier.h // version: $Id: Identifier.h 8665 2002-09-01 18:42:02Z alphonso $ // // make sure definitions are only made once // #ifndef ISIP_IDENTIFIER #define ISIP_IDENTIFIER #ifndef ISIP_STRING #include #endif #ifndef ISIP_HASH_TABLE #include #endif #ifndef ISIP_DOUBLE_LINKED_LIST #include #endif #ifndef ISIP_ANCHOR #include #endif #ifndef ISIP_ANNOTATION #include #endif // Identifier: a class used to represent an identifier // // 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 Identifier { //-------------------------------------------------------------------------- // // public constants // //-------------------------------------------------------------------------- public: // define the class name // static const String CLASS_NAME; // i/o related constants // static const String DEF_PARAM; //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // declare the identifier namespace // String namespace_d; // declare the identifier type // String type_d; // define the collection of identifiers already issued // DoubleLinkedList issued_d; // define the highest id issued so far // Long curr_d; // define the table of anchors // HashTable anchors_d; // define the table of annotations // HashTable annotations_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 // ~Identifier() {} // method: default constructor // Identifier(); // method: copy constructor // Identifier(const Identifier& arg) { assign(arg); } // method: assign // bool8 assign(const Identifier& arg); // method: sofSize // int32 sofSize() const { return 0; } // method: read // bool8 read(Sof& sof, int32 tag) { return read(sof, tag, name()); } // method: write // bool8 write(Sof& sof, int32 tag) const { return write(sof, tag, name()); } // method: read // bool8 read(Sof& sof, int32 tag, const String& name) { return true; } // method: readData // bool8 readData(Sof& sof, const String& pname = DEF_PARAM, int32 size = SofParser::FULL_OBJECT, bool8 param = true, bool8 nested = false) { return true; } // method: write // bool8 write(Sof& sof, int32 tag, const String& name) const { return true; } // method: writeData // bool8 writeData(Sof& sof, const String& pname = DEF_PARAM) const { return true; } // method: eq // bool8 eq(const Identifier& 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 // Identifier(String& id, String& type); // method to try to register the given identifier // const String registerId(); // method to try to register the given identifier // const String registerId(const String& id); /// method to check if an id has been issued // bool8 existsId(const String& id); /// method to reclaim an id // bool8 reclaimId(const String& id); // method to get the namespace of the id // String getNamespace(const String& id); // method to get the annotation reference by id // Annotation* getAnnotationRef(const String& id); // method to get get the anchor reference by id // Anchor* getAnchorRef(const String& id); // method to delete a annotation id to reference mapping // bool8 deleteAnnotationRef(const String& id); // method to delete a anchor id to reference mapping // bool8 deleteAnchorRef(const String& id); // method to add a annotation id to reference mapping // bool8 addAnnotationRef(const String& id, Annotation* ref); // method to add a anchor id to reference mapping // bool8 addAnchorRef(const String& id, Anchor* ref); // method to check if a annotation exists // bool8 existsAnnotation(const String& id); // method to check if a anchor exists // bool8 existsAnchor(const String& id); //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: }; //end of include file // #endif