From d9de462dae25210d49b79065f49a9f0a90bccf70 Mon Sep 17 00:00:00 2001 From: AndreaRigoni Date: Thu, 30 Jul 2015 18:40:04 +0200 Subject: [PATCH] some fixes --- src/Core/ClassFactory.h | 2 +- src/Core/MplSequenceCombiner.h | 18 ++++++------- src/Core/ProgrammableAccessor.h | 34 ++++++++++++------------- src/Core/StaticInterface.h | 2 +- src/Math/ContainerBox.h | 1 + src/Math/testing/StructuredDataTest.cpp | 8 +++--- src/Math/testing/VoxImageTest.cpp | 1 + 7 files changed, 35 insertions(+), 31 deletions(-) diff --git a/src/Core/ClassFactory.h b/src/Core/ClassFactory.h index d1dd367..2cbc9fe 100644 --- a/src/Core/ClassFactory.h +++ b/src/Core/ClassFactory.h @@ -33,7 +33,7 @@ namespace uLib { //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -// RUNTIME CLASS FACTORY not jet usable... classes under development ! +// RUNTIME CLASS FACTORY not usable yet... classes under development ! template < diff --git a/src/Core/MplSequenceCombiner.h b/src/Core/MplSequenceCombiner.h index 490e34f..38b8ec0 100644 --- a/src/Core/MplSequenceCombiner.h +++ b/src/Core/MplSequenceCombiner.h @@ -60,23 +60,22 @@ class SequenceCombiner { typedef typename mpl::end::type Itr_end; typedef typename mpl::if_< boost::is_same, - typename mpl::push_back::type, - typename mpl::push_back::type - >::type + typename mpl::push_back::type, + typename mpl::push_back::type + >::type new_seq; typedef typename mpl::if_< boost::is_same, - mpl::int_<1>, - mpl::int_<0> - >::type + mpl::int_<1>, + mpl::int_<0> + >::type new_state; public: typedef typename set_state::type type; }; }; - typedef typename mpl::fold< - typename mpl::zip_view< mpl::vector >::type, + typedef typename mpl::fold< typename mpl::zip_view< mpl::vector >::type, StateSeq<>, NextOp >::type @@ -86,7 +85,8 @@ public: typedef typename mpl::if_< boost::is_same< typename StateResult::state, int_<1> >, typename mpl::transform< Seq, mpl::end<_1> >::type, - typename StateResult::sequence >::type + typename StateResult::sequence + >::type next; }; diff --git a/src/Core/ProgrammableAccessor.h b/src/Core/ProgrammableAccessor.h index e36a209..acffc72 100644 --- a/src/Core/ProgrammableAccessor.h +++ b/src/Core/ProgrammableAccessor.h @@ -169,7 +169,7 @@ class ProgrammableAccessor : public Named { public: - ProgrammableAccessor() : Named("") {} + ProgrammableAccessor() {} ProgrammableAccessor(const char *name) : Named(name) {} @@ -223,23 +223,23 @@ public: } // ------ // -/* - // struct Wrapper { - // Wrapper(const ProgrammableAccessor *ac, void *ob) : - // m_access(ac), m_object(ob) - // { assert(ob != NULL); } - // template - // inline T Get() const { return static_cast(m_access->Get(m_object)); } - - // template - // inline void Set(const T data) const { return m_access->Set(m_object,static_cast(data)); } - - // void *m_object; - // const ProgrammableAccessor *m_access; - // }; - // const Wrapper operator() (void *ob) const { return Wrapper(this,ob); } -*/ + struct Wrapper { + Wrapper(const ProgrammableAccessor *ac, void *ob) : + m_access(ac), m_object(ob) + { assert(ob != NULL); } + + template + inline T Get() const { return static_cast(m_access->Get(m_object)); } + + template + inline void Set(const T data) const { return m_access->Set(m_object,static_cast(data)); } + + void *m_object; + const ProgrammableAccessor *m_access; + }; + const Wrapper operator() (void *ob) const { return Wrapper(this,ob); } + inline D Get(void *ob) const { return m_base->Get(ob); } diff --git a/src/Core/StaticInterface.h b/src/Core/StaticInterface.h index 3a42a16..0766705 100644 --- a/src/Core/StaticInterface.h +++ b/src/Core/StaticInterface.h @@ -134,7 +134,7 @@ struct IsInterfaceOf { } // uLib #define ULIB_INTERFACE_ASSERT(interface, type) \ - BOOST_CONCEPT_ASSERT(( uLib::IsInterfaceOf )) + BOOST_CONCEPT_ASSERT(( uLib::IsInterfaceOf< interface, type > )) diff --git a/src/Math/ContainerBox.h b/src/Math/ContainerBox.h index c63b143..0455091 100644 --- a/src/Math/ContainerBox.h +++ b/src/Math/ContainerBox.h @@ -88,6 +88,7 @@ private: }; + } diff --git a/src/Math/testing/StructuredDataTest.cpp b/src/Math/testing/StructuredDataTest.cpp index f186405..f83408d 100644 --- a/src/Math/testing/StructuredDataTest.cpp +++ b/src/Math/testing/StructuredDataTest.cpp @@ -30,8 +30,10 @@ #include "Math/Dense.h" #include "Math/ContainerBox.h" -#include "Math/StructuredData.h" +//#include "Math/StructuredData.h" +#include "Math/ImageMap.h" #include "Math/DataSet.h" +#include "Math/VoxImage.h" #include @@ -53,7 +55,7 @@ int main() { Data data; - VectorData vd; + VoxImage vd; vd.push_back(data); vd.push_back(Data()); vd.push_back(Data()); @@ -77,7 +79,7 @@ int main2() { BEGIN_TESTING(Structured Data); { // testing unmap function //////////////////////////////////////////////// - StructuredData sdata(Vector3i(2,3,4)); + ImageMap sdata(Vector3i(2,3,4)); for(int i=0; i < sdata.GetDims().prod() ; ++i) { Vector3i d = sdata.UnMap(i); std::cout << "TEST1( sdata.UnMap(" << i << ") == Vector3i(" diff --git a/src/Math/testing/VoxImageTest.cpp b/src/Math/testing/VoxImageTest.cpp index 368fc9b..fafacd1 100644 --- a/src/Math/testing/VoxImageTest.cpp +++ b/src/Math/testing/VoxImageTest.cpp @@ -27,6 +27,7 @@ #include "testing-prototype.h" +#include "Math/VectorSpace.h" #include "Math/ImageData.h" #include "Math/VoxImage.h"