Go to the documentation of this file.00001 #include "state.h"
00002 #include "helper_functions.h"
00003
00004 class Variable;
00005
00006 State::State(istream &in, const vector<Variable *> &variables) {
00007 check_magic(in, "begin_state");
00008 for(int i = 0; i < variables.size(); i++) {
00009 double value;
00010 cin >> value;
00011 values[variables[i]] = value;
00012 }
00013 check_magic(in, "end_state");
00014 }
00015
00016 double State::operator[](Variable *var) const {
00017 return values.find(var)->second;
00018 }
00019
00020 void State::dump() const {
00021 for(map<Variable *, double>::const_iterator it = values.begin();
00022 it != values.end(); ++it)
00023 cout << " " << it->first->get_name() << ": " << it->second << endl;
00024 }