Public Member Functions | Private Member Functions | Private Attributes | Friends

alize::FeatureServer Class Reference

#include <FeatureServer.h>

Inheritance diagram for alize::FeatureServer:
Inheritance graph
[legend]
Collaboration diagram for alize::FeatureServer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FeatureServer ()
 FeatureServer (const Config &c)
 FeatureServer (const Config &c, FeatureInputStream &s)
 FeatureServer (const Config &c, const FileName &f)
 FeatureServer (const Config &c, const FileName &f, LabelServer &ls)
 FeatureServer (const Config &c, const XLine &l)
 FeatureServer (const Config &c, const XLine &l, LabelServer &ls)
void init (const Config &c)
void init (const Config &c, FeatureInputStream &s)
void init (const Config &c, const FileName &f)
void init (const Config &c, const FileName &f, LabelServer &ls)
void init (const Config &c, const XLine &l)
void init (const Config &c, const XLine &l, LabelServer &ls)
virtual ~FeatureServer ()
virtual unsigned long getFeatureCount ()
virtual unsigned long getVectSize ()
virtual const FeatureFlagsgetFeatureFlags ()
virtual real_t getSampleRate ()
const StringgetServerName () const
void setServerName (const String &s)
virtual bool readFeature (Feature &f, unsigned long s=1)
virtual bool writeFeature (const Feature &f, unsigned long s=1)
virtual void seekFeature (unsigned long n, const String &s="")
virtual void reset ()
virtual void close ()
virtual unsigned long getSourceCount ()
virtual unsigned long getFeatureCountOfASource (unsigned long srcIdx)
virtual unsigned long getFeatureCountOfASource (const String &src)
virtual unsigned long getFirstFeatureIndexOfASource (unsigned long srcIdx)
virtual unsigned long getFirstFeatureIndexOfASource (const String &srcName)
virtual const StringgetNameOfASource (unsigned long srcIdx)
virtual String getClassName () const
virtual String toString () const

Private Member Functions

FeatureInputStreaminputStream ()
void init ()
HistoricUsage defineHistoricUsage () const
unsigned long defineHistoricSize () const
BufferUsage defineBufferUsage () const
unsigned long defineBufferSize () const
void releaseAll ()
 FeatureServer (const FeatureServer &s)
bool operator== (const FeatureServer &)
bool operator!= (const FeatureServer &)
const FeatureServeroperator= (const FeatureServer &)

Private Attributes

bool _ownInputStream
FeatureInputStream_pInputStream
String _serverName

Friends

class TestFeatureServer

Detailed Description

This class represents a features server.
A featureServer is a circular buffer that can store features. Each feature can be accessed using an index or in a sequential way like a file. A feature server can read feature from a FeatureInputStream derived object. A feature server is itself derived from the FeatureInputStream class. It is possible to connect a feature server to an other one. When you create a feature server with a FeatureInputStream object, the server will read features from this object and store them until the object returns a NULL pointer. If the buffer size exceed the number of features loaded, the superfluous features are set to invalid. If you create a feature server without FeatureInputStream object connected, all the features are invalid.

Author:
Frederic Wils frederic.wils@lia.univ-avignon.fr
Version:
1.0
Date:
2003

Definition at line 94 of file FeatureServer.h.


Constructor & Destructor Documentation

alize::FeatureServer::FeatureServer (  ) [explicit]

Default constructor

alize::FeatureServer::FeatureServer ( const Config c ) [explicit]

Creates a FeatureServer object

Parameters:
cconfiguration to build the server
alize::FeatureServer::FeatureServer ( const Config c,
FeatureInputStream s 
) [explicit]

Creates a FeatureServer object.

Parameters:
cconfiguration to build the server
sa reference to a FeatureStream object that can provide features for the server.
alize::FeatureServer::FeatureServer ( const Config c,
const FileName f 
) [explicit]

Creates a FeatureServer object.

Parameters:
cconfiguration to build the server
fa feature file or a file (extension ".lst") that contains a list of feature files
alize::FeatureServer::FeatureServer ( const Config c,
const FileName f,
LabelServer ls 
) [explicit]

