diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2014-12-15 12:59:11 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2014-12-15 12:59:11 +0100 |
commit | 280f886a42d74c6dcf81efbd1604ad972e8bae3a (patch) | |
tree | d9e03365ea6074bc50af7b7a4e26840beab30bf8 /src/core/model | |
parent | 0194b141fe507fd557c584b759a593aea5103f04 (diff) |
first draft of Descriptor.
Diffstat (limited to 'src/core/model')
-rw-r--r-- | src/core/model/Domain.hpp | 52 |
1 files changed, 41 insertions, 11 deletions
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<StructuredClass> &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 + * + * <A key="value"> + * <key>value</key> + * </A> + * + * key="value" inside the A-node would be an attribute, while <key>value</key> + * 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<StructType> attributes; - ManagedVector<FieldDescriptor> fields; + Owned<StructType> attributesDescriptor; + ManagedVector<FieldDescriptor> fieldDescriptors; public: Descriptor(Manager &mgr, std::string name, Handle<Node> parent, // TODO: What would be a wise default value for attributes? - Handle<StructType> attributes, - ManagedVector<FieldDescriptor> fields) + Handle<StructType> attributesDescriptor, + ManagedVector<FieldDescriptor> 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<StructType> getAttributesDescriptor() + { + return attributesDescriptor; + } + + // TODO: Is returning a ManagedVector alright? + ManagedVector<FieldDescriptor> getFieldDescriptors() { + return fieldDescriptors; } }; } |