<?php $isip_window_title = "ISIP Homepage"; ?>
<?php include("/data/isip/www/templates/documentation/header/header.html"); ?>

<!--#set var="isip_page_title" value="AnnotationIndex" -->
<?php include("/data/isip/www/templates/documentation/body/index_class.html"); ?>
<?php include("/data/isip/www/templates/documentation/body/bar.html"); ?>

<a name="name">
<b>

name:
<a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h">AnnotationIndex</a>

</b>
<br><br>

<a name="synopsis">
<b>synopsis:</b>
<br><br>

<blockquote>
<pre>

g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_mmedia.a

#include &lt;AnnotationIndex.h&gt;

static boolean diagnose(Integral::DEBUG debug_level);
boolean add(Annotation* a);
boolean deleteAnnotation(Annotation* anno);
boolean existsAnnotation(const String& id);
boolean existsAnchor(const String& id);
float getNearestOffset(float offset);
boolean getByOffset(float offset, DoubleLinkedList&lt;Annotation&gt;& list);
Annotation* getAnnotationByOffset(float offset);
boolean addFeature(Annotation* anno, const String& feature, const String& value);
boolean deleteFeature(Annotation* anno, const String& feature);
boolean existsFeature(const String& feature, const String& value);
</pre>
</blockquote>

<a name="quick_start">
<b>quick start:</b>
<br><br>

<blockquote>
<pre>

String anno_name_00(L"Annotation1");
String unit_00(L"seconds");

String ancr_name_00(L"Anchor1");
String ancr_name_01(L"Anchor2");

float offset_00 = 2.409875;
float offset_01 = 2.649875;

Anchor ancr_00(ancr_name_00, offset_00, unit_00);
Anchor ancr_01(ancr_name_01, offset_01, unit_00);

String type_00(L"oh i see uh-huh");
String feat_00(L"feature1");
String value_00(L"value1");

Annotation anno_00(anno_name_00, &ancr_00, &ancr_01, type_00);
anno_00.setFeature(feat_00, value_00);

AnnotationIndex andx_00;

andx_00.add(&anno_00);

</pre>
</blockquote>

<a name="description">
<b>description:</b>
<br><br>

This class is used for quick access to annotations and anchors in the annotation library.

