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

<!--#set var="isip_page_title" value="CircularDelayLine" -->
<?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/CircularDelayLine/CircularDelayLine.h">CircularDelayLine&lt;class TObject&gt</a></b>

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

<blockquote>
<pre>
g++ [flags ...] file ...

#include &lt;CircularDelayLine.h&gt;
CircularDelayLine(long length=DEF_LENGTH);
boolean assign(const TObject& input);  
boolean advance(long increment=DEF_INCREMENT);
</pre>
</blockquote>

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

<blockquote>
<pre>
// declare a Float CircularDelayLine of capacity 5
//
CircularDelayLine&lt;Float&gt cdl(5);
Float tmp;

for (long i = 0; i < 5; i++) {
  tmp = (float)i;
  cdl.assignAndAppend(num);
}
</pre>
</blockquote>

<a name="description"> 
<b>description:</b>
<br><br>
The CircularDelayLine class is a classic circular buffer that is
typically used in digital signal processing (DSP) to implement
delay lines and linear filters. See:

<ul>
S.J. Orfandis, <i>Introduction to Signal Processing</i>,
Prentice-Hall, New York, New York, USA, ISBN 0-13-209172-0, 1996.
</ul>

for a nice introduction on the use of circular buffers
in DSP.

<br><br>

This class is implemented as a Vector of <b>TObject</b>s
and an integer pointer.
CircularDelayLine has a current pointer that moves around the
vector, and wraps around the ends of the vector.
A simple interface is provided that allows data to be easily
added to the buffer, and current values of the buffer to be accessed
via standard array indexing.

<br><br>

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

<ul>
  <li> <a href="../Vector/index.html"> Vector </a> <br>

  <li> <a href="../../system/Console/index.html"> Console </a> <br>

  <li> <a href="../../system/MemoryManager/index.html">MemoryManager</a>
</ul>

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

<ul>
  <li> define the class name:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&constant=CLASS_NAME">static const String CLASS_NAME = L"CircularDelayLine";</a></pre>
       
  <li> define i/o related variables:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&constant=DEF_PARAM">const String DEF_PARAM(L"");</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&constant=PARAM_INDEX">const String PARAM_INDEX(L"index");</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&constant=PARAM_BUFFER">const String PARAM_BUFFER(L"buffer");</a></pre>
       
  <li> define the default values and arguments:
       
        <pre>static const long DEF_LENGTH = 1024;</pre>

       <pre>static const long DEF_INDEX = 0;</pre>

       <pre>static const long DEF_INCREMENT = 1;</pre>
</ul>
       
<a name="error">       
<b>error codes:</b>
<br><br>

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

       <pre><a href="/perl/ifc_document.pl?err=00041900">static const long ERR = 41900;</a></pre>
</ul>

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

<ul>
  <li> Vector of TObject data:

       <pre>Vector&lt;TObject&gt; v_d;</pre>
  
  <li> pointer to the current location:

       <pre>Long index_d;</pre>
	      
  <li> debugging parameters:

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

  <li> static memory manager:
       
      <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.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: diagnose method is moved outside the class
header file and defined in the CircularDelayLineDiagnose.h in order to
avoid the issues related with the preprocessing of the diagnose code

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=name">static const SysString& name();</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLineDiagnose.h&method=diagnose">static boolean diagnose(Integral::DEBUG debug_level);</a></pre>       

  <li> debug methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=debug">boolean debug(const unichar* message) const;</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=setDebug">boolean setDebug(Integral::DEBUG debug_level);</a></pre>

  <li> destructor/constructor(s):

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=destructor">~CircularDelayLine();</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=default+constructor">CircularDelayLine(long length = DEF_LENGTH);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=copy">CircularDelayLine(const CircularDelayLine&lt;TObject&gt;& arg);</a></pre>     

  <li> assign methods:

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

<li> operator= methods:

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

  <li> equality methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=eq">boolean eq(const CircularDelayLine&lt;TObect&gt;& arg) const;</a></pre>
     
  <li> i/o methods: refer to the <a href = "./index.html#notes">notes</a>
section for an explanation of having two read and write methods in
this class

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=sofSize">long sofSize();</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=read&instance=0">boolean read(Sof& sof, long tag);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.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/CircularDelayLine/CircularDelayLine.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/CircularDelayLine/CircularDelayLine.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/CircularDelayLine/CircularDelayLine.h&method=readData">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/dstr/CircularDelayLine/CircularDelayLine.h&method=writeData">boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;</a></pre>
           
  <li> memory management methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=new">static void* operator new(size_t size);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=new[]">static void* operator new[](size_t size);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=delete">static void operator delete(void* ptr);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=delete[]">static void operator delete[](void* ptr);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=setGrowSize">static boolean setGrowSize(long grow_size);</a></pre>  
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=clear">boolean clear(Integral::CMODE cmode = Integral::DEF_CMODE);</a></pre>
</ul>

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

<ul>
  <li> extensions to required methods:

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

  <li> indexing methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=operator()&instance=0">TObject& operator() (long index);</pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=operator()&instance=1">const TObject& operator() (long index) const;</a></pre>
      
  <li> size-related methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=setLength">boolean setLength(long length);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=length">long length() const;</a></pre>
       
  <li> core data manipulation methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=advance">boolean advance(long increment = DEF_INCREMENT);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=advanceAndAssign">boolean advanceAndAssign(const TObject& input, long increment = DEF_INCREMENT);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=assignAndAdvance">boolean assignAndAdvance(const TObject& input, long increment = DEF_INCREMENT);</a></pre>

</ul>

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

<ul>       

  <li> pointer manipulation methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/CircularDelayLine/CircularDelayLine.h&method=wrap">long wrap(long value) const;</a></pre>
</ul>

<b>friend classes:</b>
<br><br>
<ul>
  <li> none
</ul>

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

<ul>
  <li> This example shows how to create a CircularDelayLine, load it
       with values, and retrieve those values from the buffer:

<pre>
// isip include files
//
#include&lt;CircularDelayLine.h&gt;
#include&lt;Float.h&gt;

// main program starts here
//
int main() {
       
   // declare a CircularDelayLine object of length 3
   //
   CircularDelayLine&lt;Float&gt; cdl(3);
       
   // place 3 items on the buffer
   //
   for (long i = 0; i < 3; i++) {
     Float tmp((float)i);
     cdl.assignAndAdvance(tmp);
   }
       
   // retrieve 3 items from the buffer in reverse order
   //
   for (long i = 0; i < 3; i++) {
     Float tmp = cdl(-i);
   }
       
   // you can also retrieve items in the forward direction
   //
   for (long i = 0; i < 3; i++) {
     Float tmp = cdl(i);
   }

   // exit gracefully
   //
   Integral::exit();
}</pre>
</ul>

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

<ul>
  <li> The CircularDelayLine class is a specialized version of a
       circular buffer. For a more general implementation, see

       <a href="../CircularBuffer/index.html">CircularBuffer</a>.
       <br><br>

  <li> Unlike other classes, we have two read and write methods in dstr
       classes. The interface is still the same as that in other
       classes. The reason behind this is that we can not use
       "CLASS_NAME" as default argument in the read and write methods
       here because the data structures build the class name on the fly.
</ul>

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


       


       



