From 93c065174e1aa306ee724dd523ef6b2254c1d388 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Wed, 17 Dec 2014 17:11:51 +0100 Subject: Some (slight) changes to existing structures and first attempts on a test to construct a test comain and a test document out of thin air. I am, indeed, an alchemist. --- src/core/model/Domain.hpp | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'src/core/model/Domain.hpp') diff --git a/src/core/model/Domain.hpp b/src/core/model/Domain.hpp index 9ae8871..e348136 100644 --- a/src/core/model/Domain.hpp +++ b/src/core/model/Domain.hpp @@ -91,8 +91,9 @@ namespace ousia { namespace model { -class StructuredClass; class Descriptor; +class StructuredClass; +class Domain; /** * As mentioned in the description above a FieldDescriptor specifies the @@ -147,17 +148,18 @@ public: * set to "PRIMITIVE". * * @param mgr is the global Manager instance. - * @param name is the name of this field. * @param parent is a handle of the Descriptor node that has this * FieldDescriptor. * @param primitiveType is a handle to some Type in some Typesystem of which * one instance is allowed to fill this field. + * @param name is the name of this field. * @param optional should be set to 'false' is this field needs to be * filled in order for an instance of the parent * Descriptor to be valid. */ - FieldDescriptor(Manager &mgr, std::string name, Handle parent, - Handle primitiveType, bool optional) + FieldDescriptor(Manager &mgr, Handle parent, + Handle primitiveType, std::string name = "", + bool optional = false) : Node(mgr, std::move(name), parent), children(this), fieldType(FieldType::PRIMITIVE), @@ -171,18 +173,19 @@ public: * children here. * * @param mgr is the global Manager instance. - * @param name is the name of this field. * @param parent is a handle of the Descriptor node that has this * FieldDescriptor. * @param fieldType is the FieldType of this FieldDescriptor, either * TREE for the main or default structure or SUBTREE * for supporting structures. + * @param name is the name of this field. * @param optional should be set to 'false' is this field needs to be * filled in order for an instance of the parent * Descriptor to be valid. */ - FieldDescriptor(Manager &mgr, std::string name, Handle parent, - FieldType fieldType, bool optional) + FieldDescriptor(Manager &mgr, Handle parent, + FieldType fieldType = FieldType::TREE, + std::string name = "", bool optional = false) : Node(mgr, std::move(name), parent), children(this), fieldType(fieldType), @@ -239,10 +242,10 @@ private: ManagedVector fieldDescriptors; public: - Descriptor(Manager &mgr, std::string name, Handle parent, + Descriptor(Manager &mgr, std::string name, Handle domain, // TODO: What would be a wise default value for attributes? Handle attributesDescriptor) - : Node(mgr, std::move(name), parent), + : Node(mgr, std::move(name), domain), attributesDescriptor(acquire(attributesDescriptor)), fieldDescriptors(this) { @@ -351,12 +354,13 @@ private: public: const bool transparent; - StructuredClass(Manager &mgr, std::string name, Handle parent, - Handle attributesDescriptor, + StructuredClass(Manager &mgr, std::string name, Handle domain, const Cardinality &cardinality, + Handle attributesDescriptor = {nullptr}, // TODO: What would be a wise default value for isa? - Handle isa, bool transparent) - : Descriptor(mgr, std::move(name), parent, attributesDescriptor), + Handle isa = {nullptr}, + bool transparent = false) + : Descriptor(mgr, std::move(name), domain, attributesDescriptor), cardinality(cardinality), isa(acquire(isa)), parents(this), @@ -393,13 +397,15 @@ class Domain : public Node { private: ManagedVector rootStructures; ManagedVector annotationClasses; + ManagedVector typesystems; public: Domain(Manager &mgr, std::string name) // TODO: Can a domain have a parent? : Node(mgr, std::move(name), nullptr), rootStructures(this), - annotationClasses(this) + annotationClasses(this), + typesystems(this) { } @@ -423,6 +429,13 @@ public: { return annotationClasses; } + + ManagedVector &getTypesystems() { return typesystems; } + + const ManagedVector &getTypesystems() const + { + return typesystems; + } }; } } -- cgit v1.2.3