diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-16 10:26:07 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-16 10:26:07 +0200 |
commit | fe17bf1e29884902ff4eda519345f2018ca0b6a1 (patch) | |
tree | d9c44d436c0e3d2f927b58473e63af5a56701d18 | |
parent | 1fcb7e5f3b2f1ce8663192c62529ce227a046af3 (diff) |
check member visibility
-rw-r--r-- | GateAnd.h | 4 | ||||
-rw-r--r-- | GateNand.h | 7 | ||||
-rw-r--r-- | GateNor.h | 7 | ||||
-rw-r--r-- | GateNot.h | 7 | ||||
-rw-r--r-- | GateOr.h | 9 | ||||
-rw-r--r-- | GateXor.h | 10 | ||||
-rw-r--r-- | Node.h | 2 | ||||
-rw-r--r-- | NodeInput.h | 13 | ||||
-rw-r--r-- | NodeOutput.h | 12 | ||||
-rw-r--r-- | Observer.h | 6 | ||||
-rw-r--r-- | Parser.cpp | 1 | ||||
-rw-r--r-- | Parser.h | 3 | ||||
-rw-r--r-- | main.cpp | 1 |
13 files changed, 45 insertions, 37 deletions
@@ -7,10 +7,10 @@ class GateAnd : public Node { public: GateAnd() = default; - ~GateAnd() = default; + virtual ~GateAnd() = default; virtual GateAnd * clone() const; -protected: +public: SignalLevel level(); private: @@ -1,19 +1,18 @@ #pragma once -// #include "Node.h" #include "GateAnd.h" class GateNand : public GateAnd { + using GateAnd::GateAnd; + public: virtual GateNand * clone() const; -protected: +public: SignalLevel level(); - using GateAnd::GateAnd; private: GateNand(const GateNand *) : GateAnd() {} - // GateNand(const char * type); constexpr static const char * type = "nand"; static GateNand instance; }; @@ -1,19 +1,18 @@ #pragma once -// #include "Node.h" #include "GateOr.h" class GateNor : public GateOr { + using GateOr::GateOr; + public: virtual GateNor * clone() const; -protected: +public: SignalLevel level(); - using GateOr::GateOr; private: GateNor(const GateNor *) : GateOr() {} - // GateNor(const char * type); constexpr static const char * type = "nor"; static GateNor instance; }; @@ -3,15 +3,18 @@ #include "Node.h" class GateNot : public Node { + using Node::Node; + public: GateNot(); - GateNot(const GateNot * prototype); virtual ~GateNot() = default; virtual GateNot * clone() const; + +public: SignalLevel level(); private: - using Node::Node; + GateNot(const GateNot * prototype); constexpr static const char * type = "not"; static GateNot instance; }; @@ -3,17 +3,18 @@ #include "Node.h" class GateOr : public Node { + using Node::Node; + public: GateOr() = default; - GateOr(const GateOr * prototype); - ~GateOr() = default; + virtual ~GateOr() = default; virtual GateOr * clone() const; -protected: +public: SignalLevel level(); private: - using Node::Node; + GateOr(const GateOr * prototype); constexpr static const char * type = "or"; static GateOr instance; }; @@ -3,16 +3,18 @@ #include "Node.h" class GateXor : public Node { + using Node::Node; + public: GateXor() = default; - GateXor(const GateXor * prototype); - ~GateXor() = default; + virtual ~GateXor() = default; virtual GateXor * clone() const; -private: +public: SignalLevel level(); - using Node::Node; +private: + GateXor(const GateXor * prototype); constexpr static const char * type = "xor"; static GateXor instance; }; @@ -23,6 +23,8 @@ public: virtual void setOutput(Net *); //! validate and simulate virtual void sim(); + +public: //! logical implementation of the node/gate virtual SignalLevel level() = 0; diff --git a/NodeInput.h b/NodeInput.h index ebacf4f..4317e0c 100644 --- a/NodeInput.h +++ b/NodeInput.h @@ -3,23 +3,23 @@ #include "Node.h" class NodeInput : public Node { + using Node::Node; + public: NodeInput(); ~NodeInput() = default; virtual void addInput(Net *); - -protected: - using Node::Node; }; class NodeInputLow : public NodeInput { + using NodeInput::NodeInput; + public: virtual NodeInputLow * clone() const; -protected: +public: SignalLevel level(); - using NodeInput::NodeInput; private: NodeInputLow(const NodeInputLow *) : NodeInput() {} @@ -28,12 +28,13 @@ private: }; class NodeInputHigh : public NodeInput { + using NodeInput::NodeInput; + public: virtual NodeInputHigh * clone() const; protected: SignalLevel level(); - using NodeInput::NodeInput; private: NodeInputHigh(const NodeInputHigh *) : NodeInput() {} diff --git a/NodeOutput.h b/NodeOutput.h index 83a8b34..8b3eb44 100644 --- a/NodeOutput.h +++ b/NodeOutput.h @@ -3,19 +3,21 @@ #include "Node.h" class NodeOutput : public Node { + using Node::Node; + public: NodeOutput(); - NodeOutput(const NodeOutput * prototype); - ~NodeOutput() = default; + virtual ~NodeOutput() = default; + virtual NodeOutput * clone() const; virtual void sim(); - virtual SignalLevel level(); - virtual NodeOutput * clone() const; virtual void setOutput(Net *); +public: + virtual SignalLevel level(); private: - using Node::Node; + NodeOutput(const NodeOutput * prototype); constexpr static const char * type = "probe"; static NodeOutput instance; @@ -7,14 +7,14 @@ public: }; class Subject { -private: - std::vector<Observer*> observers; public: virtual void attach(Observer* obs); virtual void detach(Observer*); //! Get number of attached observers virtual int size(); - virtual void notify(); + +private: + std::vector<Observer*> observers; }; @@ -2,6 +2,7 @@ #include <sstream> #include "Parser.h" +#include "Exception.h" using std::getline; @@ -5,13 +5,10 @@ #include "Circuit.h" -#include "Exception.h" using std::istream; using std::string; - - class Parser { public: Parser() = default; @@ -4,6 +4,7 @@ #include "Parser.h" #include "Circuit.h" +#include "Exception.h" using std::cout; using std::endl; |