11 #include "util/for_each_ref.hpp"
12 #include "util/copy_compare/meta_copy.hpp"
13 #include "boost/mpl/range_c.hpp"
14 #include <boost/fusion/container/vector.hpp>
16 #include "Memleak_check.hpp"
18 #include "util/se_util.hpp"
19 #include "util/copy_compare/copy_fusion_vector.hpp"
20 #include "util/copy_compare/compare_fusion_vector.hpp"
21 #include "memory_ly/memory_conf.hpp"
34 template<
typename e_src,
typename e_dst>
55 if (e_src::T_type::max_prop != e_dst::T_type::max_prop)
56 std::cerr <<
"Error " << __FILE__ <<
":" << __LINE__ <<
" the number of properties between src and dst must match";
70 {std::cerr <<
"Error: " <<__FILE__ <<
":" << __LINE__ <<
" Passing a temporal object";};
78 typedef typename boost::remove_reference<decltype(
dst.template get<T::value>())>::type copy_rtype;
87 template<
template<
typename,
typename>
class op,
typename e_src,
typename e_dst,
int ... prp>
109 if (e_src::T_type::max_prop != e_dst::T_type::max_prop)
110 std::cerr <<
"Error " << __FILE__ <<
":" << __LINE__ <<
" the number of properties between src and dst must match";
124 {std::cerr <<
"Error: " <<__FILE__ <<
":" << __LINE__ <<
" Passing a temporal object";};
132 typedef typename boost::mpl::vector_c<
unsigned int,prp...> prpv;
135 typedef typename boost::mpl::at<prpv,T>::type ele_cop;
138 typedef typename boost::remove_reference<decltype(
src.template get< ele_cop::value >())>::type copy_rtype;
159 template<
typename e_src,
typename e_dst>
181 if (e_src::max_prop != e_dst::max_prop)
182 std::cerr <<
"Error " << __FILE__ <<
":" << __LINE__ <<
" the number of properties between src and dst must match";
200 {std::cerr <<
"Error: " <<__FILE__ <<
":" << __LINE__ <<
" Passing a temporal object";};
212 typedef typename boost::fusion::result_of::at_c<typename e_src::type,T::value>::type copy_type;
215 typedef typename boost::remove_reference<copy_type>::type copy_rtype;
230 template<
unsigned int p,
typename Mem>
236 typedef typename boost::fusion::result_of::at< vtype,boost::mpl::int_<p> >
::type rtype;
238 typedef typename boost::remove_reference<rtype>::type
mtype;
240 typedef typename mtype::type
type;
250 template<
unsigned int dim,
typename T,
typename layout>
272 template<
unsigned int dim,
typename T>
297 static const int max_prop = T::max_prop;
319 template <
unsigned int p,
typename r_type=decltype(boost::fusion::at_c<p>(data_c))>
323 check_valid(&boost::fusion::at_c<p>(data_c),
sizeof(
typename boost::mpl::at<
type,boost::mpl::int_<p>>::
type));
325 return boost::fusion::at_c<p>(data_c);
333 template <
unsigned int p,
typename r_type=decltype(boost::fusion::at_c<p>(data_c))>
334 inline const r_type
get()
const
337 check_valid(&boost::fusion::at_c<p>(data_c),
sizeof(
typename boost::mpl::at<
type,boost::mpl::int_<p>>::
type));
339 return boost::fusion::at_c<p>(data_c);
349 template <
unsigned int p>
inline void set(decltype(boost::fusion::at_c<p>(data_c)) & ele)
352 check_valid(&boost::fusion::at_c<p>(data_c),
sizeof(
typename boost::mpl::at<
type,boost::mpl::int_<p>>::
type));
354 return boost::fusion::at_c<p>(data_c) = ele;
371 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
387 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
403 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
419 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
433 return ! this->operator==(ec);
444 template<
unsigned int dim,
typename Mem>
454 template <
unsigned int p>
void get()
458 template <
unsigned int p,
typename S>
void set(S & ele)
476 template<
unsigned int dim,
typename T>
513 return boost::fusion::at_c<p>(data).mem_r->operator[](k);
525 return boost::fusion::at_c<p>(data).mem_r->operator[](k);
539 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
555 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
561 #include "util/common.hpp"
563 template<
typename T,
typename Sfinae =
void>
577 struct is_encap<T, typename
Void< typename T::yes_i_am_encap>::type> : std::true_type
encapc(type &data_c)
constructor from a reference object
int yes_i_am_encap
indicate the it is an encapsulated object
e_dst & dst
encapsulated destination object
int yes_i_am_encap
indicate it is an encapsulated object
Transform the boost::fusion::vector into memory specification (memory_traits)
encapc< dim, T, Mem > & set(const encapc< dim2, T, Mem > &ec)
Set one property of the encapsulated object.
void operator()(T &t) const
It call the copy function for each property.
this class is a functor for "for_each" algorithm
void set(decltype(boost::fusion::at_c< p >(data_c))&ele)
Set one property of the encapsulated object.
this class is a functor for "for_each" algorithm
This class is an helper to get the return type of get for each property.
void operator()(T &t) const
It call the copy function for each property.
Mem vtype
return a boost::fusion::vector<memory_c<....>....>
Mem & data
reference to the encapsulated object
memory_traits_lin< T >::type Mem
layout of the encapsulated object
Transform the boost::fusion::vector into memory specification (memory_traits)
boost::remove_reference< rtype >::type mtype
remove the reference
void set(S &ele)
set the data
bool operator==(const encapc< dim, T, Mem > &ec) const
Compare.
const e_src & src
object 1 we have to compare
type & data_c
reference to the encapsulated object
inter_memc< typename T::type >::type type
for each element in the vector interleave memory_c
void operator()(T &t) const
It call the copy function for each property.
memory_traits_inte< T >::type Mem
type of layout
T T_type
original object type
type * operator&()
Return the address of the base.
encapc(typename memory_traits_inte< T >::type &data, size_t k)
constructor require a key and a memory data
encapc< dim, T, Mem > & operator=(const encapc< dim, T, Mem > &ec)
Assignment.
encapc< dim, T, Mem > & operator=(const encapc< dim, T, Mem > &ec)
Assignment.
this class is a functor for "for_each" algorithm
bool operator!=(const encapc< dim, T, Mem > &ec) const
Compare.
bool result()
Returh the result of the comparison.
mtype::type type
get the base type that the buffer is storing
compare_cpu_encap_encap(const e_src &src, const e_dst &dst)
constructor
this class is a functor for "for_each" algorithm
It copy two encap object.
e_dst & dst
encapsulated object destination
encapc< dim, T, Mem > & operator=(const T &obj)
Assignment.
copy_cpu_encap_encap_op_prp(const e_src &src, e_dst &dst)
constructor
encapc< dim, T, Mem > & operator=(const T &obj)
Assignment.
This class is a container for the memory interface like HeapMemory CudaMemory.
const e_dst & dst
object 2 we have to compare
T::type type
Original list if types.
boost::fusion::result_of::at< vtype, boost::mpl::int_< p > >::type rtype
return a memory_c<...>
const e_src & src
encapsulated object source
copy_cpu_encap_encap(const e_src &src, e_dst &dst)
constructor
this class is a functor for "for_each" algorithm
const e_src & src
encapsulated source object
T::type type
object type the encap object encapsulate