Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes

alize::FeatureInputStream Class Reference

#include <FeatureInputStream.h>

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

List of all members.

Public Types

enum  Error { NO_ERROR, FEATURE_OUT_OF_HISTORY }

Public Member Functions

 FeatureInputStream ()
 FeatureInputStream (const Config &c, LabelServer *ls=NULL)
const ConfiggetConfig () const
bool existsConfig () const
virtual ~FeatureInputStream ()
virtual bool readFeature (Feature &f, unsigned long s=1)=0
virtual bool writeFeature (const Feature &f, unsigned long s=1)
virtual void reset ()=0
virtual void close ()=0
virtual unsigned long getVectSize ()=0
virtual const FeatureFlagsgetFeatureFlags ()=0
virtual real_t getSampleRate ()=0
virtual unsigned long getFeatureCount ()=0
virtual void seekFeature (unsigned long pos, const String &srcName="")=0
virtual unsigned long getSourceCount ()=0
virtual unsigned long getFeatureCountOfASource (unsigned long srcIdx)=0
virtual unsigned long getFeatureCountOfASource (const String &srcName)=0
virtual unsigned long getFirstFeatureIndexOfASource (unsigned long srcIdx)=0
virtual unsigned long getFirstFeatureIndexOfASource (const String &srcName)=0
virtual const StringgetNameOfASource (unsigned long srcIdx)=0
Error getError ()
virtual String getClassName () const =0

Protected Member Functions

void init (const Config &c, LabelServer *ls=NULL)

Protected Attributes

LabelServer_pLabelServer
Error _error
bool _seekWanted
unsigned long _seekWantedIdx
String _seekWantedSrcName
bool _featuresAreWritable

Private Attributes

const Config_pConfig

Detailed Description

Abstract class for a feature input stream. <FRANCAIS>
Classe abstraite de base pour les classes dont le rôle est de fournir des features a la demande (methode readFeature). Toutes ces classes peuvent etre connectees a un serveur de label. Ainsi il leur est possible d'affecter un label ŕ chaque feature. L'adresse du serveur de label peut etre passee lors de la contruction La variable _error permet aux sous-classes de passer un message a l'utilisateur. Par exemple : signaler la cause d'un arret d'envoi de donnees (fin de fichier, fin de stream...)
Ce message peut etre lu grace a la methode heritee publique getError()

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

Definition at line 95 of file FeatureInputStream.h.


Member Enumeration Documentation

Enumerator:
NO_ERROR 
FEATURE_OUT_OF_HISTORY 

Definition at line 100 of file FeatureInputStream.h.


Constructor & Destructor Documentation

alize::FeatureInputStream::FeatureInputStream (  ) [explicit]
alize::FeatureInputStream::FeatureInputStream ( const Config c,
LabelServer ls = NULL 
) [explicit]

Store the address of the label server and set the internal message to "".

Parameters:
pAddress of the label server. Can be NULL.
virtual alize::FeatureInputStream::~FeatureInputStream (  ) [virtual]

Member Function Documentation

virtual void alize::FeatureInputStream::close (  ) [pure virtual]
bool alize::FeatureInputStream::existsConfig (  ) const
virtual String alize::FeatureInputStream::getClassName (  ) const [pure virtual]
const Config& alize::FeatureInputStream::getConfig (  ) const
S::Error FeatureInputStream::getError (  )

Gets the last feature error code from this stream

Returns:
the error.

Definition at line 95 of file FeatureInputStream.cpp.

References _error.

virtual unsigned long alize::FeatureInputStream::getFeatureCount (  ) [pure virtual]

Returns the number of features of the stream. Must be overloaded in derived classes. Always throw Exception in this class.

Returns:
the number of features of the stream
Exceptions:
IOExceptionif an I/O error occurs

Implemented in alize::FeatureFileReader, alize::FeatureFileReaderHTK, alize::FeatureFileReaderRaw, alize::FeatureFileReaderSPro3, alize::FeatureFileReaderSPro4, alize::FeatureInputStreamModifier, alize::FeatureMultipleFileReader, and alize::FeatureServer.

virtual unsigned long alize::FeatureInputStream::getFeatureCountOfASource ( unsigned long  srcIdx ) [pure virtual]

Returns the feature count of a feature source (a file)

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

Implemented in alize::FeatureFileReader, alize::FeatureFileReaderSingle, alize::FeatureInputStreamModifier, alize::FeatureMultipleFileReader, and alize::FeatureServer.

virtual unsigned long alize::FeatureInputStream::getFeatureCountOfASource ( const String srcName ) [pure virtual]

Returns the feature count of a feature source (a file)

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

Implemented in alize::FeatureFileReader, alize::FeatureFileReaderSingle, alize::FeatureInputStreamModifier, alize::FeatureMultipleFileReader, and alize::FeatureServer.

virtual const FeatureFlags& alize::FeatureInputStream::getFeatureFlags (  ) [pure virtual]

Returns the feature flags of this stream. Must be overloaded in derived classes.