Creates a FeatureServer object.

Parameters:
cconfiguration to build the server
fa feature file or a file (extension ".lst") that contains a list of feature files
lsa label server.
alize::FeatureServer::FeatureServer ( const Config c,
const XLine l 
) [explicit]

Creates a FeatureServer object.

Parameters:
cconfiguration to build the server
la list of feature file names WITHOUT PATH AND EXTENSION The file type, extension and path come from the configuration (parameters "loadFeatureFileFormat" and "featureFilesPath")
alize::FeatureServer::FeatureServer ( const Config c,
const XLine l,
LabelServer ls 
) [explicit]

Creates a FeatureServer object.

Parameters:
cconfiguration to build the server
la list of feature file names WITHOUT PATH AND EXTENSION The file type, extension and path come from the configuration (parameters "loadFeatureFileFormat" and "featureFilesPath")
lsa label server.
virtual alize::FeatureServer::~FeatureServer (  ) [virtual]
alize::FeatureServer::FeatureServer ( const FeatureServer s ) [private]

Member Function Documentation

virtual void alize::FeatureServer::close (  ) [virtual]

Closes all the opened sources

Implements alize::FeatureInputStream.

unsigned long alize::FeatureServer::defineBufferSize (  ) const [private]
BufferUsage alize::FeatureServer::defineBufferUsage (  ) const [private]
unsigned long alize::FeatureServer::defineHistoricSize (  ) const [private]
HistoricUsage alize::FeatureServer::defineHistoricUsage (  ) const [private]
virtual String alize::FeatureServer::getClassName (  ) const [virtual]

Returns the name of the class

Returns:
the name of the class of the object as a String

Implements alize::FeatureInputStream.

virtual unsigned long alize::FeatureServer::getFeatureCount (  ) [virtual]

Returns the number of features in the stream connected to the server.

Returns:
the number of features in the stream if possible
Exceptions:
Exceptionif the stream cannot give it's features count

Implements alize::FeatureInputStream.

virtual unsigned long alize::FeatureServer::getFeatureCountOfASource ( unsigned long  srcIdx ) [virtual]

Returns the feature count of a feature source

Parameters:
srcIdxindex of the source
Returns:
the feature count of the source

Implements alize::FeatureInputStream.

virtual unsigned long alize::FeatureServer::getFeatureCountOfASource ( const String src ) [virtual]

Returns the feature count of a feature source

Parameters:
srcname of the source
Returns:
the feature count of the source

Implements alize::FeatureInputStream.

virtual const FeatureFlags& alize::FeatureServer::getFeatureFlags (  ) [virtual]

Returns the feature flags of the features

Returns:
the feature flags of the features

Implements alize::FeatureInputStream.

virtual unsigned long alize::FeatureServer::getFirstFeatureIndexOfASource ( unsigned long  srcIdx ) [virtual]

Returns the number of the first feature of a feature source. Useful for a multiple source stream.

Parameters:
srcIdxindex of the source
Returns:
the number of the first feature

Implements alize::FeatureInputStream.

virtual unsigned long alize::FeatureServer::getFirstFeatureIndexOfASource ( const String srcName ) [virtual]

Returns the number of the first feature of a feature source. Useful for a multiple source stream.

Parameters:
srcname of the source
Returns:
the number of the first feature

Implements alize::FeatureInputStream.

virtual const String& alize::FeatureServer::getNameOfASource ( unsigned long  srcIdx ) [virtual]

Returns the a particular feature source. Useful for a multiple file stream.

Parameters:
srcIdxindex of the source
Returns:
the name of the source

Implements alize::FeatureInputStream.

virtual real_t alize::FeatureServer::getSampleRate (  ) [virtual]

Returns the sample rate of the stream.

Returns:
the sample rate of the stream

Implements alize::FeatureInputStream.

const String& alize::FeatureServer::getServerName (  ) const
virtual unsigned long alize::FeatureServer::getSourceCount (  ) [virtual]

Returns the number of source read by the reader

Returns:
the number of sources

Implements alize::FeatureInputStream.

