From 12e86e71ca36a58d7e2ed64f0454b65ed6f7eb56 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Tue, 28 Nov 2017 15:05:02 +0100 Subject: New data structure for Structogram and Statements --- src/diagram/Structogram.hpp | 70 ++++++--------------------------------------- 1 file changed, 8 insertions(+), 62 deletions(-) (limited to 'src/diagram/Structogram.hpp') diff --git a/src/diagram/Structogram.hpp b/src/diagram/Structogram.hpp index 7b036f0..05c2d4d 100644 --- a/src/diagram/Structogram.hpp +++ b/src/diagram/Structogram.hpp @@ -1,71 +1,17 @@ /* - * Structogram.h + * Structogram.hpp * - * Created on: Nov 14, 2017 + * Created on: Nov 28, 2017 * Author: naopross */ -#ifndef SRC_DIAGRAM_STRUCTOGRAM_H_ -#define SRC_DIAGRAM_STRUCTOGRAM_H_ +#ifndef SRC_DIAGRAM_STRUCTOGRAM_HPP_ +#define SRC_DIAGRAM_STRUCTOGRAM_HPP_ -#include -#include - -#include "Statement.hpp" +#include "Scope.hpp" namespace samb { + typedef Scope Structogram; +} -/* A Structogram is a Nassi-Schneiderman diagram, in this implementation it is - * simply and iterable object that holds statements. - * - * The first statement inside a structogram (m_head) is a SCOPE - * statement that holds the entire program inside it. - */ -class Structogram { -public: - /* forward only iterator */ - class iterator { - public: - iterator(Statement::pointer first); - ~iterator(); - - iterator& operator++(); - iterator& operator++(int); - - bool operator==(const iterator& other) const; - bool operator!=(const iterator& other) const; - Statement& operator*() const; - Statement::pointer operator->() const; - - private: - Statement::pointer m_current; - }; - - Structogram(std::string title); - virtual ~Structogram(); - - std::size_t size() const; - - // cannot be implemented because iter is forward only -// iterator insert(iterator it, Statement::pointer statement); -// iterator erase(iterator it); - - iterator insert_after(iterator it, Statement::pointer statement); - iterator erase_after(iterator it); - - /* iterator */ - iterator begin() const; - const iterator end() const; - const Statement& operator[](const Statement& it) = delete; - -private: - std::size_t m_size; - std::string m_title; - - Statement::pointer m_head; - Statement::pointer m_tail; -}; - -} /* namespace structograms */ - -#endif /* SRC_DIAGRAM_STRUCTOGRAM_H_ */ +#endif /* SRC_DIAGRAM_STRUCTOGRAM_HPP_ */ -- cgit v1.2.1