diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-10-23 16:52:10 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-10-23 17:01:48 +0100 |
commit | 8552afe5b339dfa665808164e11a18a0b7313c2a (patch) | |
tree | 6c790696384811d1e7dce354be16e0445aa8162a | |
parent | Devirtualize Hook partname (diff) | |
download | slicer-8552afe5b339dfa665808164e11a18a0b7313c2a.tar.bz2 slicer-8552afe5b339dfa665808164e11a18a0b7313c2a.tar.xz slicer-8552afe5b339dfa665808164e11a18a0b7313c2a.zip |
Push GetTypeId logic down into complex base
-rw-r--r-- | slicer/slicer/modelPartsTypes.cpp | 4 | ||||
-rw-r--r-- | slicer/slicer/modelPartsTypes.h | 1 | ||||
-rw-r--r-- | slicer/slicer/modelPartsTypes.impl.h | 3 |
3 files changed, 6 insertions, 2 deletions
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp index b535b51..41f8125 100644 --- a/slicer/slicer/modelPartsTypes.cpp +++ b/slicer/slicer/modelPartsTypes.cpp @@ -105,6 +105,10 @@ namespace Slicer { } return ref->second(m); } + TypeId ModelPartForComplexBase::GetTypeId(const std::string & id, const std::string & className) + { + return (id == className) ? TypeId() : ModelPart::ToExchangeTypeName(id); + } void ModelPartForOptionalBase::OnEachChild(const ChildHandler & ch) { diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h index a4014ee..5297865 100644 --- a/slicer/slicer/modelPartsTypes.h +++ b/slicer/slicer/modelPartsTypes.h @@ -100,6 +100,7 @@ namespace Slicer { static void registerClass(const std::string & className, const TypeId & typeName, const ClassRef &); static void unregisterClass(const std::string & className, const TypeId & typeName); + static TypeId GetTypeId(const std::string & id, const std::string & className); }; template<typename T> diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h index 259f642..d04dd9c 100644 --- a/slicer/slicer/modelPartsTypes.impl.h +++ b/slicer/slicer/modelPartsTypes.impl.h @@ -261,8 +261,7 @@ namespace Slicer { TypeId ModelPartForClass<T>::GetTypeId() const { - auto id = this->Model->ice_id(); - return (id == className) ? TypeId() : ModelPart::ToExchangeTypeName(id); + return ModelPartForComplexBase::GetTypeId(this->Model->ice_id(), className); } // ModelPartForStruct |