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::weights Class Reference

#include <weight.h>

List of all members.

Public Member Functions

void addWeight (weight *)
weightoperator[] (std::string &)
size_t count (std::string &name)
void print ()
std::string stringify ()

Private Attributes

std::map< std::string, weight * > wts

Detailed Description

Weights class keeps track of multiple weight types *Each weight can be indexed by a name

Definition at line 160 of file weight.h.


Member Function Documentation

void StochHMM::weights::addWeight ( weight wt)

Definition at line 418 of file weight.cpp.

References StochHMM::weight::getName(), and wts.

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

{
std::string& name=wt->getName();
if (!wts.count(name)){
wts[name]=wt;
return;
}
else{
std::cerr << "Weight of name: " << name << " already exists and is duplicated. Please remove duplicates.\n";
exit(1);
}
}
size_t StochHMM::weights::count ( std::string &  name)
inline

Definition at line 168 of file weight.h.

References wts.

Referenced by StochHMM::transitionFuncParam::parse(), and StochHMM::emissionFuncParam::parse().

{return wts.count(name);};
weight * StochHMM::weights::operator[] ( std::string &  name)

Definition at line 431 of file weight.cpp.

References wts.

{
if (wts.count(name)){
return wts[name];
}
else{
return NULL;
}
}
void StochHMM::weights::print ( )

Definition at line 440 of file weight.cpp.

References stringify().

{
std::cout << stringify() << std::endl;
}
std::string StochHMM::weights::stringify ( )

Definition at line 444 of file weight.cpp.

References wts.

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

{
std::string weightString;
std::string lnSep(50,'=');
weightString+= "SCALING FUNCTIONS\n" + lnSep + "\n";
std::map<std::string,weight*>::iterator it;
for(it=wts.begin();it!=wts.end();it++){
weightString+="SCALE:\t" + (*it).first + "\n";
weightString+=(*it).second->stringify();
}
weightString+="\n";
return weightString;
}

Member Data Documentation

std::map<std::string, weight*> StochHMM::weights::wts
private

Definition at line 174 of file weight.h.

Referenced by addWeight(), count(), operator[](), and stringify().


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