summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/slicer/modelPartsTypes.cpp8
-rw-r--r--slicer/slicer/modelPartsTypes.h2
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h6
3 files changed, 11 insertions, 5 deletions
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp
index e5744df..05e30cd 100644
--- a/slicer/slicer/modelPartsTypes.cpp
+++ b/slicer/slicer/modelPartsTypes.cpp
@@ -97,6 +97,14 @@ namespace Slicer {
Slicer::classNameMap()->left.erase(className);
}
}
+ ModelPartPtr ModelPartForComplexBase::getSubclassModelPart(const std::string & name, void * m)
+ {
+ auto ref = classRefMap()->find(ModelPart::ToModelTypeName(name));
+ if (ref == classRefMap()->end()) {
+ throw UnknownType(name);
+ }
+ return ref->second(m);
+ }
void ModelPartForEnumBase::OnEachChild(const ChildHandler &) { }
ChildRefPtr ModelPartForEnumBase::GetAnonChildRef(const HookFilter &) { return NULL; }
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index 483d8a7..d19f03d 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -92,6 +92,8 @@ namespace Slicer {
static const ModelPartType type;
protected:
+ ModelPartPtr getSubclassModelPart(const std::string & name, void * m);
+
static void registerClass(const std::string & className, const TypeId & typeName, const ClassRef &);
static void unregisterClass(const std::string & className, const TypeId & typeName);
};
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index 658e95b..401c3ed 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -279,11 +279,7 @@ namespace Slicer {
template<typename T>
ModelPartPtr ModelPartForClass<T>::GetSubclassModelPart(const std::string & name)
{
- auto ref = classRefMap()->find(ModelPart::ToModelTypeName(name));
- if (ref == classRefMap()->end()) {
- throw UnknownType(name);
- }
- return ref->second(&this->Model);
+ return ModelPartForComplexBase::getSubclassModelPart(name, &this->Model);
}
template<typename T>