1 #ifndef ZSERIO_TRAITS_H_INC
2 #define ZSERIO_TRAITS_H_INC
13 class BitStreamReader;
14 struct PropagateAllocatorT;
17 template <
typename, std::
size_t>
24 class inplace_optional_holder;
26 template <
typename,
typename>
27 class heap_optional_holder;
30 template <
typename T,
typename U = decltype(&T::initialize)>
31 struct decltype_initialize
36 template <
typename T,
typename U = decltype(&T::initializeChildren)>
37 struct decltype_initialize_children
42 template <typename T, typename U = decltype(std::declval<T>().reflectable())>
43 struct decltype_reflectable
49 template <typename T, typename U = decltype(std::declval<T>().allocate(0))>
50 struct decltype_allocate
55 template <typename T, typename U = decltype(std::declval<T>().deallocate(
nullptr, 0))>
56 struct decltype_deallocate
61 template <typename T, typename U = decltype(std::declval<T>().getValue())>
62 struct decltype_get_value
67 template <
typename T,
typename U = decltype(&T::initializeOffset)>
68 struct decltype_initialize_offset
73 template <
typename T,
typename U = decltype(&T::checkOffset)>
74 struct decltype_check_offset
79 template <
typename T,
typename U = decltype(&T::initializeElement)>
80 struct decltype_initialize_element
85 template <
typename... T>
91 template <
typename... T>
92 using void_t =
typename make_void<T...>::type;
100 template <
typename T,
typename =
void>
104 template <
typename T>
106 detail::void_t<typename detail::decltype_allocate<T>::type,
107 typename detail::decltype_deallocate<T>::type>> : std::true_type
115 template <
typename... ARGS>
119 template <
typename T,
typename... ARGS>
128 template <
typename T,
typename =
void>
132 template <
typename T>
133 struct has_owner_type<T, detail::void_t<typename T::OwnerType>> : std::true_type
141 template <
typename T,
typename =
void>
145 template <
typename T>
154 template <
typename T,
typename =
void>
158 template <
typename T>
159 struct has_allocator<T, detail::void_t<typename T::allocator_type>> : std::true_type
167 template <
typename T,
typename =
void>
171 template <
typename T>
172 struct has_initialize<T, detail::void_t<typename detail::decltype_initialize<T>::type>> : std::true_type
180 template <
typename T,
typename =
void>
184 template <
typename T>
194 template <
typename T,
typename =
void>
198 template <
typename T>
199 struct has_reflectable<T, detail::void_t<typename detail::decltype_reflectable<T>::type>> : std::true_type
207 template <
typename T,
typename =
void>
211 template <
typename T>
212 struct has_initialize_offset<T, detail::void_t<typename detail::decltype_initialize_offset<T>::type>>
223 template <
typename T,
typename =
void>
227 template <
typename T>
228 struct has_check_offset<T, detail::void_t<typename detail::decltype_check_offset<T>::type>> : std::true_type
238 template <
typename T,
typename =
void>
242 template <
typename T>
254 template <
typename T,
typename =
void>
258 template <
typename T>
259 struct is_bitmask<T, detail::void_t<typename detail::decltype_get_value<T>::type, typename T::underlying_type>>
274 template <
typename T,
size_t Extent>
285 template <
typename FIELD_TYPE,
typename COMPOUND_TYPE,
typename ALLOCATOR_TYPE,
typename =
void>
287 : std::enable_if<!std::is_same<typename std::decay<FIELD_TYPE>::type, ALLOCATOR_TYPE>::value &&
288 !std::is_same<typename std::decay<FIELD_TYPE>::type, BitStreamReader>::value &&
289 !std::is_same<typename std::decay<FIELD_TYPE>::type, COMPOUND_TYPE>::value &&
290 !std::is_same<typename std::decay<FIELD_TYPE>::type, PropagateAllocatorT>::value &&
291 !std::is_same<typename std::decay<FIELD_TYPE>::type, NoInitT>::value,
295 template <
typename FIELD_TYPE,
typename COMPOUND_TYPE,
typename ALLOCATOR_TYPE>
297 detail::void_t<typename COMPOUND_TYPE::ZserioPackingContext>>
298 : std::enable_if<!std::is_same<typename std::decay<FIELD_TYPE>::type, ALLOCATOR_TYPE>::value &&
299 !std::is_same<typename std::decay<FIELD_TYPE>::type, BitStreamReader>::value &&
300 !std::is_same<typename std::decay<FIELD_TYPE>::type, COMPOUND_TYPE>::value &&
301 !std::is_same<typename std::decay<FIELD_TYPE>::type, PropagateAllocatorT>::value &&
302 !std::is_same<typename std::decay<FIELD_TYPE>::type, NoInitT>::value &&
303 !std::is_same<typename std::decay<FIELD_TYPE>::type,
304 typename COMPOUND_TYPE::ZserioPackingContext>::value,
312 template <
typename FIELD_TYPE,
typename COMPOUND_TYPE,
typename ALLOCATOR_TYPE>
typename is_field_constructor_enabled< FIELD_TYPE, COMPOUND_TYPE, ALLOCATOR_TYPE >::type is_field_constructor_enabled_t