168template<
typename A,
typename LEN>
169struct Elem< Array<A, LEN> >
176 enum { Is_optional =
false };
180template<
typename A,
typename LEN>
189 enum { Is_optional =
false };
193template<
typename A,
typename LEN>
202 enum { Is_optional =
false };
205template<
typename A>
struct Class<
Array<A> > : Class<A>::type {};
206template<
typename A>
struct Class<Array_ref<A> > : Class<A>::type {};
210template<
typename A,
typename LEN,
typename ARRAY,
bool REF>
211struct Clnt_val_ops_d_in : Clnt_noops<ARRAY>
213 using Clnt_noops<ARRAY>::to_msg;
214 static int to_msg(
char *msg,
unsigned offset,
unsigned limit,
215 ARRAY a, Dir_in, Cls_data)
217 offset = align_to<LEN>(offset);
220 *
reinterpret_cast<LEN *
>(msg + offset) = a.length;
221 offset = align_to<A>(offset +
sizeof(LEN));
222 if (
L4_UNLIKELY(!check_size<A>(offset, limit, a.length)))
224 typedef typename L4::Types::Remove_const<A>::type elem_type;
225 elem_type *data =
reinterpret_cast<elem_type*
>(msg + offset);
228 if (!REF || data != a.data)
230 for (LEN i = 0; i < a.length; ++i)
234 return offset + a.length *
sizeof(A);
239template<
typename A,
typename LEN>
240struct Clnt_val_ops<Array<A, LEN>, Dir_in, Cls_data> :
241 Detail::Clnt_val_ops_d_in<A, LEN, Array<A, LEN>, false> {};
243template<
typename A,
typename LEN>
244struct Clnt_val_ops<Array_ref<A, LEN>, Dir_in, Cls_data> :
245 Detail::Clnt_val_ops_d_in<A, LEN, Array_ref<A, LEN>, true> {};
247template<
typename A,
typename LEN,
typename CLASS>
248struct Svr_val_ops< Array_ref<A, LEN>, Dir_in, CLASS >
249: Svr_noops< Array_ref<A, LEN> >
251 typedef Array_ref<A, LEN> svr_type;
253 using Svr_noops<svr_type>::to_svr;
254 static int to_svr(
char *msg,
unsigned offset,
unsigned limit,
255 svr_type &a, Dir_in, Cls_data)
257 offset = align_to<LEN>(offset);
260 a.length = *
reinterpret_cast<LEN *
>(msg + offset);
261 offset = align_to<A>(offset +
sizeof(LEN));
262 if (
L4_UNLIKELY(!check_size<A>(offset, limit, a.length)))
264 a.data =
reinterpret_cast<A*
>(msg + offset);
265 return offset + a.length *
sizeof(A);
269template<
typename A,
typename LEN>
270struct Svr_xmit< Array<A, LEN> > : Svr_xmit< Array_ref<A, LEN> > {};
272template<
typename A,
typename LEN>
273struct Clnt_val_ops<Array<A, LEN>, Dir_out, Cls_data> : Clnt_noops<Array<A, LEN> >
275 typedef Array<A, LEN> type;
277 using Clnt_noops<type>::from_msg;
278 static int from_msg(
char *msg,
unsigned offset,
unsigned limit,
long,
279 type &a, Dir_out, Cls_data)
281 offset = align_to<LEN>(offset);
285 LEN l = *
reinterpret_cast<LEN *
>(msg + offset);
287 offset = align_to<A>(offset +
sizeof(LEN));
291 A *data =
reinterpret_cast<A*
>(msg + offset);
298 for (
unsigned i = 0; i < l; ++i)
301 return offset + l *
sizeof(A);
305template<
typename A,
typename LEN>
306struct Clnt_val_ops<Array_ref<A, LEN>, Dir_out, Cls_data> :
307 Clnt_noops<Array_ref<A, LEN> >
309 typedef Array_ref<A, LEN> type;
311 using Clnt_noops<type>::from_msg;
312 static int from_msg(
char *msg,
unsigned offset,
unsigned limit,
long,
313 type &a, Dir_out, Cls_data)
315 offset = align_to<LEN>(offset);
319 LEN l = *
reinterpret_cast<LEN *
>(msg + offset);
321 offset = align_to<A>(offset +
sizeof(LEN));
325 a.data =
reinterpret_cast<A*
>(msg + offset);
327 return offset + l *
sizeof(A);
331template<
typename A,
typename LEN,
typename CLASS>
332struct Svr_val_ops<Array_ref<A, LEN>, Dir_out, CLASS> :
333 Svr_noops<Array_ref<typename L4::Types::Remove_const<A>::type, LEN> &>
335 typedef typename L4::Types::Remove_const<A>::type elem_type;
336 typedef Array_ref<elem_type, LEN> &svr_type;
338 using Svr_noops<svr_type>::to_svr;
339 static int to_svr(
char *msg,
unsigned offset,
unsigned limit,
340 svr_type a, Dir_out, Cls_data)
342 offset = align_to<LEN>(offset);
346 offset = align_to<A>(offset +
sizeof(LEN));
347 a.data =
reinterpret_cast<elem_type *
>(msg + offset);
348 a.length = (limit-offset) /
sizeof(A);
352 using Svr_noops<svr_type>::from_svr;
353 static int from_svr(
char *msg,
unsigned offset,
unsigned limit,
long,
354 svr_type a, Dir_out, Cls_data)
356 offset = align_to<LEN>(offset);
360 *
reinterpret_cast<LEN *
>(msg + offset) = a.length;
362 offset = align_to<A>(offset +
sizeof(LEN));
363 if (
L4_UNLIKELY(!check_size<A>(offset, limit, a.length)))
366 return offset + a.length *
sizeof(A);
370template<
typename A,
typename LEN>
371struct Svr_xmit<Array<A, LEN> &> : Svr_xmit<Array_ref<A, LEN> &> {};
374template<
typename A,
typename LEN>
378template<
typename A,
typename LEN>