Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 0e54ba0ee564ce6063a5e83aa86060c5 > files > 339

festival-speechtools-devel-1.2.96-18.fc14.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
   <TITLE> Template vector</TITLE>
   <META NAME="GENERATOR" CONTENT="DOC++ 3.4.6">
</HEAD>
 <body bgcolor="#ffffff" link="#0000ff" 
	vlink="#dd0000" text="#000088" alink="9000ff">

<A HREF = "http://www.cstr.ed.ac.uk/">
   <IMG align=left BORDER=0 SRC = "cstr.gif"></A> 
<A HREF="http://www.cstr.ed.ac.uk/projects/speech_tools.html">
	<IMG BORDER=0 ALIGN=right SRC="est.jpg" width=150 height=93></A>
<br>

<br clear=left>
<p align=right>

<TABLE BORDER=0><TR>
<TD VALIGN=TOP><H2> <A HREF="#DOC.DOCU">Template vector</A></H2></TD></H2></TD></TR></TABLE>

<TABLE>
<TR><TD VALIGN=TOP>
<IMG ALT="o" BORDER=0 SRC=icon1.gif><A NAME="EST_TVector"></A>
<A HREF=EST_TVector.html><B>EST_TVector</B></A></TD><TD><BR>
</TD></TR>
</TABLE>
<A NAME="DOC.DOCU"></A>
<BLOCKQUOTE>
This serves as a base class for a vector
of type &lt;type&gt;T&lt;/type&gt;.  This acts as a higher level
version of a normal C array as defined as &lt;type&gt;float *x&lt;/type&gt; etc.

<P>The vector can be resized after declaration, access can be 
with or without bounds checking.  Round brackets denote read-only
access (for consts) while square brackets are for read-write access.
In both cases references are returned.

<P>The standard operators () and [] should be thought of as 
having no bounds checking, though they may do so optionally
as a compile time option.  The methods &lt;method&gt;a_check&lt;/method&gt; and 
&lt;method&gt;a_nocheck&lt;/method&gt; provide explicit boundary checking/nonchecking,
both const and non-const versions are provided.

<P>Access through () and [] are guaranteed to be as fast as standard
C arrays (assuming a resonable optimizing compiler).  

<P>&lt;programlisting&gt;
EST_FVector x(10);
int i;

<P>for (i=0; i &lt; x.length(); ++i)
x[i] = sqrt((float)i);

<P>x.resize(20);

<P>for (i=10; i &lt; x.length(); ++i)
x[i] = sqrt((float)i);

<P>&lt;/programlisting&gt;

<P>To instantialte a template for a a vector of type {FooBar}

<P>&lt;programlisting&gt;
<TT>include&nbsp;&quot;../base_class/EST_TVector.cc&quot;</TT>// If you want List to vector convertion (and defined a TList)
<TT>include&nbsp;&quot;../base_class/EST_Tvectlist.cc&quot;</TT>
template class EST_TVector&lt;FooBar&gt;;
template ostream&amp; operator &lt;&lt; 
(ostream &amp;st, const EST_TVector&lt;FooBar&gt; &amp;v);
&lt;/programlisting&gt;

<P>The EST library already has template vector instantiations for
&lt;type&gt;int&lt;/type&gt;, &lt;type&gt;float&lt;/type&gt;, &lt;type&gt;double&lt;/type&gt; and
&lt;docppRef linkend='EST_String'&gt;.  Also types are defined for them
in &lt;docppRef linkend='EST_types.h'&gt; as &lt;docppRef
linkend='EST_IVector'&gt;, &lt;docppRef linkend='EST_FVector'&gt;,
&lt;docppRef linkend='EST_DVector'&gt; and &lt;docppRef
linkend='EST_StrVector'&gt; for &lt;type&gt;int&lt;/type&gt;s,
&lt;type&gt;float&lt;/type&gt;s, &lt;type&gt;doubles&lt;/type&gt;s and &lt;docppRef
linkend='EST_String'&gt;s respectively.

<P></BLOCKQUOTE>
<DL><DT><DT><B>See Also:</B><DD>matrix_example <BR><DD></DL><P><P><I><A HREF="index.html">Alphabetic index</A></I> <I><A HREF="HIER.html">Hierarchy of classes</A></I></P><HR>
<A HREF = "http://www.ed.ac.uk/">
   <IMG align=right BORDER=0 SRC = "edcrest.gif"></A>

<P Align=left><I>This page is part of the 
<A HREF="http://www.cstr.ed.ac.uk/projects/speech_tools.html">
Edinburgh Speech Tools Library</A> documentation
<br>
Copyright <A HREF="http://www.ed.ac.uk"> University of Edinburgh</A> 1997
<br>
Contact: <A HREF="mailto:speech_toolss@cstr.ed.ac.uk"> 
         speech_tools@cstr.ed.ac.uk </a>
</P>
<br clear=right>