From 3ac3d683228cf0b0effe284bf07e18a9b07f92a2 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Tue, 4 Mar 2014 17:16:59 +0000 Subject: added anchor, annotation, field, layer and structure at least as raw concepts. Type and Value are dummy implementations. git-svn-id: file:///var/local/svn/basicwriter@18 daaaf23c-2e50-4459-9457-1e69db5a47bf --- CMakeLists.txt | 9 ++++- src/model/domain/Anchor.cpp | 28 ++++++++++++++ src/model/domain/Anchor.hpp | 36 ++++++++++++++++++ src/model/domain/Annotation.cpp | 28 ++++++++++++++ src/model/domain/Annotation.hpp | 81 +++++++++++++++++++++++++++++++++++++++++ src/model/domain/Field.cpp | 27 ++++++++++++++ src/model/domain/Field.hpp | 80 ++++++++++++++++++++++++++++++++++++++++ src/model/domain/Layer.cpp | 27 ++++++++++++++ src/model/domain/Layer.hpp | 47 ++++++++++++++++++++++++ src/model/domain/Structure.cpp | 29 +++++++++++++++ src/model/domain/Structure.hpp | 33 +++++++++++++++++ src/model/types/Type.cpp | 29 +++++++++++++++ src/model/types/Type.hpp | 33 +++++++++++++++++ src/model/types/Value.cpp | 29 +++++++++++++++ src/model/types/Value.hpp | 31 ++++++++++++++++ test/model/domain/Layer.cpp | 48 ++++++++++++++++++++++++ 16 files changed, 594 insertions(+), 1 deletion(-) create mode 100644 src/model/domain/Anchor.cpp create mode 100644 src/model/domain/Anchor.hpp create mode 100644 src/model/domain/Annotation.cpp create mode 100644 src/model/domain/Annotation.hpp create mode 100644 src/model/domain/Field.cpp create mode 100644 src/model/domain/Field.hpp create mode 100644 src/model/domain/Layer.cpp create mode 100644 src/model/domain/Layer.hpp create mode 100644 src/model/domain/Structure.cpp create mode 100644 src/model/domain/Structure.hpp create mode 100644 src/model/types/Type.cpp create mode 100644 src/model/types/Type.hpp create mode 100644 src/model/types/Value.cpp create mode 100644 src/model/types/Value.hpp create mode 100644 test/model/domain/Layer.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 329b17d..e6a6ae4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,13 @@ INCLUDE_DIRECTORIES(src/) ADD_LIBRARY(ousia_core src/model/GraphNode - src/model/domain/Domain + src/model/domain/Structure + src/model/domain/Layer + src/model/domain/Annotation + src/model/domain/Anchor + src/model/domain/Field + src/model/types/Type + src/model/types/Value ) ADD_EXECUTABLE(ousia @@ -48,6 +54,7 @@ if(test) # Add all unit test files ADD_EXECUTABLE(ousia_test test/model/GraphNode + test/model/domain/Layer ) TARGET_LINK_LIBRARIES(ousia_test diff --git a/src/model/domain/Anchor.cpp b/src/model/domain/Anchor.cpp new file mode 100644 index 0000000..e153161 --- /dev/null +++ b/src/model/domain/Anchor.cpp @@ -0,0 +1,28 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +namespace ousia { +namespace domain { + +//This class is fully specified by its header. + +} +} + diff --git a/src/model/domain/Anchor.hpp b/src/model/domain/Anchor.hpp new file mode 100644 index 0000000..66ff8eb --- /dev/null +++ b/src/model/domain/Anchor.hpp @@ -0,0 +1,36 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _ANCHOR_HPP_ +#define _ANCHOR_HPP_ + +#include + +namespace ousia { +namespace domain { + +class Anchor : public GraphNode { + +public: + using GraphNode::GraphNode; + +}; +} +} + +#endif /* _ANCHOR_HPP_ */ diff --git a/src/model/domain/Annotation.cpp b/src/model/domain/Annotation.cpp new file mode 100644 index 0000000..8dabf5e --- /dev/null +++ b/src/model/domain/Annotation.cpp @@ -0,0 +1,28 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +namespace ousia { +namespace domain { + +//This class is fully defined by its header. + +} +} + diff --git a/src/model/domain/Annotation.hpp b/src/model/domain/Annotation.hpp new file mode 100644 index 0000000..233b421 --- /dev/null +++ b/src/model/domain/Annotation.hpp @@ -0,0 +1,81 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _ANNOTATION_HPP_ +#define _ANNOTATION_HPP_ + +#include +#include + +#include +#include +#include +#include + +namespace ousia { +namespace domain { + +//class Structure; +//class Anchor; +//class Field; + +class Annotation : public GraphNode { + +private: + std::vector> structures; + std::vector> fields; + std::shared_ptr start; + std::shared_ptr end; + +public: + using GraphNode::GraphNode; + + std::vector>& getStructures() + { + return structures; + } + + std::vector>& getFields() + { + return fields; + } + + std::shared_ptr getStart() + { + return start; + } + + void setStart(std::shared_ptr start) + { + this->start = start; + } + + std::shared_ptr getEnd() + { + return end; + } + + void setEnd(std::shared_ptr end) + { + this->end = end; + } +}; +} +} + +#endif /* _ANNOTATION_HPP_ */ diff --git a/src/model/domain/Field.cpp b/src/model/domain/Field.cpp new file mode 100644 index 0000000..4fd06a3 --- /dev/null +++ b/src/model/domain/Field.cpp @@ -0,0 +1,27 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +namespace ousia { +namespace domain { + + //This class is fully specified by its header. + +} +} diff --git a/src/model/domain/Field.hpp b/src/model/domain/Field.hpp new file mode 100644 index 0000000..d1944ee --- /dev/null +++ b/src/model/domain/Field.hpp @@ -0,0 +1,80 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _FIELD_HPP_ +#define _FIELD_HPP_ + +#include + +#include +#include +#include + +namespace ousia { + +//namespace types { +// class Type; +// class Value; +//} + +namespace domain { + +class Field : public GraphNode { + +private: + std::shared_ptr type; + std::shared_ptr value; + bool optional; + +public: + using GraphNode::GraphNode; + + std::shared_ptr getType() + { + return type; + } + + void setType(std::shared_ptr type) + { + this->type = type; + } + + std::shared_ptr getValue() + { + return value; + } + + void setValue(std::shared_ptr value) + { + this->value = value; + } + + bool getOptional() + { + return optional; + } + + void setOptional(bool optional) + { + this->optional = optional; + } +}; +} +} + +#endif /* _FIELD_HPP_ */ diff --git a/src/model/domain/Layer.cpp b/src/model/domain/Layer.cpp new file mode 100644 index 0000000..fb22b4c --- /dev/null +++ b/src/model/domain/Layer.cpp @@ -0,0 +1,27 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +namespace ousia { +namespace domain { + + //This class is fully specified by its header. + +} +} diff --git a/src/model/domain/Layer.hpp b/src/model/domain/Layer.hpp new file mode 100644 index 0000000..5d609ca --- /dev/null +++ b/src/model/domain/Layer.hpp @@ -0,0 +1,47 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _LAYER_HPP_ +#define _LAYER_HPP_ + +#include +#include + +#include +#include + +namespace ousia { +namespace domain { + +class Layer : public GraphNode { + +private: + std::vector> annotations; + +public: + using GraphNode::GraphNode; + + std::vector>& getAnnotations() + { + return annotations; + } +}; +} +} + +#endif /* _LAYER_HPP_ */ diff --git a/src/model/domain/Structure.cpp b/src/model/domain/Structure.cpp new file mode 100644 index 0000000..fd9f3ce --- /dev/null +++ b/src/model/domain/Structure.cpp @@ -0,0 +1,29 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + + +#include + +namespace ousia { +namespace domain { + + //This class for now has no special features that would distinguish it + //from an abstract GraphNode. + +} +} diff --git a/src/model/domain/Structure.hpp b/src/model/domain/Structure.hpp new file mode 100644 index 0000000..897b265 --- /dev/null +++ b/src/model/domain/Structure.hpp @@ -0,0 +1,33 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _STRUCTURE_HPP_ +#define _STRUCTURE_HPP_ + +#include + +namespace ousia { +namespace domain { + +class Structure : public GraphNode { + using GraphNode::GraphNode; +}; +} +} + +#endif /* _STRUCTURE_HPP_ */ diff --git a/src/model/types/Type.cpp b/src/model/types/Type.cpp new file mode 100644 index 0000000..d219b61 --- /dev/null +++ b/src/model/types/Type.cpp @@ -0,0 +1,29 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#include + +namespace ousia { +namespace types { + + +//TODO: THIS IS A DUMMY CLASS DECLARATION + +} +} diff --git a/src/model/types/Type.hpp b/src/model/types/Type.hpp new file mode 100644 index 0000000..155f898 --- /dev/null +++ b/src/model/types/Type.hpp @@ -0,0 +1,33 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TYPE_HPP_ +#define _TYPE_HPP_ + +#include + +namespace ousia { +namespace types { + +class Type : public GraphNode { + +//TODO: THIS IS A DUMMY CLASS DECLARATION +}; +} +} +#endif /* _TYPE_HPP_ */ diff --git a/src/model/types/Value.cpp b/src/model/types/Value.cpp new file mode 100644 index 0000000..73d233a --- /dev/null +++ b/src/model/types/Value.cpp @@ -0,0 +1,29 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#include + +namespace ousia { +namespace types { + + +//TODO: THIS IS A DUMMY CLASS DECLARATION + +} +} diff --git a/src/model/types/Value.hpp b/src/model/types/Value.hpp new file mode 100644 index 0000000..3076dd2 --- /dev/null +++ b/src/model/types/Value.hpp @@ -0,0 +1,31 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _VALUE_HPP_ +#define _VALUE_HPP_ + +namespace ousia { +namespace types { + +class Value { + +//TODO: THIS IS A DUMMY CLASS DECLARATION +}; +} +} +#endif /* _VALUE_HPP_ */ diff --git a/test/model/domain/Layer.cpp b/test/model/domain/Layer.cpp new file mode 100644 index 0000000..89aeaa4 --- /dev/null +++ b/test/model/domain/Layer.cpp @@ -0,0 +1,48 @@ +/* + Ousía + Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#include + +#include +#include + +namespace ousia { +namespace domain{ + +TEST(LayerTest, AnnotationManagementTest) +{ + std::shared_ptr anno1{new Annotation("em1")}; + std::shared_ptr anno2{new Annotation("em2", anno1)}; + + Layer layer {"layer"}; + + std::vector>& annos = layer.getAnnotations(); + + annos.push_back(anno1); + annos.push_back(anno2); + + std::vector>& test_annos = layer.getAnnotations(); + + ASSERT_EQ(2, test_annos.size()); + ASSERT_EQ(anno1, test_annos[0]); + ASSERT_EQ(anno2, test_annos[1]); +} + +} +} -- cgit v1.2.3