diff options
Diffstat (limited to '')
-rw-r--r-- | src/diagram/Statement.cpp | 12 | ||||
-rw-r--r-- | src/diagram/Statement.hpp | 60 | ||||
-rw-r--r-- | src/diagram/Structogram.cpp | 27 | ||||
-rw-r--r-- | src/diagram/Structogram.hpp | 32 |
4 files changed, 131 insertions, 0 deletions
diff --git a/src/diagram/Statement.cpp b/src/diagram/Statement.cpp new file mode 100644 index 0000000..75770db --- /dev/null +++ b/src/diagram/Statement.cpp @@ -0,0 +1,12 @@ +/* + * Statement.cpp + * + * Created on: Nov 23, 2017 + * Author: naopross + */ + +#include "../diagram/Statement.h" + +namespace samb { + +} /* namespace samb */ diff --git a/src/diagram/Statement.hpp b/src/diagram/Statement.hpp new file mode 100644 index 0000000..a90e88d --- /dev/null +++ b/src/diagram/Statement.hpp @@ -0,0 +1,60 @@ +/* + * Statement.h + * + * Created on: Nov 23, 2017 + * Author: naopross + */ + +#ifndef SRC_STATEMENT_H_ +#define SRC_STATEMENT_H_ + +#include <string> + +namespace samb { + + +/* Possible types of statement, according to the NS diagram paper + * + * PROCESS, + * DECISION, + * SWITCH, + * WHILE, + * UNTIL, + * SCOPE, + * PARALLEL, + */ + +/* this class should behave like a std::list, or a std::map storing the data + * with a tree structure, BUT it is not a tree because allows 2 notes to point + * at a single node + * + * Normal Tree: Statements: + * A - B - C - D A - B - C - D - G + * \ \ / + * E - F E - F + * + * Because a statement contains branching elmeents. (if / switch) + */ +class Statement { +private: + Statement *next; + Statement *prev; + +public: + const enum Type { + PROCESS, + DECISION, + SWITCH, + WHILE, + UNTIL, + SCOPE, + PARALLEL, + } m_type; + + Statement(Type type, Statement *prev): m_type(type), m_prev(prev); + virtual ~Statement(); +}; + +} /* namespace samb */ + +#endif /* SRC_STATEMENT_H_ */ diff --git a/src/diagram/Structogram.cpp b/src/diagram/Structogram.cpp new file mode 100644 index 0000000..dae9028 --- /dev/null +++ b/src/diagram/Structogram.cpp @@ -0,0 +1,27 @@ +/* + * Structogram.cpp + * + * Created on: Nov 14, 2017 + * Author: naopross + */ + +#include "../diagram/Structogram.h" +#include <memory> + + +namespace samb { + +Structogram::Structogram(std::string title): m_title(title) { + +} + +Structogram::~Structogram() { + +} + +const std::list<Statement>& Structogram::getStatements() const { + return m_statements; +} + + +} /* namespace structograms */ diff --git a/src/diagram/Structogram.hpp b/src/diagram/Structogram.hpp new file mode 100644 index 0000000..2234142 --- /dev/null +++ b/src/diagram/Structogram.hpp @@ -0,0 +1,32 @@ +/* + * Structogram.h + * + * Created on: Nov 14, 2017 + * Author: naopross + */ + +#ifndef STRUCTOGRAM_H_ +#define STRUCTOGRAM_H_ + +#include <iostream> +#include <list> +#include "../diagram/Statement.h" + +namespace samb { + +/* object that holds statements */ +class Structogram { +private: + std::list<Statement> m_statements; + std::string m_title; + +public: + Structogram(std::string title); + virtual ~Structogram(); + + const std::list<Statement>& getStatements() const; +}; + +} /* namespace structograms */ + +#endif /* STRUCTOGRAM_H_ */ |