diff options
-rw-r--r-- | slicer/slicer/modelPartsTypes.h | 23 | ||||
-rw-r--r-- | slicer/slicer/modelPartsTypes.impl.h | 42 |
2 files changed, 48 insertions, 17 deletions
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h index ca63638..8082e07 100644 --- a/slicer/slicer/modelPartsTypes.h +++ b/slicer/slicer/modelPartsTypes.h @@ -113,25 +113,18 @@ namespace Slicer { public: class DLL_PRIVATE HookBase : public HookCommon { public: - HookBase(const std::string & n) : HookCommon(n) { } + HookBase(const std::string & n); virtual ModelPartPtr Get(T * t) const = 0; - virtual const Metadata & GetMetadata() const override { return emptyMetadata; } + virtual const Metadata & GetMetadata() const override; }; typedef IceUtil::Handle<HookBase> HookPtr; template <typename MT, typename MP> class DLL_PRIVATE Hook : public HookBase { public: - Hook(MT T::* m, const std::string & n) : - HookBase(n), - member(m) - { - } + Hook(MT T::* m, const std::string & n); - ModelPartPtr Get(T * t) const override - { - return new MP(t ? const_cast<typename std::remove_const<MT>::type *>(&(t->*member)) : NULL); - } + ModelPartPtr Get(T * t) const override; private: const MT T::* member; @@ -140,13 +133,9 @@ namespace Slicer { template <typename MT, typename MP> class DLL_PRIVATE HookMetadata : public Hook<MT, MP> { public: - HookMetadata(MT T::* member, const std::string & n, const Metadata & md) : - Hook<MT, MP>(member, n), - metadata(md) - { - } + HookMetadata(MT T::* member, const std::string & n, const Metadata & md); - virtual const Metadata & GetMetadata() const override { return metadata; } + virtual const Metadata & GetMetadata() const override; const Metadata metadata; }; diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h index 71ad746..ef69309 100644 --- a/slicer/slicer/modelPartsTypes.impl.h +++ b/slicer/slicer/modelPartsTypes.impl.h @@ -241,6 +241,48 @@ namespace Slicer { return metadata; } + template<typename T> + ModelPartForComplex<T>::HookBase::HookBase(const std::string & n) : + HookCommon(n) + { + } + + template<typename T> + const Metadata & ModelPartForComplex<T>::HookBase::GetMetadata() const + { + return emptyMetadata; + } + + template<typename T> + template<typename MT, typename MP> + ModelPartForComplex<T>::Hook<MT, MP>::Hook(MT T::* m, const std::string & n) : + HookBase(n), + member(m) + { + } + + template<typename T> + template<typename MT, typename MP> + ModelPartPtr ModelPartForComplex<T>::Hook<MT, MP>::Get(T * t) const + { + return new MP(t ? const_cast<typename std::remove_const<MT>::type *>(&(t->*member)) : NULL); + } + + template<typename T> + template<typename MT, typename MP> + ModelPartForComplex<T>::HookMetadata<MT, MP>::HookMetadata(MT T::* member, const std::string & n, const Metadata & md) : + Hook<MT, MP>(member, n), + metadata(md) + { + } + + template<typename T> + template<typename MT, typename MP> + const Metadata & ModelPartForComplex<T>::HookMetadata<MT, MP>::GetMetadata() const + { + return metadata; + } + // ModelPartForClass template<typename T> ModelPartForClass<T>::ModelPartForClass(element_type * h) : |