From 280f886a42d74c6dcf81efbd1604ad972e8bae3a Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Mon, 15 Dec 2014 12:59:11 +0100 Subject: first draft of Descriptor. --- src/core/model/Domain.hpp | 52 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 11 deletions(-) (limited to 'src/core/model/Domain.hpp') diff --git a/src/core/model/Domain.hpp b/src/core/model/Domain.hpp index 004ef3c..13c65e5 100644 --- a/src/core/model/Domain.hpp +++ b/src/core/model/Domain.hpp @@ -188,6 +188,7 @@ public: { } + // TODO: Is returning a ManagedVector alright? ManagedVector &getChildren() { return children; } FieldType getFieldType() { return type; } @@ -198,28 +199,57 @@ public: }; /** + * This is a super class for StructuredClasses and AnnotationClasses and is, + * in itself, not supposed to be instantiated. It defines that both, Annotations + * and StructuredEntities, may have attributes and fields. For more information + * on fields please have a look at the header documentation as well as the + * documentation of the FieldDescriptor class. * + * Attributes are primitive content stored in a key-value fashion. Therefore + * the attribute specification of a descriptor is done by referencing an + * appropriate StructType that contains all permitted keys and value types. + * + * TODO: What aout optional attributes? + * + * In XML terms the difference between primitive fields and attributes can be + * explained as the difference between node attributes and node children. + * Consider the XML + * + * + * value + * + * + * key="value" inside the A-node would be an attribute, while value + * would be a primitive field. While equivalent in XML the semantics are + * different: An attribute describes indeed attributes, features of one single + * node whereas a primitive field describes the _content_ of a node. * - * Furthermore StructuredClasses may specify a StructType of a type system, - * which in turn specifies which key-value pairs may be added as attributes - * to an instance of this StructuredClass. */ - class Descriptor : public Node { private: - Owned attributes; - ManagedVector fields; + Owned attributesDescriptor; + ManagedVector fieldDescriptors; public: Descriptor(Manager &mgr, std::string name, Handle parent, // TODO: What would be a wise default value for attributes? - Handle attributes, - ManagedVector fields) + Handle attributesDescriptor, + ManagedVector fieldDescriptors) : Node(mgr, std::move(name), parent), - attributes(attributes), - fields(fields) - // TODO: What would be a wise initialization of the primitiveType? + attributesDescriptor(attributesDescriptor), + fieldDescriptors(fieldDescriptors) + { + } + + Rooted getAttributesDescriptor() + { + return attributesDescriptor; + } + + // TODO: Is returning a ManagedVector alright? + ManagedVector getFieldDescriptors() { + return fieldDescriptors; } }; } -- cgit v1.2.3