summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-10-06 22:36:51 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-10-06 22:36:51 +0100
commit5cf242d9e474f4b5b598b48fb86e696856802fa6 (patch)
tree1c8f5fec0b05473223f0e140c43c7c2cd03dff88
parentDetemplate class registration a bit (diff)
downloadslicer-5cf242d9e474f4b5b598b48fb86e696856802fa6.tar.bz2
slicer-5cf242d9e474f4b5b598b48fb86e696856802fa6.tar.xz
slicer-5cf242d9e474f4b5b598b48fb86e696856802fa6.zip
Detemplate GetSubclassModelPart a bit
-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>