From f709a5c3c408e021a105334973983fd323a4b106 Mon Sep 17 00:00:00 2001 From: Shaquille Soekhlal Date: Thu, 8 Jun 2023 07:28:57 +0200 Subject: [PATCH] Gewerkt aan opdracht 4 Co-authored-by: Aryan Lala (19097727) --- Opdracht_4/Application/main.cpp | 0 Opdracht_4/Domein/Machine.cpp | 1 + Opdracht_4/Domein/Machine.h | 4 + Opdracht_4/Domein/Mone.cpp | 1 + Opdracht_4/Domein/Mone.h | 4 + Opdracht_4/Domein/Motor.cpp | 1 + Opdracht_4/Domein/Motor.h | 4 + Opdracht_4/Domein/Mtwo.cpp | 1 + Opdracht_4/Domein/Mtwo.h | 4 + Opdracht_4/Domein/Sensor.cpp | 1 + Opdracht_4/Domein/Sensor.h | 4 + .../DomeinImplementatie/MachineImpl.cpp | 1 + Opdracht_4/DomeinImplementatie/MachineImpl.h | 4 + Opdracht_4/DomeinImplementatie/MoneImpl.cpp | 1 + Opdracht_4/DomeinImplementatie/MoneImpl.h | 4 + Opdracht_4/DomeinImplementatie/MtwoImpl.cpp | 1 + Opdracht_4/DomeinImplementatie/MtwoImpl.h | 4 + Opdracht_4/DomeinImplementatie/SensorImpl.cpp | 1 + Opdracht_4/DomeinImplementatie/SensorImpl.h | 4 + Opdracht_4/Observer/Observer.cpp | 13 + Opdracht_4/Observer/Observer.h | 26 ++ Opdracht_4/UserInterface/UI.cpp | 1 + Opdracht_4/UserInterface/UI.h | 4 + Opdracht_4/opdracht4.drawio | 381 +++++++++++------- 24 files changed, 329 insertions(+), 141 deletions(-) create mode 100644 Opdracht_4/Application/main.cpp create mode 100644 Opdracht_4/Domein/Machine.cpp create mode 100644 Opdracht_4/Domein/Machine.h create mode 100644 Opdracht_4/Domein/Mone.cpp create mode 100644 Opdracht_4/Domein/Mone.h create mode 100644 Opdracht_4/Domein/Motor.cpp create mode 100644 Opdracht_4/Domein/Motor.h create mode 100644 Opdracht_4/Domein/Mtwo.cpp create mode 100644 Opdracht_4/Domein/Mtwo.h create mode 100644 Opdracht_4/Domein/Sensor.cpp create mode 100644 Opdracht_4/Domein/Sensor.h create mode 100644 Opdracht_4/DomeinImplementatie/MachineImpl.cpp create mode 100644 Opdracht_4/DomeinImplementatie/MachineImpl.h create mode 100644 Opdracht_4/DomeinImplementatie/MoneImpl.cpp create mode 100644 Opdracht_4/DomeinImplementatie/MoneImpl.h create mode 100644 Opdracht_4/DomeinImplementatie/MtwoImpl.cpp create mode 100644 Opdracht_4/DomeinImplementatie/MtwoImpl.h create mode 100644 Opdracht_4/DomeinImplementatie/SensorImpl.cpp create mode 100644 Opdracht_4/DomeinImplementatie/SensorImpl.h create mode 100644 Opdracht_4/Observer/Observer.cpp create mode 100644 Opdracht_4/Observer/Observer.h create mode 100644 Opdracht_4/UserInterface/UI.cpp create mode 100644 Opdracht_4/UserInterface/UI.h diff --git a/Opdracht_4/Application/main.cpp b/Opdracht_4/Application/main.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Opdracht_4/Domein/Machine.cpp b/Opdracht_4/Domein/Machine.cpp new file mode 100644 index 0000000..8b84790 --- /dev/null +++ b/Opdracht_4/Domein/Machine.cpp @@ -0,0 +1 @@ +#include "Machine.h" \ No newline at end of file diff --git a/Opdracht_4/Domein/Machine.h b/Opdracht_4/Domein/Machine.h new file mode 100644 index 0000000..a4a5ead --- /dev/null +++ b/Opdracht_4/Domein/Machine.h @@ -0,0 +1,4 @@ +#ifndef __Machine_H +#define __Machine_H + +#endif __Machine_H \ No newline at end of file diff --git a/Opdracht_4/Domein/Mone.cpp b/Opdracht_4/Domein/Mone.cpp new file mode 100644 index 0000000..604f1fc --- /dev/null +++ b/Opdracht_4/Domein/Mone.cpp @@ -0,0 +1 @@ +#include "Mone.h" \ No newline at end of file diff --git a/Opdracht_4/Domein/Mone.h b/Opdracht_4/Domein/Mone.h new file mode 100644 index 0000000..c97a941 --- /dev/null +++ b/Opdracht_4/Domein/Mone.h @@ -0,0 +1,4 @@ +#ifndef __Mone_H +#define __Mone_H + +#endif \ No newline at end of file diff --git a/Opdracht_4/Domein/Motor.cpp b/Opdracht_4/Domein/Motor.cpp new file mode 100644 index 0000000..176ddcb --- /dev/null +++ b/Opdracht_4/Domein/Motor.cpp @@ -0,0 +1 @@ +#include "Motor.h" \ No newline at end of file diff --git a/Opdracht_4/Domein/Motor.h b/Opdracht_4/Domein/Motor.h new file mode 100644 index 0000000..3b7345b --- /dev/null +++ b/Opdracht_4/Domein/Motor.h @@ -0,0 +1,4 @@ +#ifndef __Motor_H +#define __Observer_H + +#endif \ No newline at end of file diff --git a/Opdracht_4/Domein/Mtwo.cpp b/Opdracht_4/Domein/Mtwo.cpp new file mode 100644 index 0000000..80d7c93 --- /dev/null +++ b/Opdracht_4/Domein/Mtwo.cpp @@ -0,0 +1 @@ +#include "Mtwo.h" \ No newline at end of file diff --git a/Opdracht_4/Domein/Mtwo.h b/Opdracht_4/Domein/Mtwo.h new file mode 100644 index 0000000..ac4c7dd --- /dev/null +++ b/Opdracht_4/Domein/Mtwo.h @@ -0,0 +1,4 @@ +#ifndef __Mtwo_H +#define __Mtwo_H + +#endif \ No newline at end of file diff --git a/Opdracht_4/Domein/Sensor.cpp b/Opdracht_4/Domein/Sensor.cpp new file mode 100644 index 0000000..4d11d15 --- /dev/null +++ b/Opdracht_4/Domein/Sensor.cpp @@ -0,0 +1 @@ +#include "Sensor.h" \ No newline at end of file diff --git a/Opdracht_4/Domein/Sensor.h b/Opdracht_4/Domein/Sensor.h new file mode 100644 index 0000000..9ec98cd --- /dev/null +++ b/Opdracht_4/Domein/Sensor.h @@ -0,0 +1,4 @@ +#ifndef __Sensor_H +#define __Sensor_H + +#endif \ No newline at end of file diff --git a/Opdracht_4/DomeinImplementatie/MachineImpl.cpp b/Opdracht_4/DomeinImplementatie/MachineImpl.cpp new file mode 100644 index 0000000..a79a8f7 --- /dev/null +++ b/Opdracht_4/DomeinImplementatie/MachineImpl.cpp @@ -0,0 +1 @@ +#include "MachineImpl.h" \ No newline at end of file diff --git a/Opdracht_4/DomeinImplementatie/MachineImpl.h b/Opdracht_4/DomeinImplementatie/MachineImpl.h new file mode 100644 index 0000000..d11b516 --- /dev/null +++ b/Opdracht_4/DomeinImplementatie/MachineImpl.h @@ -0,0 +1,4 @@ +#ifndef __MachioneImpl_H +#define __MachineImpl_H + +#endif \ No newline at end of file diff --git a/Opdracht_4/DomeinImplementatie/MoneImpl.cpp b/Opdracht_4/DomeinImplementatie/MoneImpl.cpp new file mode 100644 index 0000000..b4ba569 --- /dev/null +++ b/Opdracht_4/DomeinImplementatie/MoneImpl.cpp @@ -0,0 +1 @@ +#include "MoneImpl.h" \ No newline at end of file diff --git a/Opdracht_4/DomeinImplementatie/MoneImpl.h b/Opdracht_4/DomeinImplementatie/MoneImpl.h new file mode 100644 index 0000000..fc5be1a --- /dev/null +++ b/Opdracht_4/DomeinImplementatie/MoneImpl.h @@ -0,0 +1,4 @@ +#ifndef __MoneImpl_H +#define __MoneImpl_H + +#endif \ No newline at end of file diff --git a/Opdracht_4/DomeinImplementatie/MtwoImpl.cpp b/Opdracht_4/DomeinImplementatie/MtwoImpl.cpp new file mode 100644 index 0000000..2298cd9 --- /dev/null +++ b/Opdracht_4/DomeinImplementatie/MtwoImpl.cpp @@ -0,0 +1 @@ +#include "MtwoImpl.h" \ No newline at end of file diff --git a/Opdracht_4/DomeinImplementatie/MtwoImpl.h b/Opdracht_4/DomeinImplementatie/MtwoImpl.h new file mode 100644 index 0000000..06c7267 --- /dev/null +++ b/Opdracht_4/DomeinImplementatie/MtwoImpl.h @@ -0,0 +1,4 @@ +#ifndef __MtwoImpl_H +#define __MtwoImpl_H + +#endif \ No newline at end of file diff --git a/Opdracht_4/DomeinImplementatie/SensorImpl.cpp b/Opdracht_4/DomeinImplementatie/SensorImpl.cpp new file mode 100644 index 0000000..d31d6bb --- /dev/null +++ b/Opdracht_4/DomeinImplementatie/SensorImpl.cpp @@ -0,0 +1 @@ +#include "SensorImpl.h" \ No newline at end of file diff --git a/Opdracht_4/DomeinImplementatie/SensorImpl.h b/Opdracht_4/DomeinImplementatie/SensorImpl.h new file mode 100644 index 0000000..933b36f --- /dev/null +++ b/Opdracht_4/DomeinImplementatie/SensorImpl.h @@ -0,0 +1,4 @@ +#ifndef __SensorImpl_H +#define __SensorImpl_H + +#endif \ No newline at end of file diff --git a/Opdracht_4/Observer/Observer.cpp b/Opdracht_4/Observer/Observer.cpp new file mode 100644 index 0000000..6bf0f51 --- /dev/null +++ b/Opdracht_4/Observer/Observer.cpp @@ -0,0 +1,13 @@ +#include "Observer.h" + +void Subject::notify ( ){ +for ( list::iterator i=L.begin( ); i!=L.end( ); ++i ) (*i)->update( ); +} + +Observer::Observer ( Subject* s ) : S(s){ +getSubject( )->insert(this); +} + +Observer::~Observer ( ){ +getSubject( )->remove ( this ); +} \ No newline at end of file diff --git a/Opdracht_4/Observer/Observer.h b/Opdracht_4/Observer/Observer.h new file mode 100644 index 0000000..21d8f6a --- /dev/null +++ b/Opdracht_4/Observer/Observer.h @@ -0,0 +1,26 @@ +#ifndef __Observer_H +#define __Observer_H + +#include + +using namespace std; + +class Subject; + +class Observer{ + private: Subject* S; + protected: Subject* getSubject ( ) const { return S; } + public: Observer (Subject* s); + virtual ~Observer ( ); + virtual void update ( ) = 0; +}; + +class Subject{ + private: list L; + protected: virtual void notify ( ); + public: Subject ( ) { } + virtual ~Subject ( ) { } + virtual void insert (Observer* s) { L.push_front(s); } + virtual void remove (Observer* s) { L.remove(s); } +}; +#endif \ No newline at end of file diff --git a/Opdracht_4/UserInterface/UI.cpp b/Opdracht_4/UserInterface/UI.cpp new file mode 100644 index 0000000..b418007 --- /dev/null +++ b/Opdracht_4/UserInterface/UI.cpp @@ -0,0 +1 @@ +#include "UI.h" \ No newline at end of file diff --git a/Opdracht_4/UserInterface/UI.h b/Opdracht_4/UserInterface/UI.h new file mode 100644 index 0000000..2464a20 --- /dev/null +++ b/Opdracht_4/UserInterface/UI.h @@ -0,0 +1,4 @@ +#ifndef __UI_H +#define __UI_H + +#endif \ No newline at end of file diff --git a/Opdracht_4/opdracht4.drawio b/Opdracht_4/opdracht4.drawio index 5189846..a4d2911 100644 --- a/Opdracht_4/opdracht4.drawio +++ b/Opdracht_4/opdracht4.drawio @@ -1,262 +1,361 @@ - + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - - + + - - + + - - + + - - + + - - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - - - - + + - + - - - - + - - + + - - + + - - + + - - + + - - + + - + - - + + - + - + - - + + - + + - + - - + - - + + - + - - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + - - + - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - + + + + + - - - - - - - - - + + + + + - - + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +