summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-09-24 14:45:38 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-09-24 14:45:38 +0100
commit069a93016c187f6072374e7976e55d0e02ddd779 (patch)
tree2eee0694b480058e109902e615083f8036831323
parentSingle thrower of IncorrectElementName (diff)
downloadslicer-069a93016c187f6072374e7976e55d0e02ddd779.tar.bz2
slicer-069a93016c187f6072374e7976e55d0e02ddd779.tar.xz
slicer-069a93016c187f6072374e7976e55d0e02ddd779.zip
Single thrower of AbstractClassException
-rw-r--r--slicer/slicer/modelPartsTypes.cpp6
-rw-r--r--slicer/slicer/modelPartsTypes.h1
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h2
3 files changed, 8 insertions, 1 deletions
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp
index 04fc859..e65d721 100644
--- a/slicer/slicer/modelPartsTypes.cpp
+++ b/slicer/slicer/modelPartsTypes.cpp
@@ -80,6 +80,12 @@ namespace Slicer {
throw IncorrectType(name, demangle(target.name()));
}
+ [[noreturn]] void
+ ModelPartForComplexBase::throwAbstractClassException(const std::type_info & target)
+ {
+ throw AbstractClassException(demangle(target.name()));
+ }
+
#define Roots(Type, Name, NameLen) \
template<> CONSTSTR(NameLen) Slicer::ModelPartForRoot<Type>::rootName {#Name}; \
template<> \
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index c81e014..e73b99c 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -148,6 +148,7 @@ namespace Slicer {
static const std::string & ToExchangeTypeName(const std::string &);
static std::string_view ToModelTypeName(const std::string &);
[[noreturn]] static void throwIncorrectType(const std::string & name, const std::type_info & target);
+ [[noreturn]] static void throwAbstractClassException(const std::type_info & target);
};
template<typename T> class Hooks;
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index 692437e..b1f0df8 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -429,7 +429,7 @@ namespace Slicer {
{
BOOST_ASSERT(this->Model);
if constexpr (std::is_abstract_v<T>) {
- throw AbstractClassException(ModelPartForComplexBase::demangle(typeid(T).name()));
+ ModelPartForComplexBase::throwAbstractClassException(typeid(T));
}
else {
*this->Model = std::make_shared<T>();