1 #ifndef __OPENTREP_DISTANCEERRORRULE_HPP
2 #define __OPENTREP_DISTANCEERRORRULE_HPP
14 #include <boost/array.hpp>
36 { {3, 6, 9, 14, 19} };
66 DistanceErrorScale_T::const_iterator itError =
67 _scale.lower_bound (iNbOfLetters);
69 if (itError != _scale.end()) {
70 oNbOfErrors_T = itError->second;
73 oNbOfErrors_T = iNbOfLetters / 4;
103 std::ostringstream oStr;
105 for (DistanceErrorScale_T::const_iterator itError = _scale.begin();
106 itError != _scale.end(); ++itError, ++idx) {
110 oStr << itError->second <<
": " << itError->first;
119 std::ostringstream oStr;
139 _scale.insert (DistanceErrorScale_T::value_type (iScaleArray[idx],
148 for (
NbOfErrors_T idx = 0; idx != iScaleArray.size(); ++idx) {
149 _scale.insert (DistanceErrorScale_T::value_type (iScaleArray[idx],
180 #endif // __OPENTREP_DISTANCEERRORRULE_HPP
std::string toShortString() const
void toStream(std::ostream &ioOut) const
boost::array< NbOfLetters_T, 5 > DistanceErrorScaleArray_T
static const DistanceErrorScaleArray_T K_DEFAULT_ERROR_SCALE
unsigned int NbOfLetters_T
std::map< NbOfLetters_T, NbOfErrors_T > DistanceErrorScale_T
DistanceErrorRule(const DistanceErrorScaleArray_T &iScaleArray)
const DistanceErrorScale_T & getDistanceErrorScale() const
unsigned short NbOfErrors_T
DistanceErrorRule(const DistanceErrorScale_T &iScale)
std::string toString() const
void fromStream(std::istream &)
DistanceErrorRule(const NbOfErrors_T iSize, const NbOfLetters_T iScaleArray[])
NbOfErrors_T getAllowedDistanceError(const NbOfLetters_T &iNbOfLetters) const