some fixes

This commit is contained in:
AndreaRigoni
2015-07-30 18:40:04 +02:00
parent dd13aa342f
commit d9de462dae
7 changed files with 35 additions and 31 deletions

View File

@@ -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 < template <

View File

@@ -60,23 +60,22 @@ class SequenceCombiner {
typedef typename mpl::end<in_seq>::type Itr_end; typedef typename mpl::end<in_seq>::type Itr_end;
typedef typename mpl::if_< boost::is_same<Itr_next,Itr_end>, typedef typename mpl::if_< boost::is_same<Itr_next,Itr_end>,
typename mpl::push_back<seq,Itr_begin>::type, typename mpl::push_back<seq,Itr_begin>::type,
typename mpl::push_back<seq,Itr_next>::type typename mpl::push_back<seq,Itr_next>::type
>::type >::type
new_seq; new_seq;
typedef typename mpl::if_< boost::is_same<Itr_next,Itr_end>, typedef typename mpl::if_< boost::is_same<Itr_next,Itr_end>,
mpl::int_<1>, mpl::int_<1>,
mpl::int_<0> mpl::int_<0>
>::type >::type
new_state; new_state;
public: public:
typedef typename set_state<new_seq, new_state>::type type; typedef typename set_state<new_seq, new_state>::type type;
}; };
}; };
typedef typename mpl::fold< typedef typename mpl::fold< typename mpl::zip_view< mpl::vector<Seq, ItrSeq > >::type,
typename mpl::zip_view< mpl::vector<Seq, ItrSeq > >::type,
StateSeq<>, StateSeq<>,
NextOp NextOp
>::type >::type
@@ -86,7 +85,8 @@ public:
typedef typename mpl::if_< boost::is_same< typename StateResult::state, int_<1> >, typedef typename mpl::if_< boost::is_same< typename StateResult::state, int_<1> >,
typename mpl::transform< Seq, mpl::end<_1> >::type, typename mpl::transform< Seq, mpl::end<_1> >::type,
typename StateResult::sequence >::type typename StateResult::sequence
>::type
next; next;
}; };

View File

@@ -169,7 +169,7 @@ class ProgrammableAccessor : public Named {
public: public:
ProgrammableAccessor() : Named("") {} ProgrammableAccessor() {}
ProgrammableAccessor(const char *name) : Named(name) {} ProgrammableAccessor(const char *name) : Named(name) {}
@@ -223,23 +223,23 @@ public:
} }
// ------ // // ------ //
/*
// struct Wrapper {
// Wrapper(const ProgrammableAccessor<D> *ac, void *ob) :
// m_access(ac), m_object(ob)
// { assert(ob != NULL); }
// template <typename T> struct Wrapper {
// inline T Get() const { return static_cast<T>(m_access->Get(m_object)); } Wrapper(const ProgrammableAccessor<D> *ac, void *ob) :
m_access(ac), m_object(ob)
// template <typename T> { assert(ob != NULL); }
// inline void Set(const T data) const { return m_access->Set(m_object,static_cast<T>(data)); }
template <typename T>
// void *m_object; inline T Get() const { return static_cast<T>(m_access->Get(m_object)); }
// const ProgrammableAccessor<D> *m_access;
// }; template <typename T>
// const Wrapper operator() (void *ob) const { return Wrapper(this,ob); } inline void Set(const T data) const { return m_access->Set(m_object,static_cast<T>(data)); }
*/
void *m_object;
const ProgrammableAccessor<D> *m_access;
};
const Wrapper operator() (void *ob) const { return Wrapper(this,ob); }
inline D Get(void *ob) const { return m_base->Get(ob); } inline D Get(void *ob) const { return m_base->Get(ob); }

View File

@@ -134,7 +134,7 @@ struct IsInterfaceOf {
} // uLib } // uLib
#define ULIB_INTERFACE_ASSERT(interface, type) \ #define ULIB_INTERFACE_ASSERT(interface, type) \
BOOST_CONCEPT_ASSERT(( uLib::IsInterfaceOf<interface,type> )) BOOST_CONCEPT_ASSERT(( uLib::IsInterfaceOf< interface, type > ))

View File

@@ -88,6 +88,7 @@ private:
}; };
} }

View File

@@ -30,8 +30,10 @@
#include "Math/Dense.h" #include "Math/Dense.h"
#include "Math/ContainerBox.h" #include "Math/ContainerBox.h"
#include "Math/StructuredData.h" //#include "Math/StructuredData.h"
#include "Math/ImageMap.h"
#include "Math/DataSet.h" #include "Math/DataSet.h"
#include "Math/VoxImage.h"
#include <iostream> #include <iostream>
@@ -53,7 +55,7 @@ int main() {
Data data; Data data;
VectorData<Data> vd; VoxImage<Data> vd;
vd.push_back(data); vd.push_back(data);
vd.push_back(Data()); vd.push_back(Data());
vd.push_back(Data()); vd.push_back(Data());
@@ -77,7 +79,7 @@ int main2() {
BEGIN_TESTING(Structured Data); BEGIN_TESTING(Structured Data);
{ // testing unmap function //////////////////////////////////////////////// { // testing unmap function ////////////////////////////////////////////////
StructuredData sdata(Vector3i(2,3,4)); ImageMap sdata(Vector3i(2,3,4));
for(int i=0; i < sdata.GetDims().prod() ; ++i) { for(int i=0; i < sdata.GetDims().prod() ; ++i) {
Vector3i d = sdata.UnMap(i); Vector3i d = sdata.UnMap(i);
std::cout << "TEST1( sdata.UnMap(" << i << ") == Vector3i(" std::cout << "TEST1( sdata.UnMap(" << i << ") == Vector3i("

View File

@@ -27,6 +27,7 @@
#include "testing-prototype.h" #include "testing-prototype.h"
#include "Math/VectorSpace.h"
#include "Math/ImageData.h" #include "Math/ImageData.h"
#include "Math/VoxImage.h" #include "Math/VoxImage.h"