Returns:
the feature flags of this stream
Exceptions:
IOExceptionif an I/O error occurs
FileNotFoundException

Implemented in alize::FeatureFileReader, alize::FeatureFileReaderHTK, alize::FeatureFileReaderRaw, alize::FeatureFileReaderSPro3, alize::FeatureFileReaderSPro4, alize::FeatureInputStreamModifier, alize::FeatureMultipleFileReader, and alize::FeatureServer.

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

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

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

Implemented in alize::FeatureFileReader, alize::FeatureFileReaderSingle, alize::FeatureInputStreamModifier, alize::FeatureMultipleFileReader, and alize::FeatureServer.

virtual unsigned long alize::FeatureInputStream::getFirstFeatureIndexOfASource ( unsigned long  srcIdx ) [pure 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

Implemented in alize::FeatureFileReader, alize::FeatureFileReaderSingle, alize::FeatureInputStreamModifier, alize::FeatureMultipleFileReader, and alize::FeatureServer.

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

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

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

Implemented in alize::FeatureFileReader, alize::FeatureFileReaderSingle, alize::FeatureInputStreamModifier, alize::FeatureMultipleFileReader, and alize::FeatureServer.

virtual real_t alize::FeatureInputStream::getSampleRate (  ) [pure virtual]

Returns the sample rate of this stream. Must be overloaded in derived classes.

Returns:
the sample rate of this stream
Exceptions:
IOExceptionif an I/O error occurs
FileNotFoundException

Implemented in alize::FeatureFileReader, alize::FeatureFileReaderHTK, alize::FeatureFileReaderRaw, alize::FeatureFileReaderSPro3, alize::FeatureFileReaderSPro4, alize::FeatureInputStreamModifier, alize::FeatureMultipleFileReader, and alize::FeatureServer.

virtual unsigned long alize::FeatureInputStream::getSourceCount (  ) [pure virtual]

Returns the number of sources (files) read by the reader

Returns:
the number of sources

Implemented in alize::FeatureFileReader, alize::FeatureFileReaderSingle, alize::FeatureInputStreamModifier, alize::FeatureMultipleFileReader, and alize::FeatureServer.

virtual unsigned long alize::FeatureInputStream::getVectSize (  ) [pure virtual]

Returns the size of the vector inside each feature of the stream. Must be overloaded in derived classes.

Returns:
the size of the vector inside each feature of the stream
Exceptions:
IOExceptionif an I/O error occurs
FileNotFoundException

Implemented in alize::FeatureFileReader, alize::FeatureFileReaderHTK, alize::FeatureFileReaderRaw, alize::FeatureFileReaderSPro3, alize::FeatureFileReaderSPro4, alize::FeatureInputStreamModifier, alize::FeatureMultipleFileReader, and alize::FeatureServer.

void alize::FeatureInputStream::init ( const Config c,
LabelServer ls = NULL 
) [protected]
virtual bool alize::FeatureInputStream::readFeature ( Feature f,
unsigned long  s = 1 
) [pure virtual]

Reads a feature in the stream and move the pointer s step forward

Parameters:
fthe feature to store the data read
sstep (default value = 1)
Returns:
false if there is no more data because the end of the file has been reached
Exceptions:
IOExceptionif an I/O error occurs

Implemented in alize::FeatureFileReader, alize::FeatureFileReaderSingle, alize::FeatureInputStreamModifier, alize::FeatureMultipleFileReader, and alize::FeatureServer.

virtual void alize::FeatureInputStream::reset (  ) [pure virtual]
virtual void alize::FeatureInputStream::seekFeature ( unsigned long  pos,
const String srcName = "" 
) [pure virtual]

Sets the position indicator associated with the stream to a new position. Does not throw any exception or error.

Parameters:
posnew position of the indicator
srcNamesource name to seek in a particular source

Implemented in alize::FeatureFileReader, alize::FeatureFileReaderAbstract, alize::FeatureInputStreamModifier, and alize::FeatureServer.

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

Writes a feature in the stream and move the pointer s step forward

Parameters:
fthe feature to store the data read
sstep (default value = 1)
Returns:
false if there is no more data because the end of the file has been reached
Exceptions:
IOExceptionif an I/O error occurs

Reimplemented in alize::FeatureFileReader, alize::FeatureFileReaderSingle, alize::FeatureInputStreamModifier, alize::FeatureMultipleFileReader, and alize::FeatureServer.

Definition at line 97 of file FeatureInputStream.cpp.


Member Data Documentation

Definition at line 228 of file FeatureInputStream.h.

Referenced by getError().

Definition at line 232 of file FeatureInputStream.h.

Definition at line 236 of file FeatureInputStream.h.

Definition at line 227 of file FeatureInputStream.h.

Definition at line 229 of file FeatureInputStream.h.

unsigned long alize::FeatureInputStream::_seekWantedIdx [protected]

Definition at line 230 of file FeatureInputStream.h.

Definition at line 231 of file FeatureInputStream.h.


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