virtual unsigned long alize::FeatureServer::getVectSize (  ) [virtual]

Returns the vectSize of the features

Returns:
the vectSize of the features

Implements alize::FeatureInputStream.

void alize::FeatureServer::init ( const Config c,
const FileName f,
LabelServer ls 
)

Re-initialize this server.

Parameters:
cconfiguration to build the server
fa feature file or a file (extension ".lst") that contains a list of feature files
lsa label server.
void alize::FeatureServer::init ( const Config c,
FeatureInputStream s 
)

Re-initialize this server.

Parameters:
cconfiguration to build the server
sa reference to a FeatureStream object that can provide features for the server.
void alize::FeatureServer::init ( const Config c,
const XLine l 
)

Re-initialize this server. Creates a FeatureServer object.

Parameters:
cconfiguration to build the server
la list of feature file names WITHOUT PATH AND EXTENSION The file type, extension and path come from the configuration (parameters "loadFeatureFileFormat" and "featureFilesPath")
void alize::FeatureServer::init ( const Config c )

Re-initialize this server.

Parameters:
cconfiguration to build the server
void alize::FeatureServer::init ( const Config c,
const XLine l,
LabelServer ls 
)

Re-initialize this server.

Parameters:
cconfiguration to build the server
la list of feature file names WITHOUT PATH AND EXTENSION The file type, extension and path come from the configuration (parameters "loadFeatureFileFormat" and "featureFilesPath")
lsa label server.
void alize::FeatureServer::init (  ) [private]
void alize::FeatureServer::init ( const Config c,
const FileName f 
)

Re-initialize this server. Creates a FeatureServer object.

Parameters:
cconfiguration to build the server
fa feature file or a file (extension ".lst") that contains a list of feature files
FeatureInputStream& alize::FeatureServer::inputStream (  ) [private]
bool alize::FeatureServer::operator!= ( const FeatureServer  ) [private]

Not implemented

const FeatureServer& alize::FeatureServer::operator= ( const FeatureServer  ) [private]

Not implemented

bool alize::FeatureServer::operator== ( const FeatureServer  ) [private]

Not implemented

virtual bool alize::FeatureServer::readFeature ( Feature f,
unsigned long  s = 1 
) [virtual]

Reads a feature

Parameters:
fthe feature to store the data read
safter reading, the feature pointer is moved s steps forward. Can be 0
Returns:
false if end of stream met; true otherwise. In that case think to test feature validity before using

Implements alize::FeatureInputStream.

Referenced by alize::ViterbiAccum::computeAndAccumulate().

void alize::FeatureServer::releaseAll (  ) [private]
virtual void alize::FeatureServer::reset (  ) [virtual]

Reset the server

Exceptions:
Exceptionif the server cannot be reseted
IOExceptionif an I/O error occurs

Implements alize::FeatureInputStream.

virtual void alize::FeatureServer::seekFeature ( unsigned long  n,
const String s = "" 
) [virtual]

Moves the feature pointer for the next reading/writing

Parameters:
nindex of the next feature to read or write in the source
sname of the source. Default is ""

Implements alize::FeatureInputStream.

Referenced by alize::ViterbiAccum::computeAndAccumulate().

void alize::FeatureServer::setServerName ( const String s )
virtual String alize::FeatureServer::toString (  ) const [virtual]

This method is frequently overridden in the derived classes. If it is not, it returns the name of the class of the object and the address of the object

Returns:
a description of the object

Reimplemented from alize::Object.

virtual bool alize::FeatureServer::writeFeature ( const Feature f,
unsigned long  s = 1 
) [virtual]

Writes a feature

Parameters:
fthe feature
safter writing, the feature pointer is moved s steps forward. Can be 0

Reimplemented from alize::FeatureInputStream.


Friends And Related Function Documentation

friend class TestFeatureServer [friend]

Definition at line 96 of file FeatureServer.h.


Member Data Documentation

Definition at line 300 of file FeatureServer.h.

Definition at line 301 of file FeatureServer.h.

Definition at line 302 of file FeatureServer.h.


The documentation for this class was generated from the following file: