47template <
typename Type>
51 return static_cast<void*
>(ptr);
56template <
typename Type>
60 return static_cast<const void*
>(ptr);
64template <
typename Type>
68 return const_cast<void*
>(
static_cast<const void*
>(ptr));
73template <
typename Type>
78 return static_cast<Byte*
>(toOpaquePtr(ptr));
83template <
typename Type>
88 return static_cast<const Byte*
>(toOpaquePtr(ptr));
93template <
typename Type>
98 return reinterpret_cast<Type*
>(toByteBlock(pointer) + distance);
103template <
typename Type>
108 return reinterpret_cast<const Type*
>(toByteBlock(pointer) + distance);
114template <
typename Type>
119 return reinterpret_cast<Type*
>(toByteBlock(pointer) - distance);
124template <
typename Left,
typename Right>
130 return (toByteBlock(left) - toByteBlock(right));
134template <
class Value>
143 std::memcpy(&result, location,
sizeof(Value));
149template <
unsigned ArgsCount>
150struct CompositeExtractor;
154struct CompositeExtractor<1>
156 template <
class Value>
158 static Value extract(
const void* location)
noexcept
160 static_assert(
noexcept(Value(std::declval<typename Value::MemberTraits::FirstArgType>())),
"must be noexcept");
164 return Value(extractValue<typename Value::MemberTraits::FirstArgType>(location));
170struct CompositeExtractor<2>
172 template <
class Value>
174 static Value extract(
const void* location)
noexcept
176 typedef typename Value::MemberTraits::FirstArgType FirstArgType;
177 typedef typename Value::MemberTraits::SecondArgType SecondArgType;
179 static_assert(
noexcept(Value(std::declval<FirstArgType>(), std::declval<SecondArgType>())),
"must be noexcept");
184 extractValue<FirstArgType>(location),
185 extractValue<SecondArgType>(advanceByBytes(location,
sizeof(FirstArgType)))
192struct CompositeExtractor<4>
194 template <
class Value>
196 static Value extract(
const void* location)
noexcept
198 typedef typename Value::MemberTraits::FirstArgType FirstArgType;
199 typedef typename Value::MemberTraits::SecondArgType SecondArgType;
200 typedef typename Value::MemberTraits::ThirdArgType ThirdArgType;
201 typedef typename Value::MemberTraits::FourthArgType FourthArgType;
205 std::declval<FirstArgType>(),
206 std::declval<SecondArgType>(),
207 std::declval<ThirdArgType>(),
208 std::declval<FourthArgType>()
216 extractValue<FirstArgType>(location),
217 extractValue<SecondArgType>(advanceByBytes(location,
sizeof(FirstArgType))),
218 extractValue<ThirdArgType>(advanceByBytes(location,
sizeof(FirstArgType) +
sizeof(SecondArgType))),
219 extractValue<FourthArgType>(
220 advanceByBytes(location,
sizeof(FirstArgType) +
sizeof(SecondArgType) +
sizeof(ThirdArgType))
227template <
class Value>
229getValue(
const void* location)
noexcept
232 return CompositeExtractor<Value::MemberTraits::Count>::template extract<Value>(location);
236template <
class Value>
238getValue(
const void* location)
noexcept
241 return extractValue<Value>(location);
245template <
class Value>
247constexpr typename std::enable_if<!details::HasMemberTraits<Value>::value,
size_t>::type size() noexcept
249 return sizeof(Value);
253template <
class Value>
255constexpr typename std::enable_if<details::HasMemberTraits<Value>::value,
size_t>::type size() noexcept
261template <
class Value>
263commitValue(
void* location, Value value)
noexcept
266 std::memcpy(location, &value,
sizeof(Value));
270template <
class Value>
272commitValue(
void* location, Value value)
noexcept
275 value.serialize(location);
279template <
class Value>
281setValue(
void* location, Value value)
noexcept
284 commitValue(location, value);
288template <
class Value>
290setValue(
void* location, Value)
noexcept
293 commitValue(location, Value::value());
#define ONIXS_CMEMDH_MESSAGING_NAMESPACE_BEGIN
#define ONIXS_CMEMDH_MESSAGING_NAMESPACE_END
#define ONIXS_CMEMDH_FORCEINLINE
#define ONIXS_CMEMDH_CHECK_TYPE_INTEGRAL(Type)
bool value(Number &number, const MultiContainer &container, Tag tag)
UInt16 Word
Alias for Word.
UInt64 QWord
Alias for Quad Word.
std::uint32_t UInt32
uInt32.
std::uint16_t UInt16
uInt16.
UInt32 DWord
Alias for Double Word.
std::uint64_t UInt64
uInt64.
UInt8 Byte
Alias for Byte.