OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
t_to_memory_c.hpp
1 /*
2  * t_to_memory_c.hpp
3  *
4  * Created on: Aug 27, 2014
5  * Author: Pietro Incardona
6  */
7 
8 #ifndef T_TO_MEMORY_C_HPP_
9 #define T_TO_MEMORY_C_HPP_
10 
11 #include <boost/mpl/int.hpp>
12 #include <memory_ly/memory_c.hpp>
13 
32 #include <boost/type_traits/remove_reference.hpp>
33 #include <boost/type_traits/remove_const.hpp>
34 
35 // First thing the metafunction has to do, is to remove eventually reference and const attribute
36 
37 template<typename T>
39 {
40  typedef typename boost::remove_const <typename boost::remove_reference< T >::type >::type type;
41 };
42 
44 template<typename T>
46 {
47  typedef memory_c<T> type;
48 };
49 
51 template<typename T,size_t N1>
52 struct t_to_memory_c_impl<T[N1]>
53 {
55 };
56 
58 template<typename T,size_t N1,size_t N2>
59 struct t_to_memory_c_impl<T[N1][N2]>
60 {
62  boost::mpl::int_<N2>>>> type;
63 };
64 
65 
67 template<typename T,size_t N1,size_t N2,size_t N3>
68 struct t_to_memory_c_impl<T[N1][N2][N3]>
69 {
71  boost::mpl::int_<N2>,
72  boost::mpl::int_<N3>>>> type;
73 };
74 
76 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4>
77 struct t_to_memory_c_impl<T[N1][N2][N3][N4]>
78 {
80  boost::mpl::int_<N2>,
81  boost::mpl::int_<N3>,
82  boost::mpl::int_<N4>>>> type;
83 };
84 
86 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5>
87 struct t_to_memory_c_impl<T[N1][N2][N3][N4][N5]>
88 {
90  boost::mpl::int_<N2>,
91  boost::mpl::int_<N3>,
92  boost::mpl::int_<N4>,
93  boost::mpl::int_<N5>>>> type;
94 };
95 
97 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5, size_t N6>
98 struct t_to_memory_c_impl<T[N1][N2][N3][N4][N5][N6]>
99 {
101  boost::mpl::int_<N2>,
102  boost::mpl::int_<N3>,
103  boost::mpl::int_<N4>,
104  boost::mpl::int_<N5>,
105  boost::mpl::int_<N6>>>> type;
106 };
107 
109 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5, size_t N6, size_t N7>
110 struct t_to_memory_c_impl<T[N1][N2][N3][N4][N5][N6][N7]>
111 {
113  boost::mpl::int_<N2>,
114  boost::mpl::int_<N3>,
115  boost::mpl::int_<N4>,
116  boost::mpl::int_<N5>,
117  boost::mpl::int_<N6>,
118  boost::mpl::int_<N7>>>> type;
119 };
120 
122 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5, size_t N6, size_t N7, size_t N8>
123 struct t_to_memory_c_impl<T[N1][N2][N3][N4][N5][N6][N7][N8]>
124 {
126  boost::mpl::int_<N2>,
127  boost::mpl::int_<N3>,
128  boost::mpl::int_<N4>,
129  boost::mpl::int_<N5>,
130  boost::mpl::int_<N6>,
131  boost::mpl::int_<N7>,
132  boost::mpl::int_<N8>>>> type;
133 };
134 
136 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5, size_t N6, size_t N7, size_t N8, size_t N9>
137 struct t_to_memory_c_impl<T[N1][N2][N3][N4][N5][N6][N7][N8][N9]>
138 {
140  boost::mpl::int_<N2>,
141  boost::mpl::int_<N3>,
142  boost::mpl::int_<N4>,
143  boost::mpl::int_<N5>,
144  boost::mpl::int_<N6>,
145  boost::mpl::int_<N7>,
146  boost::mpl::int_<N8>,
147  boost::mpl::int_<N9>>>> type;
148 };
149 
151 template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5, size_t N6, size_t N7, size_t N8, size_t N9, size_t N10>
152 struct t_to_memory_c_impl<T[N1][N2][N3][N4][N5][N6][N7][N8][N9][N10]>
153 {
155  boost::mpl::int_<N2>,
156  boost::mpl::int_<N3>,
157  boost::mpl::int_<N4>,
158  boost::mpl::int_<N5>,
159  boost::mpl::int_<N6>,
160  boost::mpl::int_<N7>,
161  boost::mpl::int_<N8>,
162  boost::mpl::int_<N9>,
163  boost::mpl::int_<N10>>>> type;
164 };
165 
174 template<typename T>
176 {
178 };
179 
180 
181 #endif /* T_TO_MEMORY_C_HPP_ */
t_to_memory_c is a metafunction that given T it convert it into
Meta-function t_to_memory_c.
This class is a container for the memory interface like HeapMemory CudaMemory.
Definition: memory_c.hpp:31
Partial specialization for scalar N=0.