summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-09-23 21:12:10 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-09-23 21:12:10 +0100
commitb7f3f7e7da93c8950c7b19f8c1bb8f40b504ebde (patch)
treed18d8de1003331bb68948bdc658fe6542f21ef4f
parentRefactor getAllConversions into getAllMetadata and fold ModelPartForConverted... (diff)
downloadslicer-b7f3f7e7da93c8950c7b19f8c1bb8f40b504ebde.tar.bz2
slicer-b7f3f7e7da93c8950c7b19f8c1bb8f40b504ebde.tar.xz
slicer-b7f3f7e7da93c8950c7b19f8c1bb8f40b504ebde.zip
Export and explicitly instantiate templated model parts
-rw-r--r--slicer/slicer/modelPartsTypes.h20
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h1
-rw-r--r--slicer/tool/parser.cpp4
3 files changed, 11 insertions, 14 deletions
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index 0886ed6..8af3653 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -15,7 +15,7 @@ namespace Slicer {
};
template<typename T>
- class ModelPartForSimple : public ModelPartForSimpleBase {
+ class DLL_PUBLIC ModelPartForSimple : public ModelPartForSimpleBase {
public:
typedef T element_type;
@@ -39,7 +39,7 @@ namespace Slicer {
};
template<typename T, typename M, T M::* MV>
- class ModelPartForConverted : public ModelPartForConvertedBase {
+ class DLL_PUBLIC ModelPartForConverted : public ModelPartForConvertedBase {
public:
typedef T element_type;
@@ -53,7 +53,7 @@ namespace Slicer {
};
template<typename T>
- class ModelPartForOptional : public ModelPart {
+ class DLL_PUBLIC ModelPartForOptional : public ModelPart {
public:
ModelPartForOptional(IceUtil::Optional< typename T::element_type > & h);
virtual void OnEachChild(const ChildHandler & ch) override;
@@ -84,7 +84,7 @@ namespace Slicer {
};
template<typename T>
- class ModelPartForComplex : public ModelPartForComplexBase {
+ class DLL_PUBLIC ModelPartForComplex : public ModelPartForComplexBase {
public:
class HookBase : public HookCommon {
public:
@@ -140,7 +140,7 @@ namespace Slicer {
};
template<typename T>
- class ModelPartForClass : public ModelPartForComplex<typename T::element_type> {
+ class DLL_PUBLIC ModelPartForClass : public ModelPartForComplex<typename T::element_type> {
public:
typedef T element_type;
@@ -165,7 +165,7 @@ namespace Slicer {
};
template<typename T>
- class ModelPartForStruct : public ModelPartForComplex<T> {
+ class DLL_PUBLIC ModelPartForStruct : public ModelPartForComplex<T> {
public:
typedef T element_type;
@@ -190,7 +190,7 @@ namespace Slicer {
};
template<typename T>
- class ModelPartForEnum : public ModelPartForEnumBase {
+ class DLL_PUBLIC ModelPartForEnum : public ModelPartForEnumBase {
public:
typedef T element_type;
typedef boost::bimap<T, std::string> Enumerations;
@@ -220,7 +220,7 @@ namespace Slicer {
};
template<typename T>
- class ModelPartForSequence : public ModelPartForSequenceBase {
+ class DLL_PUBLIC ModelPartForSequence : public ModelPartForSequenceBase {
public:
typedef T element_type;
@@ -244,7 +244,7 @@ namespace Slicer {
};
template<typename T>
- class ModelPartForDictionaryElementInserter : public ModelPartForStruct<typename T::value_type> {
+ class DLL_PUBLIC ModelPartForDictionaryElementInserter : public ModelPartForStruct<typename T::value_type> {
public:
ModelPartForDictionaryElementInserter(T & d);
@@ -264,7 +264,7 @@ namespace Slicer {
};
template<typename T>
- class ModelPartForDictionary : public ModelPartForDictionaryBase {
+ class DLL_PUBLIC ModelPartForDictionary : public ModelPartForDictionaryBase {
public:
typedef T element_type;
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index 2c9e20f..201e90f 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -5,6 +5,7 @@
#include <common.h>
#define MODELPARTFOR(Type, ModelPartType) \
+ template class ModelPartType<Type>; \
template<> ModelPartPtr ModelPart::CreateFor(Type & s) { return new ModelPartType<Type>(s); } \
template<> ModelPartPtr ModelPart::CreateFor(IceUtil::Optional<Type> & s) { return new ModelPartForOptional<ModelPartType<Type> >(s); } \
template<> ModelPartPtr ModelPart::CreateRootFor(Type & s) { return new ModelPartForRoot<Type>(s); } \
diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp
index 205180f..ca190a5 100644
--- a/slicer/tool/parser.cpp
+++ b/slicer/tool/parser.cpp
@@ -359,10 +359,6 @@ namespace Slicer {
fprintbf(cpp, "MODELPARTFOR(%s, ModelPartForEnum);\n\n",
e->scoped());
- fprintbf(cpp, "template %s ModelPartForEnum< %s >::lookup(const std::string &);\n\n",
- e->scoped(), e->scoped());
- fprintbf(cpp, "template const std::string & ModelPartForEnum< %s >::lookup(%s);\n\n",
- e->scoped(), e->scoped());
}
void