6#include <bond/core/config.h>
8#include <bond/core/reflection.h>
15 template <
typename T,
typename Transform>
16 typename boost::enable_if<is_fast_path_field<T, Transform>,
bool>::type
17 inline OmittedField(
const T& field,
const Transform& transform)
19 return transform.OmittedField(field);
23 template <
typename T,
typename Transform>
24 typename boost::disable_if<is_fast_path_field<T, Transform>,
bool>::type
25 inline OmittedField(
const T&,
const Transform& transform)
27 return transform.OmittedField(T::id, T::metadata, get_type_id<typename T::field_type>::value);
31 template <
typename T,
typename Reader>
32 typename boost::enable_if_c<is_reader<Reader>::value && is_nested_field<T>::value,
33 bonded<typename T::field_type, Reader&> >::type
34 inline GetFieldValue(Reader& input)
36 return bonded<typename T::field_type, Reader&>(input);
40 template <
typename T,
typename Reader>
41 typename boost::enable_if_c<is_reader<Reader>::value && !is_nested_field<T>::value,
42 value<typename T::field_type, Reader&> >::type
43 inline GetFieldValue(Reader& input)
45 return value<typename T::field_type, Reader&>(input);
49 template <
typename T,
typename X>
50 typename boost::disable_if<is_reader<X>,
51 typename std::conditional<std::is_const<X>::value,
52 const typename T::value_type&,
53 typename T::value_type&>::type>::type
54 inline GetFieldValue(X& value)
56 return T::GetVariable(value);
60 template <
typename T,
typename Transform,
typename X>
61 typename boost::enable_if_c<is_reader<X>::value && is_fast_path_field<T, Transform>::value,
bool>::type
62 inline NonBasicTypeField(
const T& field,
const Transform& transform, X&& value)
64 return transform.Field(field, GetFieldValue<T>(std::forward<X>(value)));
68 template <
typename T,
typename Transform,
typename X>
69 typename boost::disable_if_c<is_reader<X>::value && is_fast_path_field<T, Transform>::value,
bool>::type
70 inline NonBasicTypeField(
const T&,
const Transform& transform, X&& value)
72 return transform.Field(T::id, T::metadata, GetFieldValue<T>(std::forward<X>(value)));
76 template <
typename Reader,
typename Transform>
77 inline bool NonBasicTypeField(
const FieldDef& field,
const RuntimeSchema& schema,
const Transform& transform, Reader& input)
79 if (field.type.id == BT_STRUCT)
81 return transform.Field(field.id, field.metadata, bonded<void, Reader&>(input, RuntimeSchema(schema, field)));
85 BOOST_ASSERT(field.type.id == BT_LIST || field.type.id == BT_SET || field.type.id == BT_MAP);
86 return transform.Field(field.id, field.metadata, value<void, Reader&>(input, RuntimeSchema(schema, field)));
namespace bond
Definition: apply.h:17