summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-18 21:09:11 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-18 21:09:11 +0100
commit0c06b2798b50ce3f54795d80aa6032175382af54 (patch)
tree68a5eaad3eaf2fca51ae074428ba6a212a37d0d5 /src
parentc7cd098d4b79b9a11a6e9a0cdd05d0371ff5e032 (diff)
Made constructors of Typesystem, Document and Domain more consistent
Diffstat (limited to 'src')
-rw-r--r--src/core/model/Document.hpp1
-rw-r--r--src/core/model/Domain.hpp26
-rw-r--r--src/core/model/Typesystem.hpp14
3 files changed, 34 insertions, 7 deletions
diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp
index 7c5ee3c..62109fc 100644
--- a/src/core/model/Document.hpp
+++ b/src/core/model/Document.hpp
@@ -567,7 +567,6 @@ protected:
public:
Document(Manager &mgr, std::string name)
- // TODO: Can a document have a parent?
: Node(mgr, std::move(name), nullptr),
annotations(this)
{
diff --git a/src/core/model/Domain.hpp b/src/core/model/Domain.hpp
index 579a65c..dad726a 100644
--- a/src/core/model/Domain.hpp
+++ b/src/core/model/Domain.hpp
@@ -703,22 +703,36 @@ protected:
void addAnnotationClass(Handle<AnnotationClass> a);
public:
+
/**
* The constructor for a new domain. Note that this is an empty Domain and
* still has to be filled with StructuredClasses and AnnotationClasses.
*
* @param mgr is the Manager instance.
- * @param sys is the SystemTypesystem instance.
* @param name is a name for this domain which will be used for later
* references to this Domain.
*/
- Domain(Manager &mgr, Handle<SystemTypesystem> sys, std::string name)
- // TODO: Can a domain have a parent?
+ Domain(Manager &mgr, std::string name)
: Node(mgr, std::move(name), nullptr),
structuredClasses(this),
annotationClasses(this),
- typesystems(this, std::vector<Handle<Typesystem>>{sys})
+ typesystems(this)
+ {
+ }
+
+ /**
+ * The constructor for a new domain. Note that this is an empty Domain and
+ * still has to be filled with StructuredClasses and AnnotationClasses.
+ *
+ * @param mgr is the Manager instance.
+ * @param sys is the SystemTypesystem instance.
+ * @param name is a name for this domain which will be used for later
+ * references to this Domain.
+ */
+ Domain(Manager &mgr, Handle<SystemTypesystem> sys, std::string name)
+ : Domain(mgr, std::move(name))
{
+ includeTypesystem(sys);
}
/**
@@ -757,12 +771,12 @@ public:
/**
* Adds a Typesystem reference to this Domain.
*/
- void addTypesystem(Handle<Typesystem> t) { typesystems.push_back(t); }
+ void includeTypesystem(Handle<Typesystem> t) { typesystems.push_back(t); }
/**
* Adds multiple Typesystem references to this Domain.
*/
- void addTypesystems(const std::vector<Handle<Typesystem>> &ts)
+ void includeTypesystems(const std::vector<Handle<Typesystem>> &ts)
{
typesystems.insert(typesystems.end(), ts.begin(), ts.end());
}
diff --git a/src/core/model/Typesystem.hpp b/src/core/model/Typesystem.hpp
index dce8abc..44cf126 100644
--- a/src/core/model/Typesystem.hpp
+++ b/src/core/model/Typesystem.hpp
@@ -47,6 +47,7 @@ namespace model {
// Forward declarations
class Typesystem;
+class SystemTypesystem;
/**
* The abstract Type class represents a type descriptor. Each Type node is part
@@ -969,6 +970,19 @@ public:
}
/**
+ * Constructor of the Typesystem class.
+ *
+ * @param mgr is the Manager instance to be used for the Node.
+ * @param sys is a reference at the system typesystem.
+ * @param name is the name of the typesystem.
+ */
+ Typesystem(Manager &mgr, Handle<SystemTypesystem> sys, std::string name)
+ : Typesystem(mgr, std::move(name))
+ {
+ includeTypesystem(sys);
+ }
+
+ /**
* Creates a new StructType instance with the given name. Adds the new
* StructType as member to the typesystem.
*