StochHMM  v0.34
Flexible Hidden Markov Model C++ Library and Application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes
StochHMM::tracks Class Reference

#include <track.h>

List of all members.

Public Member Functions

void push_back (track *)
size_t indexOf (const std::string &)
size_t size ()
trackgetTrack (const std::string &)
bool isTrackDefined (const std::string &)
trackoperator[] (size_t i)
void print ()
 Print the each track in tracks to stdout.
std::string stringify ()

Private Attributes

std::vector< track * > trks
std::map< std::string, size_t > index

Detailed Description

Definition at line 287 of file track.h.


Member Function Documentation

track * StochHMM::tracks::getTrack ( const std::string &  name)

Get pointer to track from the track name

Parameters:
nameName of the track
Returns:
pointer to track if it exists, NULL otherwise

Definition at line 542 of file track.cpp.

References index, and trks.

Referenced by StochHMM::transition::_parseLexical(), StochHMM::model::getTrack(), StochHMM::transitionFuncParam::parse(), StochHMM::emm::parse(), and StochHMM::emissionFuncParam::parse().

{
if (index.count(name)){
return trks[index[name]];
}
else{
return NULL;
}
}
size_t StochHMM::tracks::indexOf ( const std::string &  name)

Get iterator index of track by tracks name

Parameters:
nameName of the track
Returns:
size_t Iterator to track within the tracks
-1 if track doesn't exist in tracks

Definition at line 529 of file track.cpp.

References index, and SIZE_MAX.

Referenced by StochHMM::model::getTrackIter().

{
if (index.count(name)){
return index[name];
}
else{
return SIZE_MAX;
}
}
bool StochHMM::tracks::isTrackDefined ( const std::string &  name)

Definition at line 551 of file track.cpp.

References index.

Referenced by StochHMM::emm::_processTags().

{
if (index.count(name)){
return true;
}
return false;
}
track* StochHMM::tracks::operator[] ( size_t  i)
inline

Definition at line 298 of file track.h.

References trks.

{return trks[i];};
void StochHMM::tracks::print ( )

Print the each track in tracks to stdout.

Definition at line 560 of file track.cpp.

References stringify().

{
std::cout << stringify() << std::endl;
}
void StochHMM::tracks::push_back ( track tk)

Add track to tracks container

Parameters:
tkPointer to track to be added

Definition at line 511 of file track.cpp.

References StochHMM::track::getName(), index, StochHMM::track::name, and trks.

Referenced by StochHMM::model::_parseTracks(), and StochHMM::model::addTrack().

{
std::string& name= tk->name;
if (!index.count(name)){
index[tk->getName()]=trks.size();
trks.push_back(tk);
}
else{
std::cerr << "Track with name: " << name << " already exists. Cannot add tracks with the same name\n";
exit(1);
}
}
size_t StochHMM::tracks::size ( void  )
inline
std::string StochHMM::tracks::stringify ( )

Get string representation of each track in tracks

Returns:
std::string String representation of tracks as in model file

Definition at line 566 of file track.cpp.

References trks.

Referenced by StochHMM::model::_stringifyTracks(), and print().

{
std::string trackString;
std::string ambigString;
std::string lnSep(50,'=');
trackString+="TRACK SYMBOL DEFINITIONS\n" + lnSep + "\n";
for(size_t i=0;i<trks.size();i++){
trackString+=trks[i]->stringify();
if (trks[i]->isAmbiguousSet()){
ambigString+=trks[i]->stringifyAmbig();
}
}
if (!ambigString.empty()){
ambigString="AMBIGUOUS SYMBOL DEFINITIONS\n" + lnSep + "\n"+ ambigString;
trackString+="\n" + ambigString + "\n";
}
else{
trackString+="\n";
}
return trackString;
}

Member Data Documentation

std::map<std::string,size_t> StochHMM::tracks::index
private

Definition at line 305 of file track.h.

Referenced by getTrack(), indexOf(), isTrackDefined(), and push_back().

std::vector<track*> StochHMM::tracks::trks
private

Definition at line 304 of file track.h.

Referenced by getTrack(), operator[](), push_back(), size(), and stringify().


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