Lines Matching refs:T
45 * Pad \a bytes to the alignment of the type \a T.
46 * \tparam T The data type used for the alignment
48 * \return \a bytes padded to achieve the alignment of \a T.
50 template<typename T>
52 { return align_to(bytes, __alignof(T)); }
55 * Check if there is enough space for T from offset to limit.
56 * \tparam T The data type that shall be fitted at \a offset
60 * the size of \a T.
63 template<typename T>
66 return offset + sizeof(T) <= limit;
70 * Check if there is enough space for an array of T from offset to limit.
71 * \tparam T The data type that shall be fitted at \a offset
76 * \a cnt times the size of \a T.
77 * \param cnt The number of elements of type \a T that shall be put
81 template<typename T, typename CTYPE>
85 ~0U / sizeof(T) <= static_cast<unsigned>(cnt)))
89 static_cast<CTYPE>(~0U / sizeof(T)) <= cnt))
92 return sizeof(T) * cnt <= limit - offset;
115 * \tparam T The type of the data to add
118 * the alignment of \a T if \a v is added.
124 template<typename T>
125 inline int msg_add(char *msg, unsigned offs, unsigned limit, T v) noexcept
127 offs = align_to<T>(offs);
128 if (L4_UNLIKELY(!check_size<T>(offs, limit)))
130 *reinterpret_cast<typename L4::Types::Remove_const<T>::type *>(msg + offs) = v;
131 return offs + sizeof(T);
136 * \tparam T The type of the data to read
139 * the alignment of \a T if a \a v can be read.
145 template<typename T>
146 inline int msg_get(char *msg, unsigned offs, unsigned limit, T &v) noexcept
148 offs = align_to<T>(offs);
149 if (L4_UNLIKELY(!check_size<T>(offs, limit)))
151 v = *reinterpret_cast<T *>(msg + offs);
152 return offs + sizeof(T);
182 template<typename T> struct _Plain
184 typedef T type;
185 static T deref(T v) noexcept { return v; }
188 template<typename T> struct _Plain<T *>
190 typedef T type;
191 static T &deref(T *v) noexcept { return *v; }
194 template<typename T> struct _Plain<T &>
196 typedef T type;
197 static T &deref(T &v) noexcept { return v; }
201 template<typename T> struct _Plain<T const &>
203 typedef T type;
204 static T const &deref(T const &v) noexcept { return v; }
207 template<typename T> struct _Plain<T const *>
209 typedef T type;
210 static T const &deref(T const *v) noexcept { return *v; }
216 * \tparam MTYPE Elem<T>::arg_type (where T is the type used in the RPC
223 template<typename T> struct Clnt_noops
226 static constexpr int to_msg(char *, unsigned offset, unsigned, T, A, B) noexcept
231 static constexpr int from_msg(char *, unsigned offset, unsigned, long, T const &, A, B) noexcept
235 template<typename T> struct Svr_noops
238 static constexpr int from_svr(char *, unsigned offset, unsigned, long, T, A, B) noexcept
243 static constexpr int to_svr(char *, unsigned offset, unsigned, T, A, B) noexcept
251 /// Copy a T into the message
270 * \tparam MTYPE Elem<T>::svr_type (where T is the type used in the RPC
301 /// Copy a T into the message
307 template<typename T> struct Elem
310 typedef T arg_type;
311 /// The data type used to store the T on the server-side
312 typedef T svr_type;
314 typedef T svr_arg_type; // might by const & (depending on the size)
320 template<typename T> struct Elem<T &>
322 typedef T &arg_type;
323 typedef T svr_type;
325 typedef T &svr_arg_type;
329 template<typename T> struct Elem<T const &>
331 typedef T const &arg_type;
332 typedef T svr_type;
335 typedef T const &svr_arg_type;
339 template<typename T> struct Elem<T *> : Elem<T &>
341 typedef T *arg_type;
344 template<typename T> struct Elem<T const *> : Elem<T const &>
346 typedef T const *arg_type;
350 template<typename T> struct Is_valid_rpc_type : L4::Types::True {};
355 template<typename T, bool B> struct Error_invalid_rpc_parameter_used;
356 template<typename T> struct Error_invalid_rpc_parameter_used<T, true> {};
359 template<typename T>
360 struct _Elem : Elem<T>
362 static_assert(Is_valid_rpc_type<T>::value,
363 "L4::Ipc::Msg::_Elem<T>: type T is not a valid RPC parameter type.");
366 template<typename T>
367 struct _Elem : Elem<T>,
368 Error_invalid_rpc_parameter_used<T, Is_valid_rpc_type<T>::value>
373 template<typename T> struct Class : Cls_data {};
374 template<typename T> struct Direction : Dir_in {};
375 template<typename T> struct Direction<T const &> : Dir_in {};
376 template<typename T> struct Direction<T const *> : Dir_in {};
377 template<typename T> struct Direction<T &> : Dir_out {};
378 template<typename T> struct Direction<T *> : Dir_out {};
380 template<typename T> struct _Clnt_noops :
381 Clnt_noops<typename Detail::_Plain<typename _Elem<T>::arg_type>::type>
386 template<typename T, typename DIR, typename CLASS>
388 Clnt_val_ops<typename Detail::_Plain<T>::type, DIR, CLASS> {};
390 template<typename T,
391 typename ELEM = _Elem<T>,
393 typename Direction<T>::type,
394 typename Class<typename Detail::_Plain<T>::type>::type>
398 template<typename T,
399 typename ELEM = _Elem<T>,
401 typename Direction<T>::type,
402 typename Class<typename Detail::_Plain<T>::type>::type>
407 template<typename T> struct Clnt_xmit : Detail::_Clnt_xmit<T> {};
408 template<typename T> struct Svr_xmit : Detail::_Svr_xmit<T> {};