summaryrefslogtreecommitdiff
path: root/impl/Variable.hpp
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@carlo-laptop>2012-05-03 15:35:39 +1000
committerCarlo Zancanaro <carlo@carlo-laptop>2012-05-03 15:35:39 +1000
commitfcecd0e7dc0bf103986c02e2f29fb518cd5571c5 (patch)
tree518bf3fcb3733bb8cc2ef584346aa409ea618a77 /impl/Variable.hpp
parent9fd34b8cdc98ee757fc047216bd51c698cb7b82f (diff)
Add a parser for linear equations
(Also add the antlr jar and C runtime)
Diffstat (limited to 'impl/Variable.hpp')
-rw-r--r--impl/Variable.hpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/impl/Variable.hpp b/impl/Variable.hpp
index 2386e7a..c46db02 100644
--- a/impl/Variable.hpp
+++ b/impl/Variable.hpp
@@ -1,23 +1,28 @@
#ifndef VARIABLE_HPP
#define VARIABLE_HPP
+#include <string>
#include "Operator.hpp"
template<typename T>
struct Variable : public Operator<T> {
- Variable(unsigned int id)
- : _id(id) { }
+ Variable(unsigned int id, const std::string& name)
+ : _id(id), _name(name) { }
Variable(const Variable& other)
: _id(other._id) { }
unsigned int id() const {
return _id;
}
+ std::string name() const {
+ return _name;
+ }
T operator() (const std::vector< Expression<T>* >& args, const VariableAssignment<T>& ass) const {
//assert(args.size() == 0)
return ass[*this];
}
private:
const unsigned int _id;
+ const std::string _name;
};
#endif