summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-02-07 00:49:32 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2016-02-07 00:49:32 +0000
commitedf692fdff5cdcab56ad8439e93d247d127e3bd2 (patch)
tree73bd70591d07f9c896b61fc5626e3292f5c0330f
parentDon't generate so much empty metadata (diff)
downloadslicer-edf692fdff5cdcab56ad8439e93d247d127e3bd2.tar.bz2
slicer-edf692fdff5cdcab56ad8439e93d247d127e3bd2.tar.xz
slicer-edf692fdff5cdcab56ad8439e93d247d127e3bd2.zip
Add a wrapper function back for compatibility
-rw-r--r--slicer/slicer/modelParts.h2
-rw-r--r--slicer/test/compilation.cpp3
2 files changed, 5 insertions, 0 deletions
diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h
index 6e87fe6..664ef6c 100644
--- a/slicer/slicer/modelParts.h
+++ b/slicer/slicer/modelParts.h
@@ -183,6 +183,8 @@ namespace Slicer {
static const std::string & ToModelTypeName(const std::string &);
};
+ template<typename T> inline ModelPartPtr ModelPartFor(T & t) { return ModelPart::CreateFor(t); }
+
template<typename T>
class ModelPartForRoot : public ModelPart {
public:
diff --git a/slicer/test/compilation.cpp b/slicer/test/compilation.cpp
index da13652..a985d7e 100644
--- a/slicer/test/compilation.cpp
+++ b/slicer/test/compilation.cpp
@@ -11,6 +11,9 @@ BOOST_TEST_DONT_PRINT_LOG_VALUE(std::type_info);
#define TypeTest(Var, Expr, Explicit, Expected) \
Var obj = Expr; \
+ Slicer::ModelPartPtr mppc = Slicer::ModelPartFor(obj); \
+ BOOST_REQUIRE_EQUAL(Slicer::Expected, mppc->GetType()); \
+ \
Slicer::ModelPartPtr mpp = Slicer::ModelPart::CreateFor(obj); \
BOOST_REQUIRE_EQUAL(Slicer::Expected, mpp->GetType()); \
\