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

<!--#set var="isip_page_title" value="PriorityQueue" -->
<?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/dstr/PriorityQueue/PriorityQueue.h">PriorityQueue&lt;TObject&gt;</a> : public <a href="../DstrBase/">DstrBase</a></b>

</b>
<br><br>

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

<blockquote>
<pre>

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

#include &lt;PriorityQueue.h&gt;

boolean push(TObject* item, COMPARE_FUNC comp_func = compare);
TObject* pop(TObject* item = (TObject*)NULL);
const TObject* top() const;
TObject* top();
boolean isEmpty() const;
long length() const;
long getCapacity() const;
boolean setLength(long length, boolean preserve_values = true);
boolean setCapacity(long capacity, boolean preserve_values = true);
</pre>
</blockquote>

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

<blockquote>
<pre>

// declare a priority queue
//
Long* lng_00;
Long lng_01(3);
PriorityQueue&lt;Long&gt pq_00;

pq_0.push(&lng_01);
lng_01 = pq_0.top();
pq_0.pop(&lng_01);

</pre>
</blockquote>

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

This class implements a standard priority queue using a vector to implement
the underlying heap data structure.

<ul>
  T. Cormen, C. Leiserson, R. Rivest,
  <i>Introduction to Algorithms</i>,
  MIT Press, Boston, Massachusetts, USA, pp. 140-149, 1998.
</ul>

<br><br>

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

<ul>
  <li> <a href="../../math/scalar/String/">String.h</a>
  <li> <a href="../../math/scalar/Char/">Char.h</a>
  <li> <a href="../../system/Console/">Console.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/dstr/PriorityQueue/PriorityQueue.h&constant=CLASS_NAME">static const String CLASS_NAME = L"PriorityQueue";</a></pre>

  <li> define public constants:

       <pre>static const String CLASS_NAME;</pre>

       <pre>static const String DEF_PARAM;</pre>

       <pre>static const long DEF_END_POS = -1;</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 comparison function for the items in the priority queue:

       <pre>typedef Integral::COMPARE (*COMPARE_FUNC)(TObject* item1, TObject* item2);</pre>

  <li> declare the internal structure of the priority queue:

       <pre>TObject** v_d;</pre>

  <li> declare the allocation mode:

       <pre>ALLOCATION alloc_d;</pre>

  <li> declare number of elements of this vector:

       <pre>Long length_d;</pre>

  <li> declare the maximum number of elements:

       <pre>Long capacity_d;</pre>

  <li> declare the debugging parameters:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&static=debug_level_d">static Integral::DEBUG debug_level_d;</a></pre>

  <li> define the memory manager:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&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/dstr/PriorityQueue/PriorityQueue.h&method=name&instance=0">static const String& name();</a></pre>

  <li> debug methods:

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

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=debug&instance=0">boolean debug(const unichar* message) const;</a></pre>

  <li> destructor/constructor(s):

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

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

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=copy+constructor&instance=0">PriorityQueue(const PriorityQueue&lt;TObject&gt;& copy_queue);</a></pre>

  <li> assign methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=assign&instance=0">boolean assign(const PriorityQueue&lt;TObject&gt;& copy_stack);</a></pre>

  <li> operator= method:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=operator%3D&instance=0">PriorityQueue&lt;TObject&gt;& operator=(const PriorityQueue&lt;TObject&gt;& arg);</a></pre>

  <li> i/o methods:

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

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

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

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.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/dstr/PriorityQueue/PriorityQueue.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/dstr/PriorityQueue/PriorityQueue.h&method=readData&instance=0">boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = true);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.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/dstr/PriorityQueue/PriorityQueue.h&method=eq&instance=0">boolean eq(const PriorityQueue&lt;TObject&gt;& arg) const;</a></pre>

  <li> memory management methods:

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

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

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

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

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

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&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 class specific methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=push&instance=0">boolean push(TObject* item, COMPARE_FUNC comp_func = compare);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=pop&instance=0">TObject* pop(TObject* item = (TObject*)NULL);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=top&instance=0">const TObject* top() const;</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=top&instance=1">TObject* top();</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=isEmpty&instance=0">boolean isEmpty() const;</a></pre>

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

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

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=setLength&instance=0">boolean setLength(long length, boolean preserve_values = true);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=setCapacity&instance=0">boolean setCapacity(long capacity, boolean preserve_values = true);</a></pre>

</ul>

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

<ul>
  <li> declare private methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=parent&instance=0">long parent(long val);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=left&instance=0">long left(long val);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=right&instance=0">long right(long val);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=compare&instance=0">static Integral::COMPARE compare(TObject* item1, TObject* item2);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=heapify&instance=0">boolean heapify(long index, COMPARE_FUNC comp_func = compare);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=buildHeap&instance=0">boolean buildHeap();</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=heapSort&instance=0">boolean heapSort();</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/PriorityQueue/PriorityQueue.h&method=accessByMode&instance=0">TObject* accessByMode(TObject* item);</a></pre>

</ul>

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

<ul>
  <li> none.

<pre>
</pre>
</ul>

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

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

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