From 8552afe5b339dfa665808164e11a18a0b7313c2a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 23 Oct 2016 16:52:10 +0100 Subject: Push GetTypeId logic down into complex base --- slicer/slicer/modelPartsTypes.cpp | 4 ++++ slicer/slicer/modelPartsTypes.h | 1 + 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 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::GetTypeId() const { - auto id = this->Model->ice_id(); - return (id == className) ? TypeId() : ModelPart::ToExchangeTypeName(id); + return ModelPartForComplexBase::GetTypeId(this->Model->ice_id(), className); } // ModelPartForStruct -- cgit v1.2.3