summaryrefslogtreecommitdiff
path: root/src/core/model/Domain.cpp
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-18 14:49:50 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-18 14:49:50 +0100
commit94a60d364203f633370e1b0a77ec5b89428032e3 (patch)
treee9ef9970ec8dd93b5d302a6d52b6d90ae238eadb /src/core/model/Domain.cpp
parent93c065174e1aa306ee724dd523ef6b2254c1d388 (diff)
Hopefully implemented a working version of the Domain resolve mechanism.
Diffstat (limited to 'src/core/model/Domain.cpp')
-rw-r--r--src/core/model/Domain.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/core/model/Domain.cpp b/src/core/model/Domain.cpp
index bafd205..8eee86a 100644
--- a/src/core/model/Domain.cpp
+++ b/src/core/model/Domain.cpp
@@ -21,6 +21,60 @@
namespace ousia {
namespace model {
+void FieldDescriptor::doResolve(std::vector<Rooted<Managed>> &res,
+ const std::vector<std::string> &path,
+ Filter filter, void *filterData, unsigned idx,
+ VisitorSet &visited)
+{
+ // We call resolve for the children, but give them the field name as
+ // alias.
+ for (auto &c : children) {
+ c->resolve(res, path, filter, filterData, idx, visited, &getNameRef());
+ }
+}
+
+// TODO: better alias?
+static std::string DESCRIPTOR_ATTRIBUTES_ALIAS {"attributes"};
+
+void Descriptor::doResolve(std::vector<Rooted<Managed>> &res,
+ const std::vector<std::string> &path, Filter filter,
+ void *filterData, unsigned idx, VisitorSet &visited)
+{
+ // TODO: This could be a problem, because the name of the field might be
+ // needed in the path.
+ for (auto &fd : fieldDescriptors) {
+ fd->resolve(res, path, filter, filterData, idx, visited, nullptr);
+ }
+ // TODO: This throws a SEGFAULT for some reason.
+// attributesDescriptor->resolve(res, path, filter, filterData, idx, visited,
+// &DESCRIPTOR_ATTRIBUTES_ALIAS);
+}
+
+void StructuredClass::doResolve(std::vector<Rooted<Managed>> &res,
+ const std::vector<std::string> &path,
+ Filter filter, void *filterData, unsigned idx,
+ VisitorSet &visited)
+{
+ Descriptor::doResolve(res, path, filter, filterData, idx, visited);
+ if(!isa.isNull()){
+ isa->doResolve(res, path, filter, filterData, idx, visited);
+ }
+}
+
+void Domain::doResolve(std::vector<Rooted<Managed>> &res,
+ const std::vector<std::string> &path, Filter filter,
+ void *filterData, unsigned idx, VisitorSet &visited)
+{
+ for (auto &s : rootStructures) {
+ s->resolve(res, path, filter, filterData, idx, visited, nullptr);
+ }
+ for (auto &a : annotationClasses) {
+ a->resolve(res, path, filter, filterData, idx, visited, nullptr);
+ }
+ for (auto &t : typesystems) {
+ t->resolve(res, path, filter, filterData, idx, visited, nullptr);
+ }
+}
}
}