diff options
author | Daniel Jones <admin@danieljon.es> | 2020-06-24 13:00:30 +0930 |
---|---|---|
committer | Daniel Jones <admin@danieljon.es> | 2020-06-24 13:00:30 +0930 |
commit | f81202d509bebf98a986113c1b7a087cd32c43d8 (patch) | |
tree | 2c444ea686cae6b641f79807b0f3a4d4f0f6652b /Gate.h | |
parent | 167e63926ec8b06511bc03a897731c17e4564719 (diff) | |
download | foxlogicgates-f81202d509bebf98a986113c1b7a087cd32c43d8.tar.gz foxlogicgates-f81202d509bebf98a986113c1b7a087cd32c43d8.zip |
logic: now recursively updates gates when a change is made by keeping track of all connected gates
Diffstat (limited to 'Gate.h')
-rw-r--r-- | Gate.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -17,6 +17,7 @@ #define GATE_H #include <string> +#include <vector> class Gate { @@ -44,6 +45,7 @@ class Gate int get_width() { return this->w; }; int get_height() { return this->h; }; bool get_output_state() { return this->output_state; }; + std::vector<int> *get_output_gates() { return &this->output_gate_ids; }; GATE_TYPE get_gate_type() { return this->gate_type; }; Gate *get_input_gate1() { return this->input_gate1; }; Gate *get_input_gate2() { return this->input_gate2; }; @@ -55,6 +57,8 @@ class Gate void set_input_gate1(Gate *gate) { this->input_gate1 = gate; }; void set_input_gate2(Gate *gate) { this->input_gate2 = gate; }; //void set_output_gate(Gate *gate) { this->output_gate = gate; }; + void add_output_gate_id(int id) { this->output_gate_ids.push_back(id); }; + void remove_output_gate_id(int id); void update_state(); private: @@ -70,6 +74,7 @@ class Gate Gate *input_gate1; Gate *input_gate2; //Gate *output_gate; + std::vector<int> output_gate_ids; /* states */ bool output_state = false; |