diff options
| -rw-r--r-- | CMakeLists.txt | 9 | ||||
| -rw-r--r-- | src/model/domain/Anchor.cpp | 28 | ||||
| -rw-r--r-- | src/model/domain/Anchor.hpp | 36 | ||||
| -rw-r--r-- | src/model/domain/Annotation.cpp | 28 | ||||
| -rw-r--r-- | src/model/domain/Annotation.hpp | 81 | ||||
| -rw-r--r-- | src/model/domain/Field.cpp | 27 | ||||
| -rw-r--r-- | src/model/domain/Field.hpp | 80 | ||||
| -rw-r--r-- | src/model/domain/Layer.cpp | 27 | ||||
| -rw-r--r-- | src/model/domain/Layer.hpp | 47 | ||||
| -rw-r--r-- | src/model/domain/Structure.cpp | 29 | ||||
| -rw-r--r-- | src/model/domain/Structure.hpp | 33 | ||||
| -rw-r--r-- | src/model/types/Type.cpp | 29 | ||||
| -rw-r--r-- | src/model/types/Type.hpp | 33 | ||||
| -rw-r--r-- | src/model/types/Value.cpp | 29 | ||||
| -rw-r--r-- | src/model/types/Value.hpp | 31 | ||||
| -rw-r--r-- | test/model/domain/Layer.cpp | 48 | 
16 files changed, 594 insertions, 1 deletions
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 <http://www.gnu.org/licenses/>. +*/ + +#include <model/domain/Anchor.hpp> + +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 <http://www.gnu.org/licenses/>. +*/ + +#ifndef _ANCHOR_HPP_ +#define _ANCHOR_HPP_ + +#include <model/GraphNode.hpp> + +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 <http://www.gnu.org/licenses/>. +*/ + +#include <model/domain/Annotation.hpp> + +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 <http://www.gnu.org/licenses/>. +*/ + +#ifndef _ANNOTATION_HPP_ +#define _ANNOTATION_HPP_ + +#include <memory> +#include <vector> + +#include <model/GraphNode.hpp> +#include <model/domain/Anchor.hpp> +#include <model/domain/Structure.hpp> +#include <model/domain/Field.hpp> + +namespace ousia { +namespace domain { + +//class Structure; +//class Anchor; +//class Field; + +class Annotation : public GraphNode { + +private: +	std::vector<std::shared_ptr<Structure>> structures; +	std::vector<std::shared_ptr<Field>> fields; +	std::shared_ptr<Anchor> start; +	std::shared_ptr<Anchor> end; + +public: +	using GraphNode::GraphNode; + +	std::vector<std::shared_ptr<Structure>>& getStructures() +	{ +		return structures; +	} + +	std::vector<std::shared_ptr<Field>>& getFields() +	{ +		return fields; +	} + +	std::shared_ptr<Anchor> getStart() +	{ +		return start; +	} + +	void setStart(std::shared_ptr<Anchor> start) +	{ +		this->start = start; +	} + +	std::shared_ptr<Anchor> getEnd() +	{ +		return end; +	} + +	void setEnd(std::shared_ptr<Anchor> 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 <http://www.gnu.org/licenses/>. +*/ + +#include <model/domain/Field.hpp> + +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 <http://www.gnu.org/licenses/>. +*/ + +#ifndef _FIELD_HPP_ +#define _FIELD_HPP_ + +#include <memory> + +#include <model/GraphNode.hpp> +#include <model/types/Type.hpp> +#include <model/types/Value.hpp> + +namespace ousia { + +//namespace types { +//	class Type; +//	class Value; +//} + +namespace domain { + +class Field : public GraphNode { + +private: +	std::shared_ptr<types::Type> type; +	std::shared_ptr<types::Value> value; +	bool optional; + +public: +	using GraphNode::GraphNode; + +	std::shared_ptr<types::Type> getType() +	{ +		return type; +	} + +	void setType(std::shared_ptr<types::Type> type) +	{ +		this->type = type; +	} + +	std::shared_ptr<types::Value> getValue() +	{ +		return value; +	} + +	void setValue(std::shared_ptr<types::Value> 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 <http://www.gnu.org/licenses/>. +*/ + +#include <model/domain/Layer.hpp> + +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 <http://www.gnu.org/licenses/>. +*/ + +#ifndef _LAYER_HPP_ +#define _LAYER_HPP_ + +#include <memory> +#include <vector> + +#include <model/GraphNode.hpp> +#include <model/domain/Annotation.hpp> + +namespace ousia { +namespace domain { + +class Layer : public GraphNode { + +private: +	std::vector<std::shared_ptr<Annotation>> annotations; + +public: +	using GraphNode::GraphNode; + +	std::vector<std::shared_ptr<Annotation>>& 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 <http://www.gnu.org/licenses/>. +*/ + + +#include <model/domain/Structure.hpp> + +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 <http://www.gnu.org/licenses/>. +*/ + +#ifndef _STRUCTURE_HPP_ +#define _STRUCTURE_HPP_ + +#include <model/GraphNode.hpp> + +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 <http://www.gnu.org/licenses/>. +*/ + +#include <model/GraphNode.hpp> +#include <model/types/Type.hpp> + +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 <http://www.gnu.org/licenses/>. +*/ + +#ifndef _TYPE_HPP_ +#define _TYPE_HPP_ + +#include <model/GraphNode.hpp> + +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 <http://www.gnu.org/licenses/>. +*/ + +#include <model/GraphNode.hpp> +#include <model/types/Value.hpp> + +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 <http://www.gnu.org/licenses/>. +*/ + +#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 <http://www.gnu.org/licenses/>. +*/ + +#include <gtest/gtest.h> +#include <iostream> + +#include <model/domain/Layer.hpp> +#include <model/domain/Annotation.hpp> + +namespace ousia { +namespace domain{ + +TEST(LayerTest, AnnotationManagementTest) +{ +	std::shared_ptr<Annotation> anno1{new Annotation("em1")}; +	std::shared_ptr<Annotation> anno2{new Annotation("em2", anno1)}; + +	Layer layer {"layer"}; + +	std::vector<std::shared_ptr<Annotation>>& annos = layer.getAnnotations(); + +	annos.push_back(anno1); +	annos.push_back(anno2); + +	std::vector<std::shared_ptr<Annotation>>& test_annos = layer.getAnnotations(); + +	ASSERT_EQ(2, test_annos.size()); +	ASSERT_EQ(anno1, test_annos[0]); +	ASSERT_EQ(anno2, test_annos[1]); +} + +} +}  | 
