OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
aggregate.hpp
1 /*
2  * aggregate.hpp
3  *
4  * Created on: Oct 31, 2015
5  * Author: i-bird
6  */
7 
8 #ifndef OPENFPM_DATA_SRC_UTIL_AGGREGATE_HPP_
9 #define OPENFPM_DATA_SRC_UTIL_AGGREGATE_HPP_
10 
11 #include <boost/fusion/container/vector.hpp>
12 #include <Packer_Unpacker/has_pack_agg.hpp>
13 
14 #ifdef SE_CLASS3
15 
16 #define SE3_MAX_PROP(i) i+2
17 #define SE3_ADD_PROP(i) size_t[i+1],size_t
18 #define SE3_SUB_MAX_PROP -2
19 
27 template<typename ... list>
28 struct aggregate
29 {
30  typedef boost::fusion::vector<list... , SE3_ADD_PROP(sizeof...(list))> type;
31  typedef boost::fusion::vector<list... > type_real;
32 
33  type data;
34 
40  template<unsigned int i> typename boost::mpl::at<type,boost::mpl::int_<i>>::type & get()
41  {
42  return boost::fusion::at_c<i>(data);
43  }
44 
49  static bool noPointers()
50  {
51  return !has_pack_gen<aggregate<list ...>>::value;
52  }
53 
59  template<unsigned int i> const typename boost::mpl::at<type,boost::mpl::int_<i>>::type & get() const
60  {
61  return boost::fusion::at_c<i>(data);
62  }
63 
64  aggregate<list...> & operator=(aggregate<list...> & ag) = delete;
65 
66  static const unsigned int max_prop = boost::mpl::size<type>::type::value;
67  static const unsigned int max_prop_real = boost::mpl::size<type>::type::value + SE3_SUB_MAX_PROP;
68 };
69 
70 #else
71 
72 
80 template<typename ... list>
81 struct aggregate
82 {
84  typedef boost::fusion::vector<list...> type;
85 
87  typedef boost::fusion::vector<list...> type_real;
88 
91 
97  template<unsigned int i> typename boost::mpl::at<type,boost::mpl::int_<i>>::type & get()
98  {
99  return boost::fusion::at_c<i>(data);
100  }
101 
106  static bool noPointers()
107  {
108  return !has_pack_gen<aggregate<list ...>>::value;
109  }
110 
116  template<unsigned int i> const typename boost::mpl::at<type,boost::mpl::int_<i>>::type & get() const
117  {
118  return boost::fusion::at_c<i>(data);
119  }
120 
121  aggregate<list...> & operator=(aggregate<list...> & ag) = delete;
122 
123  static const unsigned int max_prop = boost::mpl::size<type>::type::value;
124  static const unsigned int max_prop_real = boost::mpl::size<type>::type::value;
125 };
126 
127 #endif
128 
129 #endif /* OPENFPM_DATA_SRC_UTIL_AGGREGATE_HPP_ */
boost::fusion::vector< list...> type_real
real internal type containing the data
Definition: aggregate.hpp:87
static bool noPointers()
it return false if this aggregate has no pointers
Definition: aggregate.hpp:106
type data
the data
Definition: aggregate.hpp:90
boost::fusion::vector< list...> type
internal type containing the data
Definition: aggregate.hpp:84
It return true if the object T require complex serialization.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
Definition: aggregate.hpp:81