aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2024-06-15 12:06:08 +0200
committerUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2024-06-15 12:06:08 +0200
commit343dde975d25dba7d7c8737eaf94be7f3a17d7b9 (patch)
tree9ea8b1da58e5528610b4cd4e086bb6738c2bc17e
parentf2b0ea746d71cececc638077bfd7f2f47e128c14 (diff)
doxygen comments
-rw-r--r--Circuit.h5
-rw-r--r--LoopDetection.h1
-rw-r--r--Net.h2
-rw-r--r--Node.h2
-rw-r--r--Observer.h2
-rw-r--r--SignalLevel.h2
-rw-r--r--readme.md12
7 files changed, 19 insertions, 7 deletions
diff --git a/Circuit.h b/Circuit.h
index e4b48e1..05e4626 100644
--- a/Circuit.h
+++ b/Circuit.h
@@ -18,10 +18,15 @@ public:
virtual ~Circuit();
public:
+ //! Auto-magically creates either a new node or net
virtual void create(string label, vector<string> nodes);
+ //! Create new node (internal function)
virtual void new_node(string label, string type);
+ //! Create new net (internal function)
virtual void new_net(string src, vector<string> dests);
+ //! Simulate the circuit
virtual void sim();
+ //! Get simulation results (probe measure values)
virtual string result();
private:
diff --git a/LoopDetection.h b/LoopDetection.h
index f12c83b..c25887e 100644
--- a/LoopDetection.h
+++ b/LoopDetection.h
@@ -10,6 +10,7 @@ public:
LoopDetection() = default;
virtual ~LoopDetection();
+ //! Add connection and throws CircuitError if it creates a loop
virtual void add_connection(const std::string &src, const std::vector<std::string> &dests);
private:
diff --git a/Net.h b/Net.h
index edd3dfe..1eee15f 100644
--- a/Net.h
+++ b/Net.h
@@ -9,7 +9,9 @@ private:
public:
Net() = default;
virtual ~Net() = default;
+ //! Updates level and notifies all attached observers (node)
virtual void setLevel(SignalLevel);
+ //! Returns level value
virtual SignalLevel getLevel();
};
diff --git a/Node.h b/Node.h
index f2eb497..bb41b26 100644
--- a/Node.h
+++ b/Node.h
@@ -21,7 +21,9 @@ public:
void update();
virtual void addInput(Net *);
virtual void setOutput(Net *);
+ //! validate and simulate
virtual void sim();
+ //! logical implementation of the node/gate
virtual SignalLevel level() = 0;
protected:
diff --git a/Observer.h b/Observer.h
index 20ca887..53c23c7 100644
--- a/Observer.h
+++ b/Observer.h
@@ -10,9 +10,9 @@ class Subject {
private:
std::vector<Observer*> observers;
public:
- // virtual void attach(Observer* obs) { observers.push_back(obs);}
virtual void attach(Observer* obs);
virtual void detach(Observer*);
+ //! Get number of attached observers
virtual int size();
virtual void notify();
diff --git a/SignalLevel.h b/SignalLevel.h
index 81c7ff8..92b7232 100644
--- a/SignalLevel.h
+++ b/SignalLevel.h
@@ -2,6 +2,7 @@
#include <string>
+//! Enum for signal values
enum SignalLevel {
LOW,
HIGH,
@@ -9,6 +10,7 @@ enum SignalLevel {
};
namespace std {
+ //! convert enum to string
std::string to_string(SignalLevel level);
}
diff --git a/readme.md b/readme.md
index 57cd870..6165d5b 100644
--- a/readme.md
+++ b/readme.md
@@ -19,7 +19,7 @@ make
Functions:
-- [ ] loop detection (JOSHUA)
+- [x] loop detection (JOSHUA)
- [x] final output format (LOEK)
Schoonheid:
@@ -28,7 +28,7 @@ Schoonheid:
niet, moet in een constructor o.i.d. gedaan worden)
- [ ] is de scope (public/private/protected) van alle members lekker
consistent?
-- [ ] stomme doxygen (`//! <korte beschrijving>` boven functies/variabelen,
+- [x] stomme doxygen (`//! <korte beschrijving>` boven functies/variabelen,
`//!< wat doet dit` bij enum constantes)
Classes:
@@ -38,12 +38,12 @@ Classes:
- [x] class GateAnd
- [x] class GateNand
- [X] class GateNor
-- [ ] class GateNot
+- [x] class GateNot
- [x] class GateOr
-- [ ] class GateXor
+- [x] class GateXor
- [x] class Net
-- [ ] class NodeInput
-- [ ] class NodeOutput
+- [x] class NodeInput
+- [x] class NodeOutput
- [x] class Parser
- [x] class Subject
- [x] enum SignalLevel