#pragma once #include #include #include "Observer.h" #include "Net.h" #include "NodeVisitor.h" using std::string; using std::vector; class Node : Observer { public: Node() = default; virtual ~Node() = default; virtual Node * clone() const = 0; public: //! alias to \p sim() for Observer void update(); virtual void addInput(Net *); virtual void setOutput(Net *); virtual void sim(); virtual SignalLevel level() = 0; protected: Node(const char * type); vector inputs; Net * output = nullptr; protected: int min_inputs = -1; int max_inputs = -1; public: virtual void accept(NodeVisitor & visitor) { visitor.visit(*this); } friend NodeVisitor; };