From b7f3f7e7da93c8950c7b19f8c1bb8f40b504ebde Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 23 Sep 2016 21:12:10 +0100 Subject: Export and explicitly instantiate templated model parts --- slicer/slicer/modelPartsTypes.h | 20 ++++++++++---------- slicer/slicer/modelPartsTypes.impl.h | 1 + slicer/tool/parser.cpp | 4 ---- 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 - class ModelPartForSimple : public ModelPartForSimpleBase { + class DLL_PUBLIC ModelPartForSimple : public ModelPartForSimpleBase { public: typedef T element_type; @@ -39,7 +39,7 @@ namespace Slicer { }; template - class ModelPartForConverted : public ModelPartForConvertedBase { + class DLL_PUBLIC ModelPartForConverted : public ModelPartForConvertedBase { public: typedef T element_type; @@ -53,7 +53,7 @@ namespace Slicer { }; template - 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 - class ModelPartForComplex : public ModelPartForComplexBase { + class DLL_PUBLIC ModelPartForComplex : public ModelPartForComplexBase { public: class HookBase : public HookCommon { public: @@ -140,7 +140,7 @@ namespace Slicer { }; template - class ModelPartForClass : public ModelPartForComplex { + class DLL_PUBLIC ModelPartForClass : public ModelPartForComplex { public: typedef T element_type; @@ -165,7 +165,7 @@ namespace Slicer { }; template - class ModelPartForStruct : public ModelPartForComplex { + class DLL_PUBLIC ModelPartForStruct : public ModelPartForComplex { public: typedef T element_type; @@ -190,7 +190,7 @@ namespace Slicer { }; template - class ModelPartForEnum : public ModelPartForEnumBase { + class DLL_PUBLIC ModelPartForEnum : public ModelPartForEnumBase { public: typedef T element_type; typedef boost::bimap Enumerations; @@ -220,7 +220,7 @@ namespace Slicer { }; template - class ModelPartForSequence : public ModelPartForSequenceBase { + class DLL_PUBLIC ModelPartForSequence : public ModelPartForSequenceBase { public: typedef T element_type; @@ -244,7 +244,7 @@ namespace Slicer { }; template - class ModelPartForDictionaryElementInserter : public ModelPartForStruct { + class DLL_PUBLIC ModelPartForDictionaryElementInserter : public ModelPartForStruct { public: ModelPartForDictionaryElementInserter(T & d); @@ -264,7 +264,7 @@ namespace Slicer { }; template - 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 #define MODELPARTFOR(Type, ModelPartType) \ + template class ModelPartType; \ template<> ModelPartPtr ModelPart::CreateFor(Type & s) { return new ModelPartType(s); } \ template<> ModelPartPtr ModelPart::CreateFor(IceUtil::Optional & s) { return new ModelPartForOptional >(s); } \ template<> ModelPartPtr ModelPart::CreateRootFor(Type & s) { return new ModelPartForRoot(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 -- cgit v1.2.3