diff options
| author | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
|---|---|---|
| committer | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
| commit | 33613a85afc4b1481367fbe92a17ee59c240250b (patch) | |
| tree | 670b842326116b376b505ec2263878912fca97e2 /Bachelor/Softwaretechnik2/code | |
| download | Studium-master.tar.gz Studium-master.tar.bz2 | |
Diffstat (limited to 'Bachelor/Softwaretechnik2/code')
36 files changed, 2612 insertions, 0 deletions
diff --git a/Bachelor/Softwaretechnik2/code/CDisplay.cpp b/Bachelor/Softwaretechnik2/code/CDisplay.cpp new file mode 100644 index 0000000..f085c89 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CDisplay.cpp @@ -0,0 +1,59 @@ +/**********************************************************************************/
+/* Definitionsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:20
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CDisplay.cpp
+ *
+ */
+
+
+// ino.module.CDisplay.1092.includes
+#include "CDisplay.hpp"
+// ino.end
+#include <windows.h>
+
+#include <iostream>
+using std::cout;
+using std::endl;
+
+// ino.method.starte.866.definition
+int systemModel::AnalyseModell::CDisplay::starte()
+// ino.end
+// ino.method.starte.866.body
+{
+ return 0;
+}
+// ino.end
+
+// ino.method.zeigeGewichtAn.732.definition
+void systemModel::AnalyseModell::CDisplay::zeigeGewichtAn()
+// ino.end
+// ino.method.zeigeGewichtAn.732.body
+{
+}
+// ino.end
+
+// ino.method.aktualisiere.497.definition
+int systemModel::AnalyseModell::CDisplay::aktualisiere()
+// ino.end
+// ino.method.aktualisiere.497.body
+{
+ //Sleep(500);
+ cout << "DISPLAY: Gesamtgewicht " <<pWaage->getGesamtGewicht() << endl;
+ cout << "DISPLAY: Differenzgewicht " <<pWaage->getDifferenzGewicht() << endl;
+ return 0;
+}
+// ino.end
+
+systemModel::AnalyseModell::CDisplay::CDisplay() {
+}
+
+systemModel::AnalyseModell::CDisplay::CDisplay(CWaage *pw) {
+ pWaage=pw;
+}
diff --git a/Bachelor/Softwaretechnik2/code/CDisplay.hpp b/Bachelor/Softwaretechnik2/code/CDisplay.hpp new file mode 100644 index 0000000..0e4cddf --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CDisplay.hpp @@ -0,0 +1,78 @@ +/**********************************************************************************/
+/* Deklarationsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:17
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CDisplay.hpp
+ *
+ */
+
+
+// ino.module.CDisplay.1082.ifndef
+#ifndef _CDISPLAY_HPP_1082
+#define _CDISPLAY_HPP_1082
+// ino.end
+
+#include "CObserver.hpp"
+#include "CWaage.hpp"
+#include <string>
+using std::string;
+
+namespace systemModel {
+ namespace AnalyseModell {
+
+// ino.class.CDisplay.489.declaration
+class CDisplay: public CObserver
+// ino.end
+// ino.class.CDisplay.489.body
+{
+ // ino.attribute.mBeobachtetesGewicht.499.declaration
+ private:
+ int mBeobachtetesGewicht;
+ // ino.end
+
+ // ino.method.starte.866.declaration
+ public:
+ //virtual int starte(CSubjekt *);
+ virtual int starte();
+ // ino.end
+
+ // ino.method.zeigeGewichtAn.732.declaration
+ public:
+ virtual void zeigeGewichtAn();
+ // ino.end
+
+ // ino.method.aktualisiere.497.declaration
+ public:
+ virtual int aktualisiere();
+ // ino.end
+ private:
+ CWaage* pWaage;
+ public:
+ CDisplay();
+ CDisplay(CWaage *);
+
+};
+// ino.end
+
+
+
+
+
+ }; // namespace AnalyseModell
+}; // namespace systemModel
+
+
+#if !defined(NO_IMPLICIT_NAMESPACE_USE)
+using namespace systemModel::AnalyseModell;
+#endif
+
+// ino.module.CDisplay.1082.endif
+#endif
+// ino.end
+
diff --git a/Bachelor/Softwaretechnik2/code/CDosierer.cpp b/Bachelor/Softwaretechnik2/code/CDosierer.cpp new file mode 100644 index 0000000..5d8ea62 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CDosierer.cpp @@ -0,0 +1,97 @@ +/**********************************************************************************/
+/* Definitionsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:59:41
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CDosierer.cpp
+ *
+ */
+
+
+// ino.module.CDosierer.1094.includes
+#include "CDosierer.hpp"
+// ino.end
+#include <string>
+using std::string;
+using std::cout;
+using std::endl;
+
+
+// ino.method.pruefeGewicht.1149.definition
+int systemModel::AnalyseModell::CDosierer::pruefeGewicht()
+// ino.end
+// ino.method.pruefeGewicht.1149.body
+{
+
+
+ int g = pWaage->getDifferenzGewicht();
+ if (g>=getWert())
+ {
+ pWaage->gewichtErreicht();
+ return 0;
+ }
+ else
+
+ {
+ return 1;
+ }
+
+
+
+}
+// ino.end
+/*
+// ino.method.oeffneVentil.1152.definition
+int systemModel::AnalyseModell::CDosierer::oeffneVentil()
+// ino.end
+// ino.method.oeffneVentil.1152.body
+{
+ cout << getname() << "oeffnet Ventil";
+ return 0;
+}
+// ino.end
+
+// ino.method.schliesseVentil.1155.definition
+int systemModel::AnalyseModell::CDosierer::schliesseVentil()
+// ino.end
+// ino.method.schliesseVentil.1155.body
+{
+ cout << getname() << "schliesst Ventil";
+ return 0;
+}
+// ino.end
+*/
+systemModel::AnalyseModell::CDosierer::CDosierer() {
+}
+
+systemModel::AnalyseModell::CDosierer::CDosierer(string s,CWaage * pw):CVentilGeraet(s) {
+ pWaage=pw;
+ setAenderung(4);
+}
+systemModel::AnalyseModell::CDosierer::CDosierer(string s):CVentilGeraet(s) {
+}
+
+int systemModel::AnalyseModell::CDosierer::aktualisiere() {
+ pruefeGewicht();
+ return 0;
+}
+int systemModel::AnalyseModell::CDosierer::startCGeraet(int i) {
+ cout << "Gerät " << getname() << " startet mit Wert "<< i << endl;
+ setWert(i);
+ pWaage->meldeAn(this);
+ pWaage->tariere();
+ pWaage->aktiviere(this);
+ return 0;
+}
+
+int systemModel::AnalyseModell::CDosierer::stopCGeraet() {
+ schliesseVentil();
+ cout << "Gerät " << getname() << " stoppt"<< endl;
+ pWaage->meldeAb();
+ return 0;
+}
diff --git a/Bachelor/Softwaretechnik2/code/CDosierer.hpp b/Bachelor/Softwaretechnik2/code/CDosierer.hpp new file mode 100644 index 0000000..554bfd7 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CDosierer.hpp @@ -0,0 +1,81 @@ +/**********************************************************************************/
+/* Deklarationsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 15:01:44
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CDosierer.hpp
+ *
+ */
+
+
+// ino.module.CDosierer.1083.ifndef
+#ifndef _CDOSIERER_HPP_1083
+#define _CDOSIERER_HPP_1083
+// ino.end
+
+// ino.module.CDosierer.1083.decIncludes
+#include "CVentilGeraet.hpp"
+// ino.end
+
+//#include "CSubjekt.hpp"
+#include "CObserver.hpp"
+#include "CWaage.hpp"
+
+namespace systemModel {
+ namespace AnalyseModell {
+
+
+// ino.class.CDosierer.748.declaration
+class CDosierer: public CVentilGeraet
+// ino.end
+// ino.class.CDosierer.748.body
+{
+ private:
+ CWaage* pWaage;
+ // ino.method.pruefeGewicht.1149.declaration
+ public:
+ virtual int pruefeGewicht();
+ // ino.end
+
+ // ino.method.oeffneVentil.1152.declaration
+ //public:
+ //virtual int oeffneVentil();
+ // ino.end
+
+ // ino.method.schliesseVentil.1155.declaration
+ //public:
+ //virtual int schliesseVentil();
+ public:
+ virtual int aktualisiere();
+ // ino.end
+ public:
+ CDosierer();
+ CDosierer(string);
+ CDosierer(string, CSubjekt *);
+ CDosierer(string, CWaage *);
+ virtual int startCGeraet(int);
+ virtual int stopCGeraet();
+};
+// ino.end
+
+
+
+
+
+ }; // namespace AnalyseModell
+}; // namespace systemModel
+
+
+#if !defined(NO_IMPLICIT_NAMESPACE_USE)
+using namespace systemModel::AnalyseModell;
+#endif
+
+// ino.module.CDosierer.1083.endif
+#endif
+// ino.end
+
diff --git a/Bachelor/Softwaretechnik2/code/CEntleerer.cpp b/Bachelor/Softwaretechnik2/code/CEntleerer.cpp new file mode 100644 index 0000000..e1a6d9f --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CEntleerer.cpp @@ -0,0 +1,89 @@ +/**********************************************************************************/
+/* Definitionsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:59:41
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CEntleerer.cpp
+ *
+ */
+
+
+// ino.module.CEntleerer.1089.includes
+#include "CEntleerer.hpp"
+// ino.end
+
+using std::cout;
+using std::endl;
+
+// ino.method.pruefeGewicht.1146.definition
+int systemModel::AnalyseModell::CEntleerer::pruefeGewicht()
+// ino.end
+// ino.method.pruefeGewicht.1146.body
+{
+ int i = pWaage->getGesamtGewicht();
+ if (i > getWert())
+ {
+ }
+ else
+ {
+ pWaage->gewichtErreicht();
+ }
+ return 0;
+}
+// ino.end
+/*
+// ino.method.oeffneVentil.1140.definition
+int systemModel::AnalyseModell::CEntleerer::oeffneVentil()
+// ino.end
+// ino.method.oeffneVentil.1140.body
+{
+ return 0;
+}
+// ino.end
+
+// ino.method.schliesseVentil.1143.definition
+int systemModel::AnalyseModell::CEntleerer::schliesseVentil()
+// ino.end
+// ino.method.schliesseVentil.1143.body
+{
+ return 0;
+}
+// ino.end
+*/
+systemModel::AnalyseModell::CEntleerer::CEntleerer() {
+}
+
+systemModel::AnalyseModell::CEntleerer::CEntleerer(string s):CVentilGeraet(s) {
+}
+
+systemModel::AnalyseModell::CEntleerer::CEntleerer(string s,CWaage* pw):CVentilGeraet(s) {
+ pWaage=pw;
+ setAenderung(-20);
+}
+
+int systemModel::AnalyseModell::CEntleerer::aktualisiere()
+{
+ pruefeGewicht();
+ return 0;
+}
+int systemModel::AnalyseModell::CEntleerer::startCGeraet(int i)
+{
+ setWert(i);
+ cout << "Gerät " << getname() << " startet mit Wert "<< i << endl;
+ pWaage->meldeAn(this);
+ pWaage->aktiviere(this);
+ return 0;
+}
+
+int systemModel::AnalyseModell::CEntleerer::stopCGeraet()
+{
+ schliesseVentil();
+ cout << "Gerät " << getname() << " stoppt" <<endl;
+ pWaage->meldeAb();
+ return 0;
+}
diff --git a/Bachelor/Softwaretechnik2/code/CEntleerer.hpp b/Bachelor/Softwaretechnik2/code/CEntleerer.hpp new file mode 100644 index 0000000..a81e338 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CEntleerer.hpp @@ -0,0 +1,76 @@ +/**********************************************************************************/
+/* Deklarationsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 15:01:43
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CEntleerer.hpp
+ *
+ */
+
+
+// ino.module.CEntleerer.1084.ifndef
+#ifndef _CENTLEERER_HPP_1084
+#define _CENTLEERER_HPP_1084
+// ino.end
+
+// ino.module.CEntleerer.1084.decIncludes
+#include "CVentilGeraet.hpp"
+// ino.end
+
+#include "CWaage.hpp"
+
+namespace systemModel {
+ namespace AnalyseModell {
+
+
+// ino.class.CEntleerer.750.declaration
+class CEntleerer: public CVentilGeraet
+// ino.end
+// ino.class.CEntleerer.750.body
+{
+ // ino.method.pruefeGewicht.1146.declaration
+ public:
+ virtual int pruefeGewicht();
+ // ino.end
+ private:
+ CWaage* pWaage;
+ // ino.method.oeffneVentil.1140.declaration
+ //public:
+ //virtual int oeffneVentil();
+ // ino.end
+
+ // ino.method.schliesseVentil.1143.declaration
+ //public:
+ //virtual int schliesseVentil();
+ // ino.end
+ public:
+ CEntleerer();
+ CEntleerer(string);
+ CEntleerer(string,CWaage*);
+ virtual int aktualisiere();
+ virtual int startCGeraet(int);
+ virtual int stopCGeraet();
+};
+// ino.end
+
+
+
+
+
+ }; // namespace AnalyseModell
+}; // namespace systemModel
+
+
+#if !defined(NO_IMPLICIT_NAMESPACE_USE)
+using namespace systemModel::AnalyseModell;
+#endif
+
+// ino.module.CEntleerer.1084.endif
+#endif
+// ino.end
+
diff --git a/Bachelor/Softwaretechnik2/code/CGeraet.cpp b/Bachelor/Softwaretechnik2/code/CGeraet.cpp new file mode 100644 index 0000000..1c54d5e --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CGeraet.cpp @@ -0,0 +1,54 @@ +/**********************************************************************************/
+/* Definitionsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:19
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CGeraet.cpp
+ *
+ */
+
+
+// ino.module.CGeraet.1088.includes
+#include "CGeraet.hpp"
+// ino.end
+
+using std::cout;
+using std::endl;
+
+// ino.method.startCGeraet.465.definition
+int systemModel::AnalyseModell::CGeraet::startCGeraet(int)
+// ino.end
+// ino.method.startCGeraet.465.body
+{
+ return 0;
+}
+// ino.end
+
+// ino.method.stopCGeraet.467.definition
+int systemModel::AnalyseModell::CGeraet::stopCGeraet()
+// ino.end
+// ino.method.stopCGeraet.467.body
+{
+ return 0;
+}
+// ino.end
+
+systemModel::AnalyseModell::CGeraet::CGeraet() {
+}
+systemModel::AnalyseModell::CGeraet::CGeraet(string s) {
+ mName = s;
+}
+
+void systemModel::AnalyseModell::CGeraet::setWert(int i)
+{
+ mWert=i;
+}
+void systemModel::AnalyseModell::CGeraet::setName(string s)
+{
+ mName=s;
+}
diff --git a/Bachelor/Softwaretechnik2/code/CGeraet.hpp b/Bachelor/Softwaretechnik2/code/CGeraet.hpp new file mode 100644 index 0000000..1b0dfed --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CGeraet.hpp @@ -0,0 +1,75 @@ +/**********************************************************************************/
+/* Deklarationsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:16
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CGeraet.hpp
+ *
+ */
+
+
+// ino.module.CGeraet.1075.ifndef
+#ifndef _CGERAET_HPP_1075
+#define _CGERAET_HPP_1075
+// ino.end
+#include <string>
+#include <iostream>
+using std::string;
+
+
+namespace systemModel {
+ namespace AnalyseModell {
+
+
+// ino.class.CGeraet.451.declaration
+class CGeraet
+// ino.end
+// ino.class.CGeraet.451.body
+{
+private:
+ int mWert;
+ // ino.attribute.mName.461.declaration
+ private:
+ string mName;
+ // ino.end
+
+ // ino.method.startCGeraet.465.declaration
+ public:
+ virtual int startCGeraet(int)=0;
+ // ino.end
+
+ // ino.method.stopCGeraet.467.declaration
+ public:
+ virtual int stopCGeraet();
+ // ino.end
+ public:
+ CGeraet(string);
+ CGeraet();
+ string getname() {return mName;}
+ void setWert(int);
+ int getWert() {return mWert;}
+ void setName(string s);
+};
+// ino.end
+
+
+
+
+
+ }; // namespace AnalyseModell
+}; // namespace systemModel
+
+
+#if !defined(NO_IMPLICIT_NAMESPACE_USE)
+using namespace systemModel::AnalyseModell;
+#endif
+
+// ino.module.CGeraet.1075.endif
+#endif
+// ino.end
+
diff --git a/Bachelor/Softwaretechnik2/code/CMischer.cpp b/Bachelor/Softwaretechnik2/code/CMischer.cpp new file mode 100644 index 0000000..a5eafe9 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CMischer.cpp @@ -0,0 +1,51 @@ +/**********************************************************************************/
+/* Definitionsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:59:41
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CMischer.cpp
+ *
+ */
+
+
+// ino.module.CMischer.1091.includes
+#include "CMischer.hpp"
+// ino.end
+using std::cout;
+using std::endl;
+
+// ino.method.startGeraet.1134.definition
+int systemModel::AnalyseModell::CMischer::startCGeraet(int i)
+// ino.end
+// ino.method.startGeraet.1134.body
+{
+ cout << "Gerät " << getname() << " startet mit Wert "<< i << endl;
+ setWert(i);
+ stopCGeraet();
+ return 0;
+}
+// ino.end
+
+// ino.method.stopGeraet.1137.definition
+int systemModel::AnalyseModell::CMischer::stopCGeraet()
+// ino.end
+// ino.method.stopGeraet.1137.body
+{
+ cout << "Gerät " << getname() << " stoppt" <<endl;
+ return 0;
+}
+// ino.end
+systemModel::AnalyseModell::CMischer::CMischer()
+{
+}
+systemModel::AnalyseModell::CMischer::CMischer(string s):CGeraet(s)
+{
+
+}
+
+
diff --git a/Bachelor/Softwaretechnik2/code/CMischer.hpp b/Bachelor/Softwaretechnik2/code/CMischer.hpp new file mode 100644 index 0000000..d121bb6 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CMischer.hpp @@ -0,0 +1,63 @@ +/**********************************************************************************/
+/* Deklarationsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 15:01:43
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CMischer.hpp
+ *
+ */
+
+
+// ino.module.CMischer.1085.ifndef
+#ifndef _CMISCHER_HPP_1085
+#define _CMISCHER_HPP_1085
+// ino.end
+
+#include "CGeraet.hpp"
+
+namespace systemModel {
+ namespace AnalyseModell {
+
+
+// ino.class.CMischer.752.declaration
+class CMischer: public CGeraet
+// ino.end
+// ino.class.CMischer.752.body
+{
+
+ // ino.method.startGeraet.1134.declaration
+ public:
+ virtual int startCGeraet(int);
+ // ino.end
+
+ // ino.method.stopGeraet.1137.declaration
+ public:
+ virtual int stopCGeraet();
+ // ino.end
+ public:
+ CMischer();
+ CMischer(string);
+};
+// ino.end
+
+
+
+
+
+ }; // namespace AnalyseModell
+}; // namespace systemModel
+
+
+#if !defined(NO_IMPLICIT_NAMESPACE_USE)
+using namespace systemModel::AnalyseModell;
+#endif
+
+// ino.module.CMischer.1085.endif
+#endif
+// ino.end
+
diff --git a/Bachelor/Softwaretechnik2/code/CObserver.cpp b/Bachelor/Softwaretechnik2/code/CObserver.cpp new file mode 100644 index 0000000..5d2be8a --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CObserver.cpp @@ -0,0 +1,29 @@ +/**********************************************************************************/
+/* Definitionsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:20
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CObserver.cpp
+ *
+ */
+
+
+// ino.module.CObserver.1087.includes
+#include "CObserver.hpp"
+// ino.end
+
+/*systemModel::AnalyseModell::CObserver::CObserver() {
+}*/
+
+/*systemModel::AnalyseModell::CObserver::CObserver(CWaage *pw) {
+ pWaage=pw;
+}*/
+/*void systemModel::AnalyseModell::CObserver::setSubjekt(CSubjekt *ps) {
+ psub=ps;
+}*/
+
diff --git a/Bachelor/Softwaretechnik2/code/CObserver.hpp b/Bachelor/Softwaretechnik2/code/CObserver.hpp new file mode 100644 index 0000000..6437624 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CObserver.hpp @@ -0,0 +1,57 @@ +/**********************************************************************************/
+/* Deklarationsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:17
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CObserver.hpp
+ *
+ */
+
+
+// ino.module.CObserver.1074.ifndef
+#ifndef _COBSERVER_HPP_1074
+#define _COBSERVER_HPP_1074
+// ino.end
+
+
+namespace systemModel {
+ namespace AnalyseModell {
+
+
+// ino.class.CObserver.514.declaration
+class CObserver
+// ino.end
+// ino.class.CObserver.514.body
+{
+ // ino.method.aktualisiere.537.declaration
+ public:
+ virtual int aktualisiere()=0;
+ // ino.end
+/* private:
+ CWaage* pWaage;
+ CObserver();
+ CObserver(CWaage *);*/
+};
+// ino.end
+
+
+
+
+
+ }; // namespace AnalyseModell
+}; // namespace systemModel
+
+
+#if !defined(NO_IMPLICIT_NAMESPACE_USE)
+using namespace systemModel::AnalyseModell;
+#endif
+
+// ino.module.CObserver.1074.endif
+#endif
+// ino.end
+
diff --git a/Bachelor/Softwaretechnik2/code/CRezept.cpp b/Bachelor/Softwaretechnik2/code/CRezept.cpp new file mode 100644 index 0000000..87aa341 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CRezept.cpp @@ -0,0 +1,53 @@ +/**********************************************************************************/
+/* Definitionsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:19
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CRezept.cpp
+ *
+ */
+
+
+// ino.module.CRezept.1077.includes
+#include "CRezept.hpp"
+// ino.end
+#include "CDosierer.hpp"
+#include "CEntleerer.hpp"
+#include "CWaage.hpp"
+#include "CDisplay.hpp"
+#include "CStampfer.hpp"
+#include "CMischer.hpp"
+#include "CRezeptSchritt.hpp"
+
+
+// ino.method.verarbeiteRezept.921.definition
+int systemModel::AnalyseModell::CRezept::verarbeiteRezept()
+// ino.end
+// ino.method.verarbeiteRezept.921.body
+{
+ for (int i=0;i<rezSchr.size();i++)
+ rezSchr[i]->verarbeite();
+ return 0;
+}
+// ino.end
+
+systemModel::AnalyseModell::CRezept::CRezept() {
+ mAktRezeptSchritt=0;
+}
+
+
+void systemModel::AnalyseModell::CRezept::addRezeptschritt(CRezeptschritt * pcrs)
+{
+ //rezSchr[mAktRezeptSchritt]=pcrs;
+ //mAktRezeptSchritt++;
+ rezSchr.push_back(pcrs);
+}
+
+void systemModel::AnalyseModell::CRezept::setAktRezeptschritt(int n) {
+ mAktRezeptSchritt=n;
+}
diff --git a/Bachelor/Softwaretechnik2/code/CRezept.hpp b/Bachelor/Softwaretechnik2/code/CRezept.hpp new file mode 100644 index 0000000..41fbf10 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CRezept.hpp @@ -0,0 +1,73 @@ +/**********************************************************************************/
+/* Deklarationsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:16
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CRezept.hpp
+ *
+ */
+
+
+// ino.module.CRezept.1070.ifndef
+#ifndef _CREZEPT_HPP_1070
+#define _CREZEPT_HPP_1070
+// ino.end
+#include <string>
+#include <vector>
+#include "CRezeptSchritt.hpp"
+using std::string;
+using std::vector;
+
+
+namespace systemModel {
+ namespace AnalyseModell {
+
+
+// ino.class.CRezept.403.declaration
+class CRezept
+// ino.end
+// ino.class.CRezept.403.body
+{
+ // ino.attribute.mName.756.declaration
+ private:
+ vector <CRezeptschritt *> rezSchr;
+ string mName;
+ // ino.end
+
+ // ino.attribute.mAktRezeptSchritt.784.declaration
+ private:
+ int mAktRezeptSchritt;
+ // ino.end
+
+ // ino.method.verarbeiteRezept.921.declaration
+ public:
+ virtual int verarbeiteRezept();
+ // ino.end
+ CRezept();
+ public:
+ virtual void addRezeptschritt(CRezeptschritt *);
+ virtual void setAktRezeptschritt(int);
+};
+// ino.end
+
+
+
+
+
+ }; // namespace AnalyseModell
+}; // namespace systemModel
+
+
+#if !defined(NO_IMPLICIT_NAMESPACE_USE)
+using namespace systemModel::AnalyseModell;
+#endif
+
+// ino.module.CRezept.1070.endif
+#endif
+// ino.end
+
diff --git a/Bachelor/Softwaretechnik2/code/CRezeptProcessor.cpp b/Bachelor/Softwaretechnik2/code/CRezeptProcessor.cpp new file mode 100644 index 0000000..cad5db8 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CRezeptProcessor.cpp @@ -0,0 +1,117 @@ +/**********************************************************************************/
+/* Definitionsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:19
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CRezeptProcessor.cpp
+ *
+ */
+
+
+// ino.module.CRezeptProcessor.1076.includes
+#include "CRezept.hpp"
+#include "CDosierer.hpp"
+#include "CEntleerer.hpp"
+#include "CWaage.hpp"
+#include "CDisplay.hpp"
+#include "CStampfer.hpp"
+#include "CMischer.hpp"
+#include "CRezeptProcessor.hpp"
+// ino.end
+
+#include <iostream>
+using std::cout;
+using std::cin;
+using std::endl;
+
+
+
+// ino.method.verarbeiteRezept.469.definition
+void systemModel::AnalyseModell::CRezeptProzessor::verarbeiteCRezept(CRezept* pCRezept)
+// ino.end
+// ino.method.verarbeiteRezept.469.body
+{
+ pCRezept->verarbeiteRezept();
+}
+// ino.end
+
+systemModel::AnalyseModell::CRezeptProzessor::CRezeptProzessor() {
+
+
+ verarbeiteCRezept(init());
+
+
+}
+
+systemModel::AnalyseModell::CRezeptProzessor::CRezeptProzessor(CRezept* pCRezept) {
+}
+
+CRezept* systemModel::AnalyseModell::CRezeptProzessor::init() {
+
+ CRezept *rez = new CRezept;
+
+ CWaage *wag = new CWaage;
+ CDisplay *disp = new CDisplay(wag);
+ CDosierer *dos1 = new CDosierer((string)"Dosierer 1",wag);
+ CDosierer *dos2 = new CDosierer((string)"Dosierer 2",wag);
+ CDosierer *dos3 = new CDosierer((string)"Dosierer 3",wag);
+ CDosierer *dos4 = new CDosierer((string)"Dosierer 4",wag);
+ CEntleerer *entl = new CEntleerer((string)"Entleerer 1",wag);
+ CStampfer *sta = new CStampfer((string)"Stampfer 1");
+ CMischer *misch = new CMischer((string)"Mischer 1");
+
+
+ int auswahl,menge =0;
+
+ cout<<"Cocktail-Mixer" << endl;
+ cout<<"Auswahl\n1 fuer bestehendes Rezept\n2 fuer neues Rezept\n";
+ cin>>auswahl;
+
+ switch(auswahl){
+
+ case 1: {
+ rez->addRezeptschritt(new CRezeptschritt((string) "Pitu",75,(CGeraet *) dos1));
+ rez->addRezeptschritt(new CRezeptschritt((string) "Eis",83,(CGeraet *) dos2));
+ rez->addRezeptschritt(new CRezeptschritt((string) "Limetten",67,(CGeraet *) dos3));
+ rez->addRezeptschritt(new CRezeptschritt((string) "Zucker",9,(CGeraet *) dos4));
+ rez->addRezeptschritt(new CRezeptschritt((string) "Mischen",20,(CGeraet *) misch));
+ rez->addRezeptschritt(new CRezeptschritt((string) "Stampfen",20,(CGeraet *) sta));
+ rez->addRezeptschritt(new CRezeptschritt((string) "Entleeren",0,(CGeraet *) entl));
+
+
+ };
+ break;
+
+ case 2: { cout<<"Bitte die gewuenschte Menge Pitu angeben: ";
+ cin>>menge;
+ rez->addRezeptschritt(new CRezeptschritt((string) "Pitu",menge,(CGeraet *) dos1));
+ cout<<"Bitte die gewuenschte Menge Eis angeben: ";
+ cin>>menge;
+ rez->addRezeptschritt(new CRezeptschritt((string) "Eis",menge,(CGeraet *) dos2));
+ cout<<"Bitte die gewuenschte Menge an Limetten angeben: ";
+ cin>>menge;
+ rez->addRezeptschritt(new CRezeptschritt((string) "Limetten",menge,(CGeraet *) dos3));
+ cout<<"Bitte die gewuenschte Menge an Zucker angeben: ";
+ cin>>menge;
+ rez->addRezeptschritt(new CRezeptschritt((string) "Zucker",menge,(CGeraet *) dos4));
+ cout<<"Bitte die gewuenschte Mischzeit angeben: ";
+ cin>>menge;
+ rez->addRezeptschritt(new CRezeptschritt((string) "Mischen",menge,(CGeraet *) misch));
+ cout<<"Bitte die gewuenschte Stampfzeit angeben: ";
+ cin>>menge;
+ rez->addRezeptschritt(new CRezeptschritt((string) "Stampfen",menge,(CGeraet *) sta));
+ rez->addRezeptschritt(new CRezeptschritt((string) "Entleeren",menge,(CGeraet *) entl));
+ };
+
+ }
+
+ wag->meldeAn(disp);
+
+return rez;
+}
+
diff --git a/Bachelor/Softwaretechnik2/code/CRezeptProcessor.hpp b/Bachelor/Softwaretechnik2/code/CRezeptProcessor.hpp new file mode 100644 index 0000000..f0bff62 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CRezeptProcessor.hpp @@ -0,0 +1,59 @@ +/**********************************************************************************/
+/* Deklarationsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:15
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CRezeptProcessor.hpp
+ *
+ */
+
+
+// ino.module.CRezeptProcessor.1069.ifndef
+#ifndef _CREZEPTPROCESSOR_HPP_1069
+#define _CREZEPTPROCESSOR_HPP_1069
+// ino.end
+#include <string>
+using std::string;
+#include "CRezept.hpp"
+
+namespace systemModel {
+ namespace AnalyseModell {
+
+
+// ino.class.CRezeptProzessor.440.declaration
+class CRezeptProzessor
+// ino.end
+// ino.class.CRezeptProzessor.440.body
+{
+ // ino.method.verarbeiteRezept.469.declaration
+ public:
+ void verarbeiteCRezept(CRezept* pCRezept);
+ CRezept* init();
+ // ino.end
+ CRezeptProzessor();
+ CRezeptProzessor(CRezept* pCRezept);
+
+};
+// ino.end
+
+
+
+
+
+ }; // namespace AnalyseModell
+}; // namespace systemModel
+
+
+#if !defined(NO_IMPLICIT_NAMESPACE_USE)
+using namespace systemModel::AnalyseModell;
+#endif
+
+// ino.module.CRezeptProcessor.1069.endif
+#endif
+// ino.end
+
diff --git a/Bachelor/Softwaretechnik2/code/CRezeptSchritt.cpp b/Bachelor/Softwaretechnik2/code/CRezeptSchritt.cpp new file mode 100644 index 0000000..91fcd3a --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CRezeptSchritt.cpp @@ -0,0 +1,40 @@ +/**********************************************************************************/
+/* Definitionsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:19
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CRezeptSchritt.cpp
+ *
+ */
+
+
+// ino.module.CRezeptSchritt.1078.includes
+#include "CRezeptSchritt.hpp"
+// ino.end
+
+
+// ino.method.verarbeite.758.definition
+int systemModel::AnalyseModell::CRezeptschritt::verarbeite()
+// ino.end
+// ino.method.verarbeite.758.body
+{
+ pcGeraet->startCGeraet(mWert);
+
+ return 0;
+}
+// ino.end
+systemModel::AnalyseModell::CRezeptschritt::CRezeptschritt() {
+}
+
+systemModel::AnalyseModell::CRezeptschritt::CRezeptschritt(string s, int w, CGeraet * pcg) {
+ mZutat = s;
+ mWert = w;
+ pcGeraet = pcg;
+ pcGeraet->setName(mZutat);
+}
+
diff --git a/Bachelor/Softwaretechnik2/code/CRezeptSchritt.hpp b/Bachelor/Softwaretechnik2/code/CRezeptSchritt.hpp new file mode 100644 index 0000000..258f1f8 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CRezeptSchritt.hpp @@ -0,0 +1,72 @@ +/**********************************************************************************/ +/* Deklarationsmodul */ +/**********************************************************************************/ +/* + * generiert mit Innovator Version 8.1.04 + * + * erstellt am: 12.01.2006 14:36:15 + * Repository : swtc20 + * Modell : swt + * Benutzer : swtc20 + * File : /users/swtc20/code/CRezeptSchritt.hpp + * + */ + + +// ino.module.CRezeptSchritt.1071.ifndef +#ifndef _CREZEPTSCHRITT_HPP_1071 +#define _CREZEPTSCHRITT_HPP_1071 +// ino.end +#include <string> +using std::string; +#include "CDosierer.hpp" +#include "CEntleerer.hpp" +#include "CStampfer.hpp" +#include "CMischer.hpp" +#include "CGeraet.hpp" + +namespace systemModel { + namespace AnalyseModell { + + +// ino.class.CRezeptschritt.401.declaration +class CRezeptschritt +// ino.end +// ino.class.CRezeptschritt.401.body +{ + // ino.attribute.mZutat.560.declaration + private: + string mZutat; + // ino.end + private: + CGeraet *pcGeraet; + // ino.attribute.mWert.431.declaration + private: + int mWert; + // ino.end + + // ino.method.verarbeite.758.declaration + public: + virtual int verarbeite(); + // ino.end + CRezeptschritt(); + CRezeptschritt(string , int , CGeraet *); +}; +// ino.end + + + + + + }; // namespace AnalyseModell +}; // namespace systemModel + + +#if !defined(NO_IMPLICIT_NAMESPACE_USE) +using namespace systemModel::AnalyseModell; +#endif + +// ino.module.CRezeptSchritt.1071.endif +#endif +// ino.end + diff --git a/Bachelor/Softwaretechnik2/code/CStampfer.cpp b/Bachelor/Softwaretechnik2/code/CStampfer.cpp new file mode 100644 index 0000000..69e80cf --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CStampfer.cpp @@ -0,0 +1,42 @@ +/**********************************************************************************/
+/* Definitionsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:59:41
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CStampfer.cpp
+ *
+ */
+
+
+#include "CStampfer.hpp"
+
+using std::cout;
+using std::endl;
+
+int systemModel::AnalyseModell::CStampfer::startCGeraet(int i)
+{
+ cout << "Gerät " << getname() << " startet mit Wert "<< i << endl;
+ setWert(i);
+ stopCGeraet();
+ return 0;
+}
+
+
+int systemModel::AnalyseModell::CStampfer::stopCGeraet()
+{
+ cout << "Gerät " << getname() << " stoppt" << endl;
+ return 0;
+}
+systemModel::AnalyseModell::CStampfer::CStampfer()
+{
+}
+systemModel::AnalyseModell::CStampfer::CStampfer(string s):CGeraet(s)
+{
+
+}
+
diff --git a/Bachelor/Softwaretechnik2/code/CStampfer.hpp b/Bachelor/Softwaretechnik2/code/CStampfer.hpp new file mode 100644 index 0000000..d698d9c --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CStampfer.hpp @@ -0,0 +1,61 @@ +/**********************************************************************************/
+/* Deklarationsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 15:01:42
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CStampfer.hpp
+ *
+ */
+
+
+// ino.module.CStampfer.1086.ifndef
+#ifndef _CSTAMPFER_HPP_1086
+#define _CSTAMPFER_HPP_1086
+// ino.end
+
+#include "CGeraet.hpp"
+namespace systemModel {
+ namespace AnalyseModell {
+
+
+// ino.class.CStampfer.754.declaration
+class CStampfer: public CGeraet
+// ino.end
+// ino.class.CStampfer.754.body
+{
+ // ino.method.startGeraet.1128.declaration
+ public:
+ virtual int startCGeraet(int);
+ // ino.end
+
+ // ino.method.stopGeraet.1131.declaration
+ public:
+ virtual int stopCGeraet();
+ // ino.end
+ public:
+ CStampfer();
+ CStampfer(string);
+};
+// ino.end
+
+
+
+
+
+ }; // namespace AnalyseModell
+}; // namespace systemModel
+
+
+#if !defined(NO_IMPLICIT_NAMESPACE_USE)
+using namespace systemModel::AnalyseModell;
+#endif
+
+// ino.module.CStampfer.1086.endif
+#endif
+// ino.end
+
diff --git a/Bachelor/Softwaretechnik2/code/CSubjekt.cpp b/Bachelor/Softwaretechnik2/code/CSubjekt.cpp new file mode 100644 index 0000000..51c1b58 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CSubjekt.cpp @@ -0,0 +1,57 @@ +/**********************************************************************************/
+/* Definitionsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:19
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CSubjekt.cpp
+ *
+ */
+
+
+// ino.module.CSubjekt.1079.includes
+#include "CObserver.hpp"
+#include "CSubjekt.hpp"
+// ino.end
+
+#include <vector>
+using std::vector;
+
+// ino.method.meldeAn.516.definition
+int systemModel::AnalyseModell::CSubjekt::meldeAn(CObserver *pobs)
+// ino.end
+// ino.method.meldeAn.516.body
+{
+ obsVec.push_back(pobs);
+ //benachrichtigeAlle();
+ return 0;
+}
+// ino.end
+
+// ino.method.meldeAb.518.definition
+int systemModel::AnalyseModell::CSubjekt::meldeAb()
+// ino.end
+// ino.method.meldeAb.518.body
+{
+ obsVec.pop_back();
+ return 0;
+}
+// ino.end
+
+// ino.method.benachrichtige.520.definition
+void systemModel::AnalyseModell::CSubjekt::benachrichtige(CObserver* pBeobachter)
+// ino.end
+// ino.method.benachrichtige.520.body
+{
+}
+// ino.end
+
+
+void systemModel::AnalyseModell::CSubjekt::benachrichtigeAlle() {
+ for (int i=0;i<obsVec.size();i++)
+ obsVec[i]->aktualisiere();
+}
diff --git a/Bachelor/Softwaretechnik2/code/CSubjekt.hpp b/Bachelor/Softwaretechnik2/code/CSubjekt.hpp new file mode 100644 index 0000000..aa2fe74 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CSubjekt.hpp @@ -0,0 +1,73 @@ +/**********************************************************************************/
+/* Deklarationsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:15
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CSubjekt.hpp
+ *
+ */
+
+
+// ino.module.CSubjekt.1072.ifndef
+#ifndef _CSUBJEKT_HPP_1072
+#define _CSUBJEKT_HPP_1072
+// ino.end
+
+#include "CObserver.hpp"
+#include <string>
+#include <vector>
+using std::string;
+using std::vector;
+
+namespace systemModel {
+ namespace AnalyseModell {
+
+
+// ino.class.CSubjekt.512.declaration
+class CSubjekt
+// ino.end
+// ino.class.CSubjekt.512.body
+{
+ // ino.method.meldeAn.516.declaration
+ public:
+ virtual int meldeAn (CObserver *);
+ // ino.end
+
+ // ino.method.meldeAb.518.declaration
+ public:
+ virtual int meldeAb();
+ // ino.end
+
+ // ino.method.benachrichtige.520.declaration
+ public:
+ virtual void benachrichtige(CObserver *);
+ // ino.end
+ public:
+ virtual void benachrichtigeAlle();
+ private:
+ vector<CObserver *> obsVec;
+
+};
+// ino.end
+
+
+
+
+
+ }; // namespace AnalyseModell
+}; // namespace systemModel
+
+
+#if !defined(NO_IMPLICIT_NAMESPACE_USE)
+using namespace systemModel::AnalyseModell;
+#endif
+
+// ino.module.CSubjekt.1072.endif
+#endif
+// ino.end
+
diff --git a/Bachelor/Softwaretechnik2/code/CVentilGeraet.cpp b/Bachelor/Softwaretechnik2/code/CVentilGeraet.cpp new file mode 100644 index 0000000..5b0fb50 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CVentilGeraet.cpp @@ -0,0 +1,70 @@ +/**********************************************************************************/
+/* Definitionsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:18
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CVentilGeraet.cpp
+ *
+ */
+
+
+// ino.module.CVentilGeraet.1090.includes
+#include "CVentilGeraet.hpp"
+// ino.end
+
+#include <iostream>
+using std::cout;
+using std::endl;
+
+// ino.method.pruefeGewicht.995.definition
+int systemModel::AnalyseModell::CVentilGeraet::pruefeGewicht()
+// ino.end
+// ino.method.pruefeGewicht.995.body
+{
+ return 0;
+}
+// ino.end
+
+// ino.method.oeffneVentil.776.definition
+int systemModel::AnalyseModell::CVentilGeraet::oeffneVentil()
+// ino.end
+// ino.method.oeffneVentil.776.body
+{
+ cout << getname() << " oeffnet Ventil" << endl;
+ return 0;
+}
+// ino.end
+
+// ino.method.schliesseVentil.778.definition
+int systemModel::AnalyseModell::CVentilGeraet::schliesseVentil()
+// ino.end
+// ino.method.schliesseVentil.778.body
+{
+ cout << getname() << " schliesst Ventil" <<endl;
+ return 0;
+}
+// ino.end
+
+int systemModel::AnalyseModell::CVentilGeraet::startCGeraet(int i) {
+ return 0;
+}
+
+int systemModel::AnalyseModell::CVentilGeraet::stopCGeraet() {
+ return 0;
+}
+
+systemModel::AnalyseModell::CVentilGeraet::CVentilGeraet() {
+}
+systemModel::AnalyseModell::CVentilGeraet::CVentilGeraet(string s,CSubjekt* pSub): CGeraet(s){
+}
+systemModel::AnalyseModell::CVentilGeraet::CVentilGeraet(string s): CGeraet(s){
+}
+
+void systemModel::AnalyseModell::CVentilGeraet::setAenderung(int i) {
+ mAenderung = i;
+}
diff --git a/Bachelor/Softwaretechnik2/code/CVentilGeraet.hpp b/Bachelor/Softwaretechnik2/code/CVentilGeraet.hpp new file mode 100644 index 0000000..9af9479 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CVentilGeraet.hpp @@ -0,0 +1,82 @@ +/**********************************************************************************/
+/* Deklarationsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:12
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CVentilGeraet.hpp
+ *
+ */
+
+
+// ino.module.CVentilGeraet.1081.ifndef
+#ifndef _CVENTILGERAET_HPP_1081
+#define _CVENTILGERAET_HPP_1081
+// ino.end
+#include "CObserver.hpp"
+#include "CSubjekt.hpp"
+#include "CGeraet.hpp"
+#include <string>
+using std::string;
+
+namespace systemModel {
+ namespace AnalyseModell {
+
+
+// ino.class.CVentilGeraete.774.declaration
+class CVentilGeraet: public CObserver, public CGeraet
+// ino.end
+// ino.class.CVentilGeraete.774.body
+{
+ // ino.method.pruefeGewicht.995.declaration
+ public:
+ virtual int pruefeGewicht();
+ // ino.end
+
+ // ino.method.oeffneVentil.776.declaration
+ public:
+ virtual int oeffneVentil();
+ // ino.end
+
+ // ino.method.schliesseVentil.778.declaration
+ public:
+ virtual int schliesseVentil();
+ // ino.end
+ public:
+ CVentilGeraet();
+ CVentilGeraet(string,CSubjekt *);
+ CVentilGeraet(string);
+ virtual int aktualisiere()=0;
+ public:
+ virtual int startCGeraet(int);
+ public:
+ virtual int stopCGeraet();
+ private:
+ int mAenderung;
+ public:
+ void setAenderung(int);
+ int getAenderung() {return mAenderung;}
+
+};
+// ino.end
+
+
+
+
+
+ }; // namespace AnalyseModell
+}; // namespace systemModel
+
+
+#if !defined(NO_IMPLICIT_NAMESPACE_USE)
+using namespace systemModel::AnalyseModell;
+#endif
+
+// ino.module.CVentilGeraet.1081.endif
+#endif
+// ino.end
+
diff --git a/Bachelor/Softwaretechnik2/code/CWaage.cpp b/Bachelor/Softwaretechnik2/code/CWaage.cpp new file mode 100644 index 0000000..0dac83d --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CWaage.cpp @@ -0,0 +1,129 @@ +/**********************************************************************************/
+/* Definitionsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:18
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CWaage.cpp
+ *
+ */
+
+
+// ino.module.CWaage.1080.includes
+#include "CWaage.hpp"
+// ino.end
+
+int test = 0; //globale Testvariable
+int test2 = 100; //globale Testvariable
+
+// ino.method.aktiviere.760.definition
+int systemModel::AnalyseModell::CWaage::aktiviere(CVentilGeraet *pcvg)
+// ino.end
+// ino.method.aktiviere.760.body
+{
+ pAktVentilGeraet=pcvg;
+ mGewichtErreicht=false;
+ //benachrichtigeAlle();
+ pAktVentilGeraet->oeffneVentil();
+ while (!mGewichtErreicht) {
+ gewichtNichtErreicht();
+ }
+ pAktVentilGeraet->stopCGeraet();
+ return 0;
+}
+// ino.end
+
+// ino.method.gewichtErreicht.762.definition
+int systemModel::AnalyseModell::CWaage::gewichtErreicht()
+// ino.end
+// ino.method.gewichtErreicht.762.body
+{
+ mGewichtErreicht=true;
+ return 0;
+}
+// ino.end
+
+// ino.method.gewichtNichtErreicht.764.definition
+int systemModel::AnalyseModell::CWaage::gewichtNichtErreicht()
+// ino.end
+// ino.method.gewichtNichtErreicht.764.body
+{
+ aendereGewicht();
+ return 0;
+}
+// ino.end
+
+// ino.method.erhoeheGewicht.568.definition
+int systemModel::AnalyseModell::CWaage::erhoeheGewicht(int fBetrag)
+// ino.end
+// ino.method.erhoeheGewicht.568.body
+{
+
+
+ mGesamtGewicht+=fBetrag;
+
+ test += fBetrag;
+
+ return test;
+}
+// ino.end
+
+// ino.method.verringereGewicht.570.definition
+int systemModel::AnalyseModell::CWaage::verringereGewicht(int fBetrag)
+// ino.end
+// ino.method.verringereGewicht.570.body
+{
+ mGesamtGewicht-=fBetrag;
+
+ test2 -= fBetrag;
+
+ return test2;
+}
+// ino.end
+
+// ino.method.getGesamtGewicht.564.definition
+int systemModel::AnalyseModell::CWaage::getGesamtGewicht()
+// ino.end
+// ino.method.getGesamtGewicht.564.body
+{
+ return mGesamtGewicht;
+}
+// ino.end
+
+// ino.method.getDifferenzGewicht.566.definition
+int systemModel::AnalyseModell::CWaage::getDifferenzGewicht()
+// ino.end
+// ino.method.getDifferenzGewicht.566.body
+{
+ return mDifferenzGewicht;
+}
+// ino.end
+
+// ino.method.tariere.487.definition
+void systemModel::AnalyseModell::CWaage::tariere()
+// ino.end
+// ino.method.tariere.487.body
+{
+ mDifferenzGewicht=0;
+ benachrichtigeAlle();
+}
+// ino.end
+
+
+systemModel::AnalyseModell::CWaage::CWaage() {
+ mGesamtGewicht=0;
+ mDifferenzGewicht=0;
+}
+
+void systemModel::AnalyseModell::CWaage::aendereGewicht()
+// ino.end
+// ino.method.verringereGewicht.570.body
+{
+ mDifferenzGewicht=(mDifferenzGewicht+pAktVentilGeraet->getAenderung())>0?mDifferenzGewicht+pAktVentilGeraet->getAenderung():0;
+ mGesamtGewicht+=pAktVentilGeraet->getAenderung();
+ benachrichtigeAlle();
+}
diff --git a/Bachelor/Softwaretechnik2/code/CWaage.hpp b/Bachelor/Softwaretechnik2/code/CWaage.hpp new file mode 100644 index 0000000..e5bab7f --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/CWaage.hpp @@ -0,0 +1,110 @@ +/**********************************************************************************/
+/* Deklarationsmodul */
+/**********************************************************************************/
+/*
+ * generiert mit Innovator Version 8.1.04
+ *
+ * erstellt am: 12.01.2006 14:36:14
+ * Repository : swtc20
+ * Modell : swt
+ * Benutzer : swtc20
+ * File : /users/swtc20/code/CWaage.hpp
+ *
+ */
+
+
+// ino.module.CWaage.1073.ifndef
+#ifndef _CWAAGE_HPP_1073
+#define _CWAAGE_HPP_1073
+// ino.end
+#include <string>
+#include "CSubjekt.hpp"
+#include "CVentilGeraet.hpp"
+using std::string;
+
+
+namespace systemModel {
+ namespace AnalyseModell {
+
+
+// ino.class.CWaage.436.declaration
+class CWaage: public CSubjekt
+// ino.end
+// ino.class.CWaage.436.body
+{
+ // ino.attribute.mGesamtGewicht.481.declaration
+ private:
+ int mGesamtGewicht;
+ // ino.end
+
+ // ino.attribute.mDifferenzGewicht.483.declaration
+ private:
+ int mDifferenzGewicht;
+ // ino.end
+
+ // ino.method.aktiviere.760.declaration
+ public:
+ virtual int aktiviere(CVentilGeraet *);
+ // ino.end
+
+ // ino.method.gewichtErreicht.762.declaration
+ public:
+ virtual int gewichtErreicht();
+ // ino.end
+
+ // ino.method.gewichtNichtErreicht.764.declaration
+ public:
+ virtual int gewichtNichtErreicht();
+ // ino.end
+
+ // ino.method.erhoeheGewicht.568.declaration
+ public:
+ virtual int erhoeheGewicht(int fBetrag);
+ // ino.end
+
+ // ino.method.verringereGewicht.570.declaration
+ public:
+ virtual int verringereGewicht(int fBetrag);
+ // ino.end
+
+ // ino.method.getGesamtGewicht.564.declaration
+ public:
+ virtual int getGesamtGewicht();
+ // ino.end
+
+ // ino.method.getDifferenzGewicht.566.declaration
+ public:
+ virtual int getDifferenzGewicht();
+ // ino.end
+
+ // ino.method.tariere.487.declaration
+ public:
+ virtual void tariere();
+ // ino.end
+ public:
+ CWaage();
+ private:
+ CVentilGeraet *pAktVentilGeraet;
+ public:
+ void aendereGewicht();
+ private:
+ bool mGewichtErreicht;
+};
+// ino.end
+
+
+
+
+
+ }; // namespace AnalyseModell
+}; // namespace systemModel
+
+
+#if !defined(NO_IMPLICIT_NAMESPACE_USE)
+using namespace systemModel::AnalyseModell;
+#endif
+
+// ino.module.CWaage.1073.endif
+#endif
+// ino.end
+
diff --git a/Bachelor/Softwaretechnik2/code/Test.h b/Bachelor/Softwaretechnik2/code/Test.h new file mode 100644 index 0000000..4958172 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/Test.h @@ -0,0 +1,16 @@ +#ifndef _TEST__H
+#define _TEST__H
+
+// #include "TestResult.h"
+
+class Test
+{
+public:
+// void run( TestResult& result) = 0;
+ virtual void run() {}
+ virtual void setUp() {}
+ virtual void tearDown() {}
+};
+
+// No Code behind this line!
+#endif
\ No newline at end of file diff --git a/Bachelor/Softwaretechnik2/code/TestCDosierer.h b/Bachelor/Softwaretechnik2/code/TestCDosierer.h new file mode 100644 index 0000000..16ca4d8 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/TestCDosierer.h @@ -0,0 +1,78 @@ +#ifndef _TESTCDOSIERER__
+#define _TESTCDOSIERER__
+
+
+#include "CDosierer.hpp" // zu testende Klasse
+#include "TestCase.h" // Basisklasse für Testklasse
+
+
+class TestCDosierer : public TestCase
+{
+protected:
+ CDosierer* pCDosierer; // Zeiger auf zu testende Klasse
+ // damit's was zu Initialisieren gibt ...
+
+public:
+ // Initialisierungsmethode
+ void setUp() {
+
+
+ CWaage *wag = new CWaage;
+ pCDosierer = new CDosierer((string)"Dosierer 1",wag);
+
+ }
+
+ // Aufräum-Methode
+ void tearDown() {
+ delete pCDosierer;
+ }
+
+ //! meine Testfunktionen
+ void testDosierer1()
+ {
+
+
+ tN = "testDosierer1 (pruefe Gewicht)";
+
+ tL = __LINE__; // Zeilennummer
+
+ for ( int a = 1; a < 100.; a ++ )
+ {
+ pCDosierer->setWert(a);
+
+ assertEquals( 1, // erwartet (1 für Gewicht nicht erreicht)
+ pCDosierer->pruefeGewicht(), // berechnet
+ 0.1 ); // epsilon
+ } // end for
+ }
+
+ void testDosierer2()
+ {
+
+
+ tN = "testDosierer2 (pruefe Gewicht)";
+
+ tL = __LINE__; // Zeilennummer
+
+
+
+ pCDosierer->setWert(0);
+
+ assertEquals( 0, // erwartet (0 für Gewicht erreicht)
+ pCDosierer->pruefeGewicht(), // berechnet
+ 0.1 ); // epsilon
+
+ }
+
+
+ //! Konstruktor, fügt gleich Testfunktionen hinzu
+ TestCDosierer() : TestCase( "TEST DOSIERER " )
+ {
+ addTest( (TESTFUNC) &TestCDosierer::testDosierer1 );
+ addTest( (TESTFUNC) &TestCDosierer::testDosierer2 );
+
+ }
+
+};
+
+#endif
diff --git a/Bachelor/Softwaretechnik2/code/TestCWaage.h b/Bachelor/Softwaretechnik2/code/TestCWaage.h new file mode 100644 index 0000000..2a733d8 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/TestCWaage.h @@ -0,0 +1,70 @@ +#ifndef _TESTCWAAGE__
+#define _TESTCWAAGE__
+
+
+#include "CWaage.hpp" // zu testende Klasse
+#include "TestCase.h" // Basisklasse für Testklasse
+
+
+class TestCWaage : public TestCase
+{
+protected:
+ CWaage* pCWaage; // Zeiger auf zu testende Klasse
+ // damit's was zu Initialisieren gibt ...
+
+public:
+ // Initialisierungsmethode
+ void setUp() {
+ pCWaage = new CWaage();
+ }
+
+ // Aufräum-Methode
+ void tearDown() {
+ delete pCWaage;
+ }
+
+ //! meine Testfunktionen
+ void testWiegen1()
+ {
+ tN = "testWiegen1 (erhoehen)";
+ int gesamt = 0;
+ tL = __LINE__; // Zeilennummer
+
+ for ( int a = 0; a < 100.; a ++ )
+ {
+ gesamt += a;
+
+ assertEquals( gesamt, //sqrt( a ), // erwartet
+ pCWaage->erhoeheGewicht(a),//pMyMath->wurzel( a, prec ), // berechnet
+ 0.1 ); // epsilon
+ } // end for
+ }
+
+ void testWiegen2()
+ {
+ tN = "testWiegen2 (verringern)";
+ int gesamt = 100;
+ tL = __LINE__; // Zeilennummer
+
+ for ( int a = 100.; a < 100.; a -- )
+ {
+ gesamt -= a;
+
+ assertEquals( (a -1), // erwartet
+ pCWaage->verringereGewicht(a),// berechnet
+ 0.1 );// epsilon
+ } // end for
+ }
+
+
+ //! Konstruktor, fügt gleich Testfunktionen hinzu
+ TestCWaage() : TestCase( "TestCWaage" )
+ {
+ addTest( (TESTFUNC) &TestCWaage::testWiegen1 );
+ addTest( (TESTFUNC) &TestCWaage::testWiegen2 );
+
+ }
+
+};
+
+#endif
diff --git a/Bachelor/Softwaretechnik2/code/TestCase.cpp b/Bachelor/Softwaretechnik2/code/TestCase.cpp new file mode 100644 index 0000000..851d660 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/TestCase.cpp @@ -0,0 +1,206 @@ +#include <iostream>
+#include <string>
+using namespace std;
+#include <stdio.h> // für formatierte Ausgabe im C-Stil
+#define BUFLEN 160 // für Ausgabe
+
+#include "TestCase.h"
+
+// Konstruktor
+TestCase::TestCase( char* name )
+ : testsRun(0), testsFailed(0), testsOK(0)
+{
+ if (name != 0)
+ strncpy( tcName, name, sizeof(tcName)-1 );
+ else
+ tcName[0] = 0; // leerer String
+}
+
+// Hinzufügen von Testfunktionen
+void TestCase::addTest( TESTFUNC f )
+{
+ vecFkt.push_back( f );
+}
+
+// Test-Run für Test Case
+void TestCase::run()
+{
+ testsRun = 0; // Zähler initialisieren
+ testsFailed = 0;
+ testsOK = 0;
+
+ // Setup für Test
+ setUp();
+
+ for (int i = 0; i < vecFkt.size(); i++)
+ {
+ tL = 0; // falls nicht gesetzt durch Fkt
+ tN = ""; // falls nicht gesetzt durch Fkt
+
+ bool success = true; // init
+
+ try {
+ testsRun++; // Tests mitzählen
+ (this->*vecFkt[i])(); // Testfunktion aufrufen
+ }
+ catch ( string msg ) // Fehlerbehandlung
+ {
+ success = false; // Fehler Markieren
+ cout << "Fehler " << tcName << '.' << tN
+ << " Zeile " << tL << " "
+ << msg << endl;
+ }
+
+ // Auswertung des Tests
+ if (success)
+ {
+ testsOK++;
+ cout << "OK: " << tcName << '.' << tN << endl;
+ }
+ else
+ {
+ testsFailed++;
+ }
+
+ } // end for
+
+ // Tear Down für Test
+ tearDown();
+
+ cout << ">>> " << tcName << ":Tests durchgefuehrt: " << testsRun
+ << ", o.k: " << testsOK
+ << ", fehlgeschlagen: " << testsFailed
+ << endl;
+}
+
+void TestCase::assertEquals( int a, int b )
+{
+ if (a != b)
+ {
+ char buf[BUFLEN];
+ sprintf( buf, "%s: soll: %d, ist: %d",
+ "assertEquals(int, int)", a, b);
+ throw ( *(new string( buf )) );
+ }
+}
+
+void TestCase::assertEquals( long a, long b)
+{
+ if (a != b)
+ {
+ char buf[BUFLEN];
+ sprintf( buf, "%s: soll: %d, ist: %d",
+ "assertEquals(long,long)", a, b);
+ throw ( *(new string( buf )) );
+ }
+}
+
+void TestCase::assertEquals( float a, float b)
+{
+ if (a != b)
+ {
+ char buf[BUFLEN];
+ sprintf( buf, "%s: soll: %f, ist: %f",
+ "assertEquals(float,float)", a, b);
+ throw ( *(new string( buf )) );
+ }
+}
+
+void TestCase::assertEquals( double a, double b )
+{
+ if (a != b)
+ {
+ char buf[BUFLEN];
+ sprintf( buf, "%s: soll: %f, ist: %f",
+ "assertEquals(double,double)", a, b);
+ throw ( *(new string( buf )) );
+ }
+}
+
+void TestCase::assertEquals( double a, double b, double epsilon )
+{
+ double diff = ( a >= b ) ? (a-b) : (b-a);
+ if ( diff > epsilon )
+ {
+ char buf[BUFLEN];
+ sprintf( buf, "%s: soll: %f, ist: %f, epsilon: %e",
+ "assertEquals(double,double,double)", a, b, epsilon);
+ throw ( *(new string( buf )) );
+ }
+}
+
+
+void TestCase::assertEquals( bool a, bool b )
+{
+ if (a != b)
+ {
+ char buf[BUFLEN];
+ sprintf( buf, "%s: soll: %s, ist: %s",
+ "assertEquals(bool,bool)",
+ ((a==true) ? "true" : "false"), ((b==true) ? "true" : "false"));
+ throw ( *(new string( buf )) );
+ }
+}
+
+void TestCase::assertEquals( void* a, void* b)
+{
+ if (a != b)
+ {
+ char buf[BUFLEN];
+ sprintf( buf, "%s: soll: %x, ist: %x",
+ "assertEquals(void*,void*)", a, b );
+ throw ( *(new string( buf )) );
+ }
+}
+
+void TestCase::assertEquals( char* a, char* b )
+{
+ if ( strcmp( a, b ) != 0 )
+ {
+ char buf[BUFLEN]; // Achtung Länge hier kritisch!
+ const int StrMaxLen = 48; //!< Ausgabe Einzelstring begrenzen
+ string sa( a ); // Zuweisung auf Klasse string
+ string sb( b ); // erleichtert Manipulationen
+ if (sa.length() > StrMaxLen)
+ sa = sa.substr( 0, StrMaxLen );
+ if (sb.length() > StrMaxLen)
+ sb = sb.substr( 0, StrMaxLen );
+
+ sprintf( buf, "%s: soll: %s, ist: %s",
+ "assertEquals(char*,char*)", sa.c_str(), sb.c_str() );
+ throw ( *(new string( buf )) );
+ }
+}
+
+
+void TestCase::assertTrue( bool a )
+{
+ if (!a)
+ {
+ char buf[BUFLEN];
+ sprintf( buf, "%s: soll: %s",
+ "assertTrue(bool,bool)",
+ ((a==true) ? "true" : "false") );
+ throw ( *(new string( buf )) );
+ }
+}
+
+void TestCase::assertFalse( bool a)
+{
+ if (a)
+ {
+ char buf[BUFLEN];
+ sprintf( buf, "%s: soll: %s",
+ "assertFalse(bool,bool)",
+ ((a==true) ? "true" : "false") );
+ throw ( *(new string( buf )) );
+ }
+}
+
+void TestCase::assertMessage( char* msg )
+{
+ char buf[BUFLEN];
+ sprintf( buf, "%s: Meldung: %s",
+ "assertMessage( char* )", msg );
+ throw ( *(new string( buf )) );
+}
diff --git a/Bachelor/Softwaretechnik2/code/TestCase.h b/Bachelor/Softwaretechnik2/code/TestCase.h new file mode 100644 index 0000000..c4eaca9 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/TestCase.h @@ -0,0 +1,241 @@ +#ifndef _TESTCASE__H
+#define _TESTCASE__H
+
+#include <vector> //!< Container ür Funktionszeiger
+
+#include "Test.h"
+
+class TestCase; //!< Vorwärtsdeklaration für typedef
+
+typedef void (TestCase::*TESTFUNC)(); //!< Definition Testfunktion
+
+/**
+ * TestCase.
+ * Wird zum Gebrauch abgeleitet.
+ *
+ * Beispiel einer Testklasse.
+ * Wird von TestCase abgeleitet
+ * \code
+ * class TestCase : public Test
+ * {
+ * ...
+ * \endcode
+ * Weitere Schritte: Testfunktionen schreiben und
+ * beispielsweise im Konstruktur hinzufügen.
+ * @see Dokumentation TestCase::TestCase()
+ * @author Prof. Ralf Mayer
+ * @version 28.05.2005
+ */
+class TestCase : public Test
+{
+public:
+ /**
+ * Konstruktor.
+ * Anleitung zum Gebrauch: Klasse ableiten, dann Konstruktor
+ * geeignet überschreiben:
+ * \code
+ * MyTestCase( char* name = 0 ) : TestCase( name )
+ * {
+ * addTest( (TESTFUNC) &MyTestCase::test1 );
+ * addTest( (TESTFUNC) &MyTestCase::test2 );
+ * // alle weiteren Tests hinzufügen
+ * // ...
+ * } // Ende Konstruktor
+ * \endcode
+ * @param name [optional] char* Name der Testklasse
+ */
+ TestCase( char* name = 0);
+
+ //! Destruktor
+ virtual ~TestCase() {}
+
+ /**
+ * Ausführen aller Tests in der Testklasse.
+ * Sobald ein Fehler auftritt, wird dieser ausgegeben und
+ * der Einzeltest, also die einzelne Testfunktion beendet.
+ */
+ virtual void run();
+
+ /**
+ * Setup Methode.
+ * Sollte immer von abgeleiter Testklasse überschreiben werden.
+ * Wird zu Beginn jedes Tests aufgerufen, also zu Begin von run()
+ */
+ virtual void setUp() {}
+
+ /**
+ * Teardown Methode zum Aufräumen nach jedem Test.
+ * Sollte immer von abgeleiter Testklasse überschreiben werden.
+ * Wird am Ende jedes Tests aufgerufen, also zu Begin von run()
+ */
+ virtual void tearDown() {}
+
+ /**
+ * Hinzufügen von Testfunktionen in der Testklasse.
+ * Bester Ort für diese Aufrufe ist der Konstruktor
+ * der abgeleiteten Klasse, d.h. der Testklasse
+ *
+ * Bei Zeigern auf Elementfunktionen in C++ sind Besonderheiten
+ * zu beachen. Rufen Sie diese Funktion stets in der folgenden
+ * Form auf, wenn z.B. die Funktion test1 heisst,
+ * und ihre Klasse MyTestCase:
+ * \code
+ * addTest( (TESTFUNC) &MyTestCase::test1 );
+ * \endcode
+ * Eine Testfunktion sollte immer wie folgt aufgebaut werden:
+ * \code
+ * void meinTest3()
+ * {
+ * tN = "meinTest3"; // Hier Name der Testfunktion
+ *
+ * // Hier wird der Test vorbereitet, z.B
+ * float istWert = -2.5; // z.B. Ergebnis einer Berechnung
+ * float erwartet = 2.5; // Bekanntes, d.h. erwartetes Ergebnis
+ *
+ * // Hier wird Ergebnis und Erwartungswert verglichen.
+ * // Compiler schreibt in tL die aktuelle Zeilennummer (__LINE__)
+ * tL= __LINE__; assertEquals( istWert, erwartet );
+ * // sind beide Werte gleich, dann ist's o.k.
+ * // wenn nicht wird Fehler mit Zeilennummer,
+ * // Namen der Testklasse und dem Funktionsnamen
+ * // angezeigt und dokumentiert.
+ * }
+ *
+ * \endcode
+ * Die Signatur einer Testfunktion darf nicht verändert werden
+ * \code void meineTestfunktion() \endcode
+ * @param f TESTFUNC
+ * @todo Dokumentation hinzufügen
+ */
+ void addTest( TESTFUNC f );
+
+ // all assertions
+ /**
+ * Vergleichsfunktion. Falls a != b wird Ausnahme
+ * geworfen und als Fehler dokumentiert.
+ * @exception string. Enthält Fehler sowie Soll- und Ist-Wert
+ * @param a int Soll(erwarteter) Wert
+ * @param b int Ist, d.h Ergebniswert des Tests
+ * @return void
+ */
+ void assertEquals( int a, int b);
+
+ /**
+ * Vergleichsfunktion. Falls a != b wird Ausnahme
+ * geworfen und als Fehler dokumentiert.
+ * @exception string. Enthält Fehler sowie Soll- und Ist-Wert
+ * @param a long Soll(erwarteter) Wert
+ * @param b long Ist, d.h Ergebniswert des Tests
+ * @return void
+ */
+ void assertEquals( long a, long b);
+
+ /**
+ * Vergleichsfunktion. Falls a != b wird Ausnahme
+ * geworfen und als Fehler dokumentiert.
+ * @exception string. Enthält Fehler sowie Soll- und Ist-Wert
+ * @param a float Soll(erwarteter) Wert
+ * @param b float Ist, d.h Ergebniswert des Tests
+ * @return void
+ */
+ void assertEquals( float a, float b );
+
+ /**
+ * Vergleichsfunktion. Falls a != b wird Ausnahme
+ * geworfen und als Fehler dokumentiert.
+ * @exception string. Enthält Fehler sowie Soll- und Ist-Wert
+ * @param a double Soll(erwarteter) Wert
+ * @param b double Ist, d.h Ergebniswert des Tests
+ * @return void
+ */
+ void assertEquals( double a, double b );
+
+ /**
+ * Vergleichsfunktion. Falls a und b nicht innerhalb der
+ * vorgegebenen Genauigkeitsgrenze übereinstimmen, wird Ausnahme
+ * geworfen und als Fehler dokumentiert.
+ * Beachten sie auch mögliche Rundungsfehler bei der Berechnung.
+ * @exception string. Enthält Fehler sowie Soll- und Ist-Wert und Grenze
+ * @param a double Soll(erwarteter) Wert
+ * @param b double Ist, d.h Ergebniswert des Tests
+ * @param e double >= 0 vorgegebene Genauigkeitsgrenze
+ * @return void
+ */
+ void assertEquals( double a, double b, double e );
+
+ /**
+ * Vergleichsfunktion. Falls a != b wird Ausnahme
+ * geworfen und als Fehler dokumentiert.
+ * @exception string. Enthält Fehler sowie Soll- und Ist-Wert
+ * @param a bool Soll(erwarteter) Wert
+ * @param b bool Ist, d.h Ergebniswert des Tests
+ * @return void
+ */
+ void assertEquals( bool a, bool b);
+
+ /**
+ * Vergleichsfunktion für Zeiger!! Falls a != b wird Ausnahme
+ * geworfen und als Fehler dokumentiert.
+ * @exception string. Enthält Fehler sowie Soll- und Ist-Wert
+ * in hexadezimaler Darstellung
+ * @param a void* Soll(erwarteter) Wert als Zeiger
+ * @param b void* Istwert als Zeiger
+ * @return void
+ */
+ void assertEquals( void* a, void* b );
+
+ /**
+ * Vergleichsfunktion nur für C-Strings! Falls a != b wird Ausnahme
+ * geworfen und als Fehler dokumentiert.
+ * @exception string. Enthält Fehler sowie Soll- und Ist-Wert,
+ * jeweils auf 48 Zeichen begrenzt.
+ * @param a char* Soll(erwarteter) Wert
+ * @param b char* Ist, d.h Ergebniswert des Tests
+ * @return void
+ */
+ void assertEquals( char* a, char* b );
+
+ /**
+ * Vergleichsfunktion. Falls a != true (wahr) wird Ausnahme
+ * geworfen und als Fehler dokumentiert.
+ * Hier kann z.B. eine logische Abfrage übergeben werden.
+ * @exception string. Enthält Fehler sowie den übergebenen Wert
+ * @param a bool Soll(erwarteter) Wert
+ * @return void
+ */
+ void assertTrue( bool a );
+
+ /**
+ * Vergleichsfunktion. Falls a != false (falsch) wird Ausnahme
+ * geworfen und als Fehler dokumentiert.
+ * Hier kann z.B. eine logische Abfrage übergeben werden.
+ * @exception string. Enthält Fehler sowie den übergebenen Wert
+ * @param a bool Soll(erwarteter) Wert
+ * @return void
+ */
+ void assertFalse( bool a );
+
+ /**
+ * Wirft Meldung als Ausnahme.
+ * Kann besipielsweise benutzt werden um das Auslösen einer
+ * Exception zu überprüfen.
+ * @exception string. Enthält Meldung
+ * @param msg char* Meldung
+ * @return void
+ */
+ void assertMessage( char* msg );
+
+protected:
+ int testsRun;
+ int testsFailed;
+ int testsOK;
+ int tL; //!< Zeilen Nummer
+ char* tN; //!< Test Name
+ char tcName[32]; //!< Name des Test Case
+
+ //! Container für Funktionszeiger
+ vector<TESTFUNC> vecFkt;
+};
+
+// No Code behind this line!
+#endif
\ No newline at end of file diff --git a/Bachelor/Softwaretechnik2/code/TestSuite.cpp b/Bachelor/Softwaretechnik2/code/TestSuite.cpp new file mode 100644 index 0000000..87149a9 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/TestSuite.cpp @@ -0,0 +1,44 @@ +#include <iostream>
+using namespace std;
+
+#include "TestSuite.h"
+
+// Konstruktor
+TestSuite::TestSuite( char* name )
+{
+ if (name != 0)
+ strncpy( tsName, name, sizeof(tsName)-1 );
+ else
+ tsName[0] = 0; // leerer String
+}
+//! Destruktor
+TestSuite::~TestSuite()
+{
+ // entfernen angelegter Objekte
+ for (int i = 0; i < vecTst.size() ; i++ )
+ {
+ if ( vecTst[i] != 0 )
+ delete vecTst[i];
+ vecTst[i] = 0;
+ } // end for
+
+}
+
+
+
+// Hinzufügen von Testfunktionen
+void TestSuite::addTest( Test* pT )
+{
+ vecTst.push_back( pT );
+}
+
+// Test-Run für Test Case
+void TestSuite::run()
+{
+ cout << "-> Running TestSuite " << tsName << endl;
+
+ for (int i = 0; i < vecTst.size() ; i++ )
+ {
+ vecTst[i]->run();
+ } // end for
+}
\ No newline at end of file diff --git a/Bachelor/Softwaretechnik2/code/TestSuite.h b/Bachelor/Softwaretechnik2/code/TestSuite.h new file mode 100644 index 0000000..1c69c01 --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/TestSuite.h @@ -0,0 +1,41 @@ +#ifndef _TESTSUITE__H
+#define _TESTSUITE__H
+
+// #include "TestResult.h"
+#include "Test.h"
+#include <vector>
+
+class TestSuite : public Test
+{
+public:
+ /**
+ * Konstruktor.
+ * Klasse muss nicht abgeleitet, kann direkt verwendet werden
+ * @param name [optional] char* Name der Testklasse
+ */
+ TestSuite( char* name = 0);
+
+ //! Destruktor
+ virtual ~TestSuite();
+
+ /**
+ * Ausführen aller Tests in der Testklasse
+ */
+ virtual void run();
+
+ /**
+ * Hinzufügen von TestCase's in die TestSuite.
+ * @param pTest Test* Zeiger auf Testklasse abgeleitet von TestCase
+ * oder Zeiger auf eine weitere TestSuite
+ * @todo Dokumentation hinzufügen
+ */
+ void addTest(Test* pTest);
+
+protected:
+ vector<Test*> vecTst; //!< Vector für TestCase oder Suite
+ char tsName[32]; //!< Name of the Test Case
+};
+
+
+// No Code behind this line!
+#endif
\ No newline at end of file diff --git a/Bachelor/Softwaretechnik2/code/main.cpp b/Bachelor/Softwaretechnik2/code/main.cpp new file mode 100644 index 0000000..41e664a --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/main.cpp @@ -0,0 +1,52 @@ +//#include "CRezept.hpp"
+//#include "CDisplay.hpp"
+#include "CGeraet.hpp"
+#include "CObserver.hpp"
+#include "CRezeptProcessor.hpp"
+#include "CRezeptSchritt.hpp"
+#include "CRezept.hpp"
+#include "CSubjekt.hpp"
+#include "CWaage.hpp"
+#include "TestSuite.h"
+#include "TestCWaage.h"
+#include "TestCDosierer.h"
+//#include "CDosierer.hpp"
+
+#include <iostream>
+using std::cout;
+using std::cin;
+using std::endl;
+
+// hier ist der Schalter für Testen !
+const bool TEST = true;
+
+int main(){
+
+ cout << "\"Entwicklung Cocktailmischer\" version "
+ << __DATE__ << " " << __TIME__
+ << endl << endl;
+
+ if (TEST) // Test ausführen
+ {
+ // Test Suite erzeugen
+ TestSuite testSammlung("Alle_Tests");
+
+ // Neuen Test erzeugen und hinzufügen
+ testSammlung.addTest( new TestCDosierer );
+ testSammlung.addTest( new TestCWaage);
+
+
+ // Alle(!) Tests starten
+ testSammlung.run();
+
+ return 0; // Programm beenden
+
+ } // Ende aller Tests
+ else
+
+ CRezeptProzessor *crp = new CRezeptProzessor;
+
+
+return 0;
+}
+
diff --git a/Bachelor/Softwaretechnik2/code/makefile b/Bachelor/Softwaretechnik2/code/makefile new file mode 100644 index 0000000..c3ee00f --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/makefile @@ -0,0 +1,17 @@ +all:
+ g++ -O3 -c -o CDisplay.o CDisplay.cpp
+ g++ -O3 -c -o CRezept.o CRezept.cpp
+ g++ -O3 -c -o CRezeptProcessor.o CRezeptProcessor.cpp
+ g++ -O3 -c -o CRezeptSchritt.o CRezeptSchritt.cpp
+ g++ -O3 -c -o CDosierer.o CDosierer.cpp
+ g++ -O3 -c -o CGeraet.o CGeraet.cpp
+ g++ -O3 -c -o CVentilGeraet.o CVentilGeraet.cpp
+ g++ -O3 -c -o CSubjekt.o CSubjekt.cpp
+ g++ -O3 -c -o CObserver.o CObserver.cpp
+ g++ -O3 -c -o CWaage.o CWaage.cpp
+ g++ -O3 -c -o CMischer.o CMischer.cpp
+ g++ -O3 -c -o CStampfer.o CStampfer.cpp
+ g++ -O3 -c -o CEntleerer.o CEntleerer.cpp
+ g++ -O3 -c -o main.o main.cpp
+
+ g++ -O3 -o mixer *.o
diff --git a/Bachelor/Softwaretechnik2/code/mixer b/Bachelor/Softwaretechnik2/code/mixer Binary files differnew file mode 100644 index 0000000..130ff7c --- /dev/null +++ b/Bachelor/Softwaretechnik2/code/mixer |
