8 #ifndef OPENFPM_DATA_SRC_UTIL_AGGREGATE_HPP_
9 #define OPENFPM_DATA_SRC_UTIL_AGGREGATE_HPP_
11 #include <boost/fusion/container/vector.hpp>
12 #include <Packer_Unpacker/has_pack_agg.hpp>
13 #include "util/copy_compare/copy_compare_aggregates.hpp"
20 template<
typename bfv>
49 {std::cerr <<
"Error: " <<__FILE__ <<
":" << __LINE__ <<
" Passing a temporal object\n";};
57 typedef typename boost::fusion::result_of::at_c<bfv,T::value>::type copy_type;
60 typedef typename boost::remove_reference<copy_type>::type copy_rtype;
68 #define SE3_MAX_PROP(i) i+2
69 #define SE3_ADD_PROP(i) size_t[i+1],size_t
70 #define SE3_SUB_MAX_PROP -2
91 static const unsigned int max_prop = boost::mpl::size<type>::type::value;
92 static const unsigned int max_prop_real = boost::mpl::size<type>::type::value + SE3_SUB_MAX_PROP;
102 template<
typename ... list>
106 typedef boost::fusion::vector<list... , SE3_ADD_PROP(
sizeof...(list))>
type;
109 typedef boost::fusion::vector<list... >
type_real;
112 static const int size =
sizeof...(list);
114 typedef int yes_is_aggregate;
123 this->operator=(aggr);
131 template<
unsigned int i>
typename boost::mpl::at<type,boost::mpl::int_<i>>
::type &
get()
133 return boost::fusion::at_c<i>(
data);
141 template<
unsigned int i>
const typename boost::mpl::at<type,boost::mpl::int_<i>>
::type &
get()
const
143 return boost::fusion::at_c<i>(
data);
159 boost::mpl::for_each_ref< boost::mpl::range_c<
int,0,
sizeof...(list)> >(ca);
164 static const unsigned int max_prop = boost::mpl::size<type>::type::value;
165 static const unsigned int max_prop_real = boost::mpl::size<type>::type::value + SE3_SUB_MAX_PROP;
194 template<
unsigned int i>
typename boost::mpl::at<type,boost::mpl::int_<i>>
::type &
get()
196 return boost::fusion::at_c<i>(
data);
204 template<
unsigned int i>
const typename boost::mpl::at<type,boost::mpl::int_<i>>
::type &
get()
const
206 return boost::fusion::at_c<i>(
data);
209 static const unsigned int max_prop = boost::mpl::size<type>::type::value;
219 template<
typename ... list>
223 typedef boost::fusion::vector<list...>
type;
229 static const int size =
sizeof...(list);
231 typedef int yes_is_aggregate;
241 this->operator=(aggr);
249 template<
unsigned int i> __device__ __host__
typename boost::mpl::at<type,boost::mpl::int_<i>>
::type &
get()
251 return boost::fusion::at_c<i>(
data);
268 template<
unsigned int i> __device__ __host__
const typename boost::mpl::at<type,boost::mpl::int_<i>>
::type &
get()
const
270 return boost::fusion::at_c<i>(
data);
277 boost::mpl::for_each_ref< boost::mpl::range_c<
int,0,
sizeof...(list)> >(ca);
282 static const unsigned int max_prop = boost::mpl::size<type>::type::value;
283 static const unsigned int max_prop_real = boost::mpl::size<type>::type::value;
288 template<
typename T,
typename Sfinae =
void>
298 struct is_aggregate<T, typename
Void< typename T::yes_is_aggregate>::type> : std::true_type
303 template<
unsigned int p,
typename aggr>
304 auto at_c(aggr & agg) -> decltype(boost::fusion::at_c<p>(agg.data))
306 return boost::fusion::at_c<p>(agg.data);
309 template<
unsigned int p,
typename aggr>
310 auto get(aggr & agg) -> decltype(boost::fusion::at_c<p>(agg.data))
312 return boost::fusion::at_c<p>(agg.data);
316 template<
typename BlockT,
typename T>
321 template<
typename BlockT,
typename ... list>
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data
convert a type into constant type
An aggregate that accept a boost fusion vector as type.
const boost::mpl::at< type, boost::mpl::int_< i > >::type & get() const
get the properties i
T type
type the object store
boost::mpl::at< type, boost::mpl::int_< i > >::type & get()
get the properties i
T type_real
real type the object store
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
static bool noPointers()
it return false if this aggregate has no pointers
static const int size
size of the variadic template argument list
__device__ __host__ const boost::mpl::at< type, boost::mpl::int_< i > >::type & get() const
get the properties i
boost::fusion::vector< list... > type_real
real internal type containing the data
__device__ __host__ boost::mpl::at< type, boost::mpl::int_< i > >::type & get()
get the properties i
boost::fusion::vector< list... > type
internal type containing the data
this class is a functor for "for_each" algorithm
bfv & dst
destination fusion vector
__device__ __host__ copy_fusion_vector(const bfv &src, bfv &dst)
constructor
__device__ __host__ void operator()(T &t)
It call the copy function for each property.
const bfv & src
source fusion vector
It return true if the object T require complex serialization.