<ul>
[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.
</ul>

<br><br>

<a name="dependencies">
<b>dependencies:</b>
<br><br>

<ul>
  <li> <a href="../../math/scalar/String/">String.h</a>
  <li> <a href="../../dstr/HashTable/">HashTable.h</a>
  <li> <a href="../Annotation/">Annotation.h</a>
  <li> <a href="../Anchor/">Anchor.h</a>
</ul>

<a name="constants">
<b>public constants:</b>
<br><br>

<ul>
  <li> define the class name:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_00.cc&constant=CLASS_NAME">static const String CLASS_NAME = L"AnnotationIndex";</a></pre>

  <li> define i/o related constants:

<pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_00.cc&constant=DEF_PARAM">static const String DEF_PARAM;</a></pre>       

</ul>

<a name="error">
<b>error codes:</b>
<br><br>

<ul>
  <li> error codes indicating general errors:

</ul>

<a name="protected">
<b>protected data:</b>
<br><br>

<ul>
  <li> declare a list to store the set of anchors:

       <pre>DoubleLinkedList&lt;Anchor&gt; ancrset_d;</pre>

  <li> declare the anchors indexed by identifiers:

       <pre>HashTable&lt;String, Anchor&gt; ancr_by_id_d;</pre>

  <li> declare the anchor set indexed by the offset:

       <pre>HashTable&lt;Float, DoubleLinkedList&lt;Anchor&gt; &gt; ancrset_by_offset_d;</pre>

  <li> declare the annotations indexed by identifiers:

       <pre>HashTable&lt;String, Annotation&gt; anno_by_id_d;</pre>

  <li> declare the annotations indexed by type:

       <pre>HashTable&lt;String, DoubleLinkedList&lt;Annotation&gt; &gt; anno_by_type_d;</pre>

  <li> declare annotations indexed by the offset of start anchor:

       <pre>HashTable&lt;Float, DoubleLinkedList&lt;Annotation&gt; &gt; start_by_offset_d;</pre>

  <li> declare annotations indexed by the offset of end anchor:

       <pre>HashTable&lt;Float, DoubleLinkedList&lt;Annotation&gt; &gt; end_by_offset_d;</pre>

  <li> declare annotations indexed by their end anchor:

       <pre>HashTable&lt;HashKey&lt;Anchor&gt;, DoubleLinkedList&lt;Annotation&gt; &gt; incoming_d;</pre>

  <li> declare annotations indexed by their start anchor:

       <pre>HashTable&lt;HashKey&lt;Anchor&gt;, DoubleLinkedList&lt;Annotation&gt; &gt; outgoing_d;</pre>

  <li> declare annotations indexed by their feature:

       <pre>HashTable&lt;String, DoubleLinkedList&lt;Annotation&gt; &gt; by_feature_d;</pre>

  <li> declare the debugging parameters:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_00.cc&static=debug_level_d">static Integral::DEBUG debug_level_d;</a></pre>

  <li> declare the memory manager:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_00.cc&static=mgr_d">static MemoryManager mgr_d;</a></pre>

</ul>

<a name="public">
<b>required public methods:</b>
<br><br>

<ul>
  <li> static methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=name&instance=0">static const String& name();</a></pre>

  <li> debug methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_01.cc&method=debug&instance=0">boolean debug(const unichar* msg) const;</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=setDebug&instance=0">static boolean setDebug(Integral::DEBUG arg);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_02.cc&method=diagnose&instance=0">static boolean diagnose(Integral::DEBUG debug_level);</a></pre>
       
  <li> destructor/constructor(s):

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=destructor&instance=0">~AnnotationIndex();</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=default+constructor&instance=0">AnnotationIndex();</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=copy+constructor&instance=0">AnnotationIndex(const AnnotationIndex& arg);</a></pre>

  <li> assign methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=assign&instance=0">boolean assign(const AnnotationIndex& arg);</a></pre>

  <li> operator= method:

       <pre>not present.</pre>

  <li> i/o methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=sofSize&instance=0">long sofSize() const;</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=read&instance=0">boolean read(Sof& sof, long tag);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=write&instance=0">boolean write(Sof& sof, long tag) const;</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=read&instance=1">boolean read(Sof& sof, long tag, const String& name);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=readData&instance=0">boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=write&instance=1">boolean write(Sof& sof, long tag, const String& name) const;</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=writeData&instance=0">boolean writeData(Sof& sof, const String& pname =  DEF_PARAM) const;</a></pre>

  <li> equality methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=eq&instance=0">boolean eq(const AnnotationIndex& arg) const;</a></pre>

  <li> memory management methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=new&instance=0">static void* operator new(size_t arg);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=new\[\]&instance=0">static void* operator new[](size_t arg);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=delete&instance=0">static void operator delete(void* arg);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=delete\[\]&instance=0">static void operator delete[](void* arg);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/AnnotationIndex.h&method=setGrowSize&instance=0">static boolean setGrowSize(long arg);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=clear&instance=0">boolean clear(Integral::CMODE cmode = Integral::DEF_CMODE);</a></pre>

</ul>

<a name="specific">
<b>class-specific public methods:</b>
<br><br>

<ul>
  <li> declare anchor related methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=existsAnchor&instance=0">boolean existsAnchor(const String& id);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=getNearestOffset&instance=0">float getNearestOffset(float offset);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=getByOffset&instance=0">boolean getByOffset(float offset, DoubleLinkedList&lt;Annotation&gt;& list);</a></pre>
       
  <li> declare annotation related methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=add&instance=0">boolean add(Annotation* a);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=deleteAnnotation&instance=0">boolean deleteAnnotation(Annotation* anno);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=existsAnnotation&instance=0">boolean existsAnnotation(const String& id);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=getAnnotationByOffset&instance=0">Annotation* getAnnotationByOffset(float offset);</a></pre>
       
  <li> declare feature map related methods:       

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=addFeature&instance=0">boolean addFeature(Annotation* anno, const String& feature, const String& value);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=deleteFeature&instance=0">boolean deleteFeature(Annotation* anno, const String& feature);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=existsFeature&instance=0">boolean existsFeature(const String& feature, const String& value);</a></pre>

</ul>

<a name="private">
<b>private methods:</b>
<br><br>

<ul>
  <li> declare friend classes:
       
       <pre>friend class AnnotationGraph;</pre>
       
  <li> declare private methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=addAnchor&instance=0">boolean addAnchor(Anchor* ancr);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/mmedia/AnnotationIndex/andx_05.cc&method=deleteAnchor&instance=0">boolean deleteAnchor(Anchor*ancr);</a></pre>
       
</ul>

<a name="examples">
<b>examples:</b>
<br><br>

<ul>

    <li> This <a href="/perl/ifc_document.pl?file=$isip/doc/examples/class/mmedia/mmedia_example_06/example.cc">example</a> shows how to use the AnnotationIndex object.
	 
</ul>

<a name="notes">
<b>notes:</b>
<br><br>

<ul>
  <li> none.
</ul>

<!--#include virtual="/hse/ies/templates/documentation/footer/footer.html" -->
