Skip to content
Snippets Groups Projects
Commit abb71284 authored by Franck Dary's avatar Franck Dary
Browse files

Added some members to Config

parent d41dffa5
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@
#include <string>
#include <vector>
#include <boost/flyweight.hpp>
#include <boost/circular_buffer.hpp>
#include "util.hpp"
class Config
......@@ -24,6 +25,10 @@ class Config
using ConstValueIterator = std::vector<String>::const_iterator;
std::vector<String> lines;
std::size_t wordIndex{0};
std::size_t characterIndex{0};
String state{"NONE"};
boost::circular_buffer<String> history{10};
protected :
......@@ -39,13 +44,9 @@ class Config
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;
......@@ -54,6 +55,11 @@ class Config
virtual ~Config() {}
void print(FILE * dest) const;
String & get(const std::string & colName, int lineIndex, int hypothesisIndex);
const String & getConst(const std::string & colName, int lineIndex, int hypothesisIndex) const;
String & getLastNotEmpty(const std::string & colName, int lineIndex);
const String & getLastNotEmptyConst(const std::string & colName, int lineIndex) const;
void addToHistory(const String & transition);
};
#endif
......@@ -13,7 +13,7 @@ class SubConfig : public Config
private :
const BaseConfig & model;
int firstLineIndex;
int firstLineIndex{0};
private :
......
......@@ -100,3 +100,8 @@ Config::ConstValueIterator Config::getConstIterator(int colIndex, int lineIndex,
return lines.begin() + getIndexOfLine(lineIndex-getFirstLineIndex()) + getIndexOfCol(colIndex) + hypothesisIndex;
}
void Config::addToHistory(const Config::String & transition)
{
history.push_back(transition);
}
......@@ -2,7 +2,6 @@
SubConfig::SubConfig(BaseConfig & model) : model(model)
{
firstLineIndex = 0;
update();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment