From 9929838e62d9c17647d74be54af5853e8b613c4b Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 16 Jan 2015 15:20:49 +0100 Subject: validate function for Domain::Descriptor. --- src/core/model/Domain.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/core/model/Domain.cpp') diff --git a/src/core/model/Domain.cpp b/src/core/model/Domain.cpp index b4fea3c..2ac2d8d 100644 --- a/src/core/model/Domain.cpp +++ b/src/core/model/Domain.cpp @@ -36,6 +36,7 @@ static void checkUniqueName(Handle parent, NodeVector vec, childNames.insert(c->getName()); } if (childNames.find(child->getName()) != childNames.end()) { + //TODO: Do we really want to have an exception here? throw OusiaException(std::string("The ") + parentClassName + " " + parent->getName() + " already has a " + childClassName + " with name " + child->getName()); @@ -218,6 +219,16 @@ StructuredClass::StructuredClass(Manager &mgr, std::string name, } } +bool StructuredClass::isSubclassOf(Handle c) const{ + if(c == nullptr || superclass == nullptr){ + return false; + } + if(c == superclass){ + return true; + } + return superclass->isSubclassOf(c); +} + /* Class AnnotationClass */ AnnotationClass::AnnotationClass( -- cgit v1.2.3