30 typedef ELEM_TYPE *ptr_type;
31 typedef 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 {
typedef Array_ref<X, LEN_TYPE> type; };
43 template<
typename X>
struct Non_const<X const>
44 {
typedef Array_ref<X, LEN_TYPE> 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 typedef typename L4::Types::Remove_const<A>::type elem_type;
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 typedef Array_ref<A, LEN> svr_type;
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>
262struct Clnt_val_ops<Array<A, LEN>,
Dir_out,
Cls_data> : Clnt_noops<Array<A, LEN> >
264 typedef Array<A, LEN> type;
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)
270 offset = align_to<LEN>(offset);
274 LEN l = *
reinterpret_cast<LEN *
>(msg + offset);
276 offset = align_to<A>(offset +
sizeof(LEN));
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 typedef Array_ref<A, LEN> type;
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)
304 offset = align_to<LEN>(offset);
308 LEN l = *
reinterpret_cast<LEN *
>(msg + offset);
310 offset = align_to<A>(offset +
sizeof(LEN));
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<typename L4::Types::Remove_const<A>::type, LEN> &>
324 typedef typename L4::Types::Remove_const<A>::type elem_type;
325 typedef Array_ref<elem_type, LEN> &svr_type;
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;
355 return offset + a.length *
sizeof(A);
359template<
typename A,
typename LEN>
360struct Svr_xmit<Array<A, LEN> &> : Svr_xmit<Array_ref<A, LEN> &> {};
363template<
typename A,
typename LEN>
367template<
typename A,
typename LEN>