OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
has_pack_agg.hpp
1 /*
2  * has_pack_agg.hpp
3  *
4  * Created on: Feb 10, 2016
5  * Author: yaroslav
6  */
7 
8 #ifndef SRC_PACKER_UNPACKER_HAS_PACK_AGG_HPP_
9 #define SRC_PACKER_UNPACKER_HAS_PACK_AGG_HPP_
10 
11 #include "prp_all_zero.hpp"
12 #include "Vector/vect_isel.hpp"
13 #include "Vector/util.hpp"
14 
23 #include <boost/fusion/mpl.hpp>
24 
26 
28 template<class T, size_t N , typename result_p ,class vprp>
30 {
31  typedef typename boost::mpl::at<vprp,typename boost::mpl::int_<N-1>>::type vprp_N;
32  typedef typename boost::mpl::at<typename T::type,vprp_N>::type stype;
33 
34  typedef boost::mpl::int_<(is_vector<stype>::value ||
37 
38  typedef typename boost::mpl::bool_< crh_cond::value | result_p::value> result_n;
39  typedef typename is_complex_agg_impl<T,N-1,result_n,vprp>::result result;
40 };
41 
43 template<class T, typename result_p, class vprp>
44 struct is_complex_agg_impl<T,0,result_p,vprp>
45 {
46  typedef boost::mpl::bool_<result_p::value> result;
47 // typedef std::vector<result_p::value> fail;
48 };
49 
51 
53 template<class T, size_t N , typename result_p ,class vprp>
55 {
56  typedef typename boost::mpl::at<vprp,typename boost::mpl::int_<N-1>>::type vprp_N;
57  typedef typename boost::mpl::at<typename T::type,vprp_N>::type stype;
58  typedef typename boost::mpl::bool_<has_pack<stype>::value | result_p::value> result_n;
59  typedef typename has_pack_agg_impl<T,N-1,result_n,vprp>::result result;
60 };
61 
63 template<class T, typename result_p, class vprp>
64 struct has_pack_agg_impl<T,0,result_p,vprp>
65 {
66  typedef boost::mpl::bool_<result_p::value> result;
67 // typedef std::vector<result_p::value> fail;
68 };
69 
70 template<typename T, int np>
72 {
73  enum
74  {
75  value = np
76  };
77 };
78 
80 template<typename T>
81 struct number_prop<T,0>
82 {
83  enum
84  {
85  value = T::max_prop
86  };
87 };
88 
90 template<class T, int ... prp>
92 {
93  typedef typename prp_all_zero<T,sizeof...(prp) == 0,prp...>::type vprp;
94 
96  typedef typename has_pack_agg_impl<T,number_prop<T,sizeof ... (prp)>::value, boost::mpl::bool_<false> , vprp>::result result;
97 };
98 
100 template<class T, int ... prp>
102 {
103  typedef typename prp_all_zero<T,sizeof...(prp) == 0,prp...>::type vprp;
104 
106  typedef typename is_complex_agg_impl<T,number_prop<T,sizeof ... (prp)>::value, boost::mpl::bool_<false> , vprp>::result result;
107 };
108 
110 template<class T, unsigned int sel = openfpm::vect_isel<T>::value == OPENFPM_NATIVE>
112 {
113  enum
114  {
116  };
117 };
118 
120 template<class T>
121 struct has_pack_gen<T, false>
122 {
123  enum
124  {
126  };
127 };
128 
129 
130 #endif /* SRC_PACKER_UNPACKER_HAS_PACK_AGG_HPP_ */
has_pack_agg_impl< T, number_prop< T, sizeof ...(prp)>::value, boost::mpl::bool_< false >, vprp >::result result
typedef typename to_boost_vmpl<prp...>::type vprp;
return if true the aggregate type T has a property that has a complex packing(serialization) method
has_Pack check if a type has defined a method called Pack
Definition: common.hpp:240
is_complex_agg_impl< T, number_prop< T, sizeof ...(prp)>::value, boost::mpl::bool_< false >, vprp >::result result
typedef typename to_boost_vmpl<prp...>::type vprp;
These set of classes generate an array definition at compile-time.
Generate the array specializing ArrayHolder.
return if true the aggregate type T has a property that has a complex packing(serialization) method
It return true if the object T require complex serialization.
Check this is a gpu or cpu type cell-list.
Definition: util.hpp:74
Structure to convert a variadic template into boost::mpl::vector.