Commit dc43bd22 authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

InputNg: returns map of key/value pairs

parent fb44e393
......@@ -60,6 +60,7 @@ public:
typedef std::string::iterator IteratorType;
typedef Vector<char>::Type VectorCharType;
typedef AinurState::VectorStringType VectorStringType;
Ainur(String str);
......@@ -83,6 +84,12 @@ public:
state_.readValue(t, dummy_ + label);
}
template<typename SomeMapType>
void setMap(SomeMapType& map) const
{
state_.setMap(map);
}
private:
static bool allEmpty(IteratorType first,IteratorType last)
......
......@@ -11,6 +11,8 @@ namespace PsimagLite {
class AinurState {
public:
typedef Vector<SizeType>::Type VectorSizeType;
typedef Vector<String>::Type VectorStringType;
typedef std::complex<DoubleOrFloatType> ComplexType;
......@@ -60,8 +62,6 @@ class AinurState {
Matrix<T>& t_;
}; // struct ActionMatrix
public:
enum ErrorEnum
{
ERR_PARSE_UNDECLARED,
......@@ -150,6 +150,15 @@ public:
used_[x]++;
}
template<typename SomeMapType>
void setMap(SomeMapType& map) const
{
const SizeType n = keys_.size();
assert(n == values_.size());
for (SizeType i = 0; i < n; ++i)
map[keys_[i]] = map[values_[i]];
}
static bool verbose() { return false; }
static String errLabel(ErrorEnum e, String key)
......
......@@ -538,6 +538,7 @@ public:
}
ainur_ = new Ainur(inputWriteable.inputCheck().import() + data_);
ainur_->setMap(mapStrStr_);
}
}
......@@ -547,14 +548,6 @@ public:
ainur_ = 0;
}
template<typename SomeMemResolvType>
SizeType memResolv(SomeMemResolvType&,
SizeType,
String = "") const
{
return 0;
}
void rewind() {}
bool isAinur() const { return (ainur_ != nullptr); }
......@@ -849,6 +842,11 @@ public:
throw RuntimeError("InputNg: Matrix<String> not supported in POD inputs\n");
}
MapStrStrType map() const
{
return mapStrStr_;
}
const String& filename() const
{
return file_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment