Newer
Older
#include <memory>
#include <boost/flyweight.hpp>
protected :
static constexpr const char * EOSColName = "EOS";
static constexpr const char * EOSSymbol1 = "1";
static constexpr const char * EOSSymbol0 = "0";
static constexpr int nbHypothesesMax = 1;
using String = boost::flyweight<std::string>;
using Utf8String = boost::flyweight<util::utf8string>;
using ValueIterator = std::vector<String>::iterator;
using ConstValueIterator = std::vector<String>::const_iterator;
protected :
virtual std::size_t getNbColumns() const = 0;
virtual std::size_t getColIndex(const std::string & colName) const = 0;
virtual std::size_t getFirstLineIndex() const = 0;
virtual const std::string & getColName(int colIndex) const = 0;
protected :
std::size_t getIndexOfLine(int lineIndex) const;
std::size_t getIndexOfCol(int colIndex) const;
std::size_t getNbLines() const;
void addLines(unsigned int nbLines);
void resizeLines(unsigned int nbLines);
String & get(const std::string & colName, int lineIndex, int hypothesisIndex);
String & get(int colIndex, int lineIndex, int hypothesisIndex);
const String & getConst(const std::string & colName, int lineIndex, int hypothesisIndex) const;
const String & getConst(int colIndex, int lineIndex, int hypothesisIndex) const;
String & getLastNotEmpty(const std::string & colName, int lineIndex);
String & getLastNotEmpty(int colIndex, int lineIndex);
const String & getLastNotEmptyConst(const std::string & colName, int lineIndex) const;
const String & getLastNotEmptyConst(int colIndex, int lineIndex) const;
ValueIterator getIterator(int colIndex, int lineIndex, int hypothesisIndex);
ConstValueIterator getConstIterator(int colIndex, int lineIndex, int hypothesisIndex) const;
virtual ~Config() {}