OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
Pack_selector.hpp
1 /*
2  * Pack_selector.hpp
3  *
4  * Created on: Jul 15, 2015
5  * Author: Pietro Incardona
6  */
7 
8 
9 #ifndef SRC_PACK_AAA_SELECTOR_HPP_
10 #define SRC_PACK_AAA_SELECTOR_HPP_
11 
12 #include <type_traits>
13 #include "util/common.hpp"
14 #include "memory_ly/Encap.hpp"
15 #include "Grid/util.hpp"
16 #include "Vector/util.hpp"
17 #include "Packer_Unpacker/has_pack_agg.hpp"
18 
20 #define PACKER_PRIMITIVE 1
21 #define PACKER_ARRAY_PRIMITIVE 2
23 #define PACKER_ENCAP_OBJECTS 3
25 #define PACKER_GENERAL 4
27 #define PACKER_GRID 5
29 #define PACKER_OBJECTS_WITH_WARNING_POINTERS 6
31 #define PACKER_OBJECTS_WITH_POINTER_CHECK 7
33 #define PACKER_ARRAY_CP_PRIMITIVE 8
35 #define PACKER_ENCAP_OBJECTS_CHUNKING 9
37 
38 #define IS_ENCAP 4
39 #define IS_GRID 2
40 #define HAS_PACKER 1
41 
46 template <typename T, int has_noPointers>
48 {
49  enum
50  {
51  value = PACKER_OBJECTS_WITH_POINTER_CHECK
52  };
53 };
54 
55 template <typename T>
57 {
58  enum
59  {
60  value = PACKER_OBJECTS_WITH_WARNING_POINTERS
61  };
62 };
63 
68 template <typename T>
70 {
71  enum
72  {
73  value = PACKER_ARRAY_CP_PRIMITIVE
74  };
75 };
76 
77 template <typename T>
79 {
80  enum
81  {
82  value = PACKER_ARRAY_CP_PRIMITIVE
83  };
84 };
85 
90 template <typename T, int known_type>
92 {
93  enum
94  {
95  value = Pack_selector_unknown_type_impl<T, has_noPointers<T>::value + 2*std::is_array<T>::value >::value
96  };
97 };
98 
99 template <typename T>
101 {
102  enum
103  {
104  value = PACKER_GRID
105  };
106 };
107 
108 template <typename T>
109 struct Pack_selector_known_type_impl<T,HAS_PACKER>
110 {
111  enum
112  {
113  value = PACKER_GENERAL
114  };
115 };
116 
117 template <typename T>
119 {
120  enum
121  {
122  value = PACKER_ENCAP_OBJECTS
123  };
124 };
125 
127 
130 template<typename T, bool is_foundamental>
132 {
133  enum
134  {
136  };
137 };
138 
139 template<typename T, bool impl = std::is_array<T>::value>
141 {
142  enum
143  {
144  value = PACKER_PRIMITIVE
145  };
146 };
147 
148 template<typename T>
150 {
151  enum
152  {
153  value = PACKER_ARRAY_CP_PRIMITIVE
154  };
155 };
156 
160 template<typename T>
161 struct Pack_selector_impl<T,true>
162 {
163  enum
164  {
166  };
167 };
168 
170 
175 template <typename T>
177 {
178  enum
179  {
180  value = Pack_selector_impl< T,std::is_fundamental<T>::value || std::is_fundamental< typename std::remove_all_extents<T>::type >::value >::value
181  };
182 };
183 
184 
185 #endif /* SRC_PACK_SELECTOR_HPP_ */
Pack selector for unknown type.
Pack selector.
Definition: util.hpp:14
it is not a fundamental type
It return true if the object T require complex serialization.
Pack selector for unknown type.