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));
72template <
typename Type>
76 return const_cast<Type*
>(ptr);
81template <
typename Type>
86 return static_cast<Byte*
>(toOpaquePtr(ptr));
91template <
typename Type>
96 return static_cast<const Byte*
>(toOpaquePtr(ptr));
101template <
typename Type>
106 return reinterpret_cast<Type*
>(toByteBlock(pointer) + distance);
111template <
typename Type>
116 return reinterpret_cast<const Type*
>(toByteBlock(pointer) + distance);
122template <
typename Type>
127 return reinterpret_cast<Type*
>(toByteBlock(pointer) - distance);
132template <
typename Left,
typename Right>
138 return (toByteBlock(left) - toByteBlock(right));
142template <
class Value>
151 std::memcpy(&result, location,
sizeof(Value));
157template <
unsigned ArgsCount>
158struct CompositeExtractor;
162struct CompositeExtractor<1>
164 template <
class Value>
166 static Value extract(
const void* location)
noexcept
168 static_assert(
noexcept(Value(std::declval<typename Value::MemberTraits::FirstArgType>())),
"must be noexcept");
172 return Value(extractValue<typename Value::MemberTraits::FirstArgType>(location));
178struct CompositeExtractor<2>
180 template <
class Value>
182 static Value extract(
const void* location)
noexcept
184 typedef typename Value::MemberTraits::FirstArgType FirstArgType;
185 typedef typename Value::MemberTraits::SecondArgType SecondArgType;
187 static_assert(
noexcept(Value(std::declval<FirstArgType>(), std::declval<SecondArgType>())),
"must be noexcept");
192 extractValue<FirstArgType>(location),
193 extractValue<SecondArgType>(advanceByBytes(location,
sizeof(FirstArgType)))
200struct CompositeExtractor<4>
202 template <
class Value>
204 static Value extract(
const void* location)
noexcept
206 typedef typename Value::MemberTraits::FirstArgType FirstArgType;
207 typedef typename Value::MemberTraits::SecondArgType SecondArgType;
208 typedef typename Value::MemberTraits::ThirdArgType ThirdArgType;
209 typedef typename Value::MemberTraits::FourthArgType FourthArgType;
213 std::declval<FirstArgType>(),
214 std::declval<SecondArgType>(),
215 std::declval<ThirdArgType>(),
216 std::declval<FourthArgType>()
224 extractValue<FirstArgType>(location),
225 extractValue<SecondArgType>(advanceByBytes(location,
sizeof(FirstArgType))),
226 extractValue<ThirdArgType>(advanceByBytes(location,
sizeof(FirstArgType) +
sizeof(SecondArgType))),
227 extractValue<FourthArgType>(
228 advanceByBytes(location,
sizeof(FirstArgType) +
sizeof(SecondArgType) +
sizeof(ThirdArgType))
235template <
class Value>
237getValue(
const void* location)
noexcept
240 return CompositeExtractor<Value::MemberTraits::Count>::template extract<Value>(location);
244template <
class Value>
246getValue(
const void* location)
noexcept
249 return extractValue<Value>(location);
253template <
class Value>
255constexpr typename std::enable_if<!details::HasMemberTraits<Value>::value,
size_t>::type size() noexcept
257 return sizeof(Value);
261template <
class Value>
263constexpr typename std::enable_if<details::HasMemberTraits<Value>::value,
size_t>::type size() noexcept
269template <
class Value>
271commitValue(
void* location, Value value)
noexcept
274 std::memcpy(location, &value,
sizeof(Value));
278template <
class Value>
280commitValue(
void* location, Value value)
noexcept
283 value.serialize(location);
287template <
class Value>
289setValue(
void* location, Value value)
noexcept
292 commitValue(location, value);
296template <
class Value>
298setValue(
void* location, Value)
noexcept
301 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.