OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
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 
22 #include <boost/fusion/mpl.hpp>
23 
25 
26 
27 
29 
31 template<class T, size_t N , typename result_p ,class vprp>
33 {
34  typedef typename boost::mpl::at<vprp,typename boost::mpl::int_<N-1>>::type vprp_N;
35  typedef typename boost::mpl::at<typename T::type,vprp_N>::type stype;
36  typedef typename boost::mpl::bool_<has_pack<stype>::value | result_p::value> result_n;
37  typedef typename has_pack_agg_impl<T,N-1,result_n,vprp>::result result;
38 };
39 
41 template<class T, typename result_p, class vprp>
42 struct has_pack_agg_impl<T,0,result_p,vprp>
43 {
44  typedef boost::mpl::bool_<result_p::value> result;
45 // typedef std::vector<result_p::value> fail;
46 };
47 
48 template<typename T, int np>
50 {
51  enum
52  {
53  value = np
54  };
55 };
56 
58 template<typename T>
59 struct number_prop<T,0>
60 {
61  enum
62  {
63  value = T::max_prop
64  };
65 };
66 
68 template<class T, int ... prp>
70 {
71  typedef typename prp_all_zero<T,sizeof...(prp) == 0,prp...>::type vprp;
72 
74  typedef typename has_pack_agg_impl<T,number_prop<T,sizeof ... (prp)>::value, boost::mpl::bool_<false> , vprp>::result result;
75 };
76 
78 template<class T, unsigned int sel = openfpm::vect_isel<T>::value == OPENFPM_NATIVE>
80 {
81  enum
82  {
84  };
85 };
86 
88 template<class T>
89 struct has_pack_gen<T, false>
90 {
91  enum
92  {
94  };
95 };
96 
97 
98 #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;
has_Pack check if a type has defined a method called Pack
Definition: common.hpp:205
These set of classes generate an array definition at compile-time.
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.
Structure to convert a variadic template into boost::mpl::vector.