aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-16 10:26:07 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-16 10:26:07 +0200
commitfe17bf1e29884902ff4eda519345f2018ca0b6a1 (patch)
treed9c44d436c0e3d2f927b58473e63af5a56701d18
parent1fcb7e5f3b2f1ce8663192c62529ce227a046af3 (diff)
check member visibility
-rw-r--r--GateAnd.h4
-rw-r--r--GateNand.h7
-rw-r--r--GateNor.h7
-rw-r--r--GateNot.h7
-rw-r--r--GateOr.h9
-rw-r--r--GateXor.h10
-rw-r--r--Node.h2
-rw-r--r--NodeInput.h13
-rw-r--r--NodeOutput.h12
-rw-r--r--Observer.h6
-rw-r--r--Parser.cpp1
-rw-r--r--Parser.h3
-rw-r--r--main.cpp1
13 files changed, 45 insertions, 37 deletions
diff --git a/GateAnd.h b/GateAnd.h
index 4c19836..8b399e1 100644
--- a/GateAnd.h
+++ b/GateAnd.h
@@ -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:
diff --git a/GateNand.h b/GateNand.h
index fb9d788..3d78af5 100644
--- a/GateNand.h
+++ b/GateNand.h
@@ -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;
};
diff --git a/GateNor.h b/GateNor.h
index 35b5a74..e094f46 100644
--- a/GateNor.h
+++ b/GateNor.h
@@ -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;
};
diff --git a/GateNot.h b/GateNot.h
index 2a185f9..0f79a0d 100644
--- a/GateNot.h
+++ b/GateNot.h
@@ -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;
};
diff --git a/GateOr.h b/GateOr.h
index bc96b24..6daa989 100644
--- a/GateOr.h
+++ b/GateOr.h
@@ -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;
};
diff --git a/GateXor.h b/GateXor.h
index b70d552..7665b8c 100644
--- a/GateXor.h
+++ b/GateXor.h
@@ -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;
};
diff --git a/Node.h b/Node.h
index 9685141..34e1895 100644
--- a/Node.h
+++ b/Node.h
@@ -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;
diff --git a/Observer.h b/Observer.h
index 53c23c7..1d03525 100644
--- a/Observer.h
+++ b/Observer.h
@@ -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;
};
diff --git a/Parser.cpp b/Parser.cpp
index 9b98267..e72e3f9 100644
--- a/Parser.cpp
+++ b/Parser.cpp
@@ -2,6 +2,7 @@
#include <sstream>
#include "Parser.h"
+#include "Exception.h"
using std::getline;
diff --git a/Parser.h b/Parser.h
index 271d0f4..221e14e 100644
--- a/Parser.h
+++ b/Parser.h
@@ -5,13 +5,10 @@
#include "Circuit.h"
-#include "Exception.h"
using std::istream;
using std::string;
-
-
class Parser {
public:
Parser() = default;
diff --git a/main.cpp b/main.cpp
index b87eab7..4b4fc46 100644
--- a/main.cpp
+++ b/main.cpp
@@ -4,6 +4,7 @@
#include "Parser.h"
#include "Circuit.h"
+#include "Exception.h"
using std::cout;
using std::endl;