#ifndef VARIABLE_HPP #define VARIABLE_HPP #include #include "Operator.hpp" template struct Variable : public Operator { 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* >& args, const VariableAssignment& ass) const { virtual T operator() (const std::vector< Expression* >& args, const VariableAssignment& assignment, VariableSet* visited) const { //assert(args.size() == 0) if (visited != NULL) visited->insert(*this); return assignment[*this]; } private: const unsigned int _id; const std::string _name; }; template std::ostream& operator<<(std::ostream& cout, const Variable& v) { cout << v.name() << "(" << v.id() << ")"; return cout; } #endif