From 343dde975d25dba7d7c8737eaf94be7f3a17d7b9 Mon Sep 17 00:00:00 2001 From: UnavailableDev <69792062+UnavailableDev@users.noreply.github.com> Date: Sat, 15 Jun 2024 12:06:08 +0200 Subject: doxygen comments --- Circuit.h | 5 +++++ LoopDetection.h | 1 + Net.h | 2 ++ Node.h | 2 ++ Observer.h | 2 +- SignalLevel.h | 2 ++ readme.md | 12 ++++++------ 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 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 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 &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 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 +//! 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 (`//! ` boven functies/variabelen, +- [x] stomme doxygen (`//! ` 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 -- cgit v1.2.3