aboutsummaryrefslogtreecommitdiff
path: root/Node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Node.cpp')
-rw-r--r--Node.cpp47
1 files changed, 11 insertions, 36 deletions
diff --git a/Node.cpp b/Node.cpp
index d351af1..a0fc27b 100644
--- a/Node.cpp
+++ b/Node.cpp
@@ -1,47 +1,22 @@
#include "Node.h"
+#include "NodeFactory.h"
#include <iostream>
-Node::Node(){}
-Node::~Node(){}
-void Node::addInput(Net* net){
- net->attach(this);
+Node::Node(const char * type) {
+ NodeFactory::assign(type, this);
}
+
+void Node::addInput(Net* net) {
+ net->attach(this);
+}
+
void Node::setOutput(Net* net){
- this->output = net;
+ this->output = net;
}
void Node::update(){
- std::cout << "updated" << std::endl;
- this->compare();
+ std::cout << "updated" << std::endl;
+ this->compare();
}
-/*/ Concrete Nodes: /*/
-
-void GateAnd::compare(){
- SignalLevel new_out = HIGH;
-
- // TODO fix segfault somewhere below
- // for (int i = 0; i < this->inputs.size(); i++){
- // switch (this->inputs[i]->getLevel()){
- // case LOW:
- // new_out = LOW;
- // break;
- // case HIGH:
- // continue;
- // break;
- // case UNDEFINED:
- // default:
- // new_out = UNDEFINED;
- // exit;
- // break;
- // }
- // }
-
- // if (this->output->getLevel() == new_out){
- // /* do nothing */
- // } else {
- // this->output->setLevel(new_out);
- // }
-
-}