LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::lncFeatureFile Class Reference

parent class for the functors which deal with the ASCII file format to store feature vectors. More...

#include <ltiLncFeatureFile.h>

Inheritance diagram for lti::lncFeatureFile:
Inheritance graph
[legend]
Collaboration diagram for lti::lncFeatureFile:
Collaboration graph
[legend]

List of all members.

Classes

class  header
 header of a lnc feature file More...
class  parameters
 lncFeatureFile parameters class More...
struct  patternId
 The ID of a class is determined with three attributes:. More...

Public Member Functions

virtual ~lncFeatureFile ()
bool checkConsistency ()
lncFeatureFilecopy (const lncFeatureFile &other)
void setHeader (const header &other)
headergetHeader ()
const headergetHeader () const
const parametersgetParameters () const

Protected Member Functions

 lncFeatureFile ()
 lncFeatureFile (const lncFeatureFile &other)
bool initialize (const bool deleteFile=false)
bool loadNext (dvector &theVct, patternId &id)
bool saveNext (const dvector &theVct, const patternId &id)
bool isReadyToRead () const
int getNumberOfPatterns () const
int getNumberOfInputUnits () const
bool loadCncFile ()
bool writeCncFile (const std::string &filename)
bool writeToCncFile (const std::string &name)
bool loadPattern (std::istream &source, dvector &theVct, patternId &id)
bool savePattern (std::ostream &dest, const dvector &theVct, const patternId &id) const

Protected Attributes

header theHeader
bool mayCheckConsistence
bool initialized
std::ifstream input
std::ofstream output
std::map< std::string, int > nameToIdMap
std::set< int > usedObjects

Detailed Description

parent class for the functors which deal with the ASCII file format to store feature vectors.

This is an abstract class an cannot be instantiated.

See also:
loadLnc, saveLnc

Constructor & Destructor Documentation

virtual lti::lncFeatureFile::~lncFeatureFile (  )  [virtual]

destructor

lti::lncFeatureFile::lncFeatureFile (  )  [protected]

default constructor

lti::lncFeatureFile::lncFeatureFile ( const lncFeatureFile other  )  [inline, protected]

copy constructor

References copy().


Member Function Documentation

bool lti::lncFeatureFile::checkConsistency (  ) 

check the consistency of the file

lncFeatureFile& lti::lncFeatureFile::copy ( const lncFeatureFile other  ) 

copy member

Reimplemented from lti::functor.

Referenced by lncFeatureFile().

const header& lti::lncFeatureFile::getHeader (  )  const [inline]

get the header information

References theHeader.

header& lti::lncFeatureFile::getHeader (  )  [inline]

get the header information

References theHeader.

int lti::lncFeatureFile::getNumberOfInputUnits (  )  const [inline, protected]

shortcut to the the dimension of the vectors on the file

int lti::lncFeatureFile::getNumberOfPatterns (  )  const [inline, protected]

shortcut to the the number of patterns of the file

References lti::lncFeatureFile::header::numberOfPatterns, and theHeader.

const parameters& lti::lncFeatureFile::getParameters (  )  const

get the used parameters

Reimplemented from lti::ioFunctor.

Reimplemented in lti::saveLnc.

bool lti::lncFeatureFile::initialize ( const bool  deleteFile = false  )  [protected]

use the parameter values to start a reading/writing session

bool lti::lncFeatureFile::isReadyToRead (  )  const [inline, protected]

check if the input stream is ready to be readed

References input.

bool lti::lncFeatureFile::loadCncFile (  )  [protected]

read the cnc file

bool lti::lncFeatureFile::loadNext ( dvector theVct,
patternId id 
) [protected]

load next vector in the feature file

Returns:
true if everything is ok, false if there is no more data available on the file.
bool lti::lncFeatureFile::loadPattern ( std::istream &  source,
dvector theVct,
patternId id 
) [protected]

read from the given stream a pattern (class name, data and class id)

bool lti::lncFeatureFile::saveNext ( const dvector theVct,
const patternId id 
) [protected]

save next vector at the end of the feature file

Returns:
true if everything is ok, if not an exception will be thrown
bool lti::lncFeatureFile::savePattern ( std::ostream &  dest,
const dvector theVct,
const patternId id 
) const [protected]

write in the given stream a pattern (class name, data and class id)

void lti::lncFeatureFile::setHeader ( const header other  )  [inline]

set the header information

References theHeader.

bool lti::lncFeatureFile::writeCncFile ( const std::string &  filename  )  [protected]

write the whole name-id map to the given cnc file (the contents of the file will be destroyed if the file already exists)

Reimplemented in lti::saveLnc.

bool lti::lncFeatureFile::writeToCncFile ( const std::string &  name  )  [protected]

append a class name to the cnc-file (class-name-file)


Member Data Documentation

the first time the file is readed

std::ifstream lti::lncFeatureFile::input [protected]

the input stream when reading a file

Referenced by isReadyToRead().

specify if the file already existed

std::map<std::string,int> lti::lncFeatureFile::nameToIdMap [protected]

the table with the correspondence between class name and id

std::ofstream lti::lncFeatureFile::output [protected]

the output stream when writing a file

the header of the file actually being used

Referenced by getHeader(), getNumberOfPatterns(), and setHeader().

std::set<int> lti::lncFeatureFile::usedObjects [protected]

a set with the ids actually being used


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

Generated on Sat Apr 10 15:28:03 2010 for LTI-Lib by Doxygen 1.6.1