30 using ptr_type = ELEM_TYPE *;
31 using len_type = LEN_TYPE;
35 Array_ref() =
default;
36 Array_ref(len_type length, ptr_type data)
37 : length(length), data(data)
40 template<
typename X>
struct Non_const
41 {
using type = Array_ref<X, LEN_TYPE>; };
43 template<
typename X>
struct Non_const<X const>
44 {
using type = Array_ref<X, LEN_TYPE>; };
46 Array_ref(
typename Non_const<ELEM_TYPE>::type
const &other)
47 : length(other.length), data(other.data)
50 Array_ref &operator = (
typename Non_const<ELEM_TYPE>::type
const &other)
52 this->length = other.length;
53 this->data = other.data;
157template<
typename A,
typename LEN>
165 enum { Is_optional =
false };
169template<
typename A,
typename LEN>
178 enum { Is_optional =
false };
182template<
typename A,
typename LEN>
191 enum { Is_optional =
false };
194template<
typename A>
struct Class<
Array<A> > : Class<A>::type {};
195template<
typename A>
struct Class<Array_ref<A> > : Class<A>::type {};
199template<
typename A,
typename LEN,
typename ARRAY,
bool REF>
200struct Clnt_val_ops_d_in : Clnt_noops<ARRAY>
202 using Clnt_noops<ARRAY>::to_msg;
203 static int to_msg(
char *msg,
unsigned offset,
unsigned limit,
204 ARRAY a, Dir_in, Cls_data)
209 *
reinterpret_cast<LEN *
>(msg + offset) = a.length;
213 using elem_type = L4::Types::Remove_const_t<A>;
214 elem_type *data =
reinterpret_cast<elem_type*
>(msg + offset);
217 if (!REF || data != a.data)
219 for (LEN i = 0; i < a.length; ++i)
223 return offset + a.length *
sizeof(A);
228template<
typename A,
typename LEN>
230 Detail::Clnt_val_ops_d_in<A, LEN, Array<A, LEN>, false> {};
232template<
typename A,
typename LEN>
234 Detail::Clnt_val_ops_d_in<A, LEN, Array_ref<A, LEN>, true> {};
236template<
typename A,
typename LEN,
typename CLASS>
238: Svr_noops< Array_ref<A, LEN> >
240 using svr_type = Array_ref<A, LEN>;
242 using Svr_noops<svr_type>::to_svr;
243 static int to_svr(
char *msg,
unsigned offset,
unsigned limit,
244 svr_type &a, Dir_in, Cls_data)
249 a.length = *
reinterpret_cast<LEN *
>(msg + offset);
253 a.data =
reinterpret_cast<A*
>(msg + offset);
254 return offset + a.length *
sizeof(A);
258template<
typename A,
typename LEN>
259struct Svr_xmit< Array<A, LEN> > : Svr_xmit< Array_ref<A, LEN> > {};
261template<
typename A,
typename LEN>
264 using type = Array<A, LEN>;
266 using Clnt_noops<type>::from_msg;
267 static int from_msg(
char *msg,
unsigned offset,
unsigned limit,
long,
268 type &a, Dir_out, Cls_data)
274 LEN l = *
reinterpret_cast<LEN *
>(msg + offset);
280 A *data =
reinterpret_cast<A*
>(msg + offset);
287 for (
unsigned i = 0; i < l; ++i)
290 return offset + l *
sizeof(A);
294template<
typename A,
typename LEN>
296 Clnt_noops<Array_ref<A, LEN> >
298 using type = Array_ref<A, LEN>;
300 using Clnt_noops<type>::from_msg;
301 static int from_msg(
char *msg,
unsigned offset,
unsigned limit,
long,
302 type &a, Dir_out, Cls_data)
308 LEN l = *
reinterpret_cast<LEN *
>(msg + offset);
314 a.data =
reinterpret_cast<A*
>(msg + offset);
316 return offset + l *
sizeof(A);
320template<
typename A,
typename LEN,
typename CLASS>
322 Svr_noops<Array_ref<L4::Types::Remove_const_t<A>, LEN>>
324 using elem_type = L4::Types::Remove_const_t<A>;
325 using svr_type = Array_ref<elem_type, LEN>;
327 using Svr_noops<svr_type>::to_svr;
328 static int to_svr(
char *msg,
unsigned offset,
unsigned limit,
329 svr_type &a, Dir_out, Cls_data)
336 a.data =
reinterpret_cast<elem_type *
>(msg + offset);
337 a.length = (limit-offset) /
sizeof(A);
341 using Svr_noops<svr_type>::from_svr;
342 static int from_svr(
char *msg,
unsigned offset,
unsigned limit,
long,
343 svr_type a, Dir_out, Cls_data)
349 *
reinterpret_cast<LEN *
>(msg + offset) = a.length;
357 elem_type *data =
reinterpret_cast<elem_type *
>(msg + offset);
359 for (LEN i = 0; i < a.length; ++i)
362 return offset + a.length *
sizeof(A);
366template<
typename A,
typename LEN>
367struct Svr_xmit<Array<A, LEN> &> : Svr_xmit<Array_ref<A, LEN> &> {};
370template<
typename A,
typename LEN>
374template<
typename A,
typename LEN>