OnixS C++ ICE Binary Order Entry Handler 1.1.1
API Documentation
Loading...
Searching...
No Matches
BinaryBlock< Container, BlockLength > Class Template Reference

Protected Member Functions

 BinaryBlock ()=default
 ~BinaryBlock ()=default
template<typename Value>
ONIXS_ICEBOE_FORCEINLINE Value ordinary (BlockLength offset) const noexcept
template<typename NullValue>
ONIXS_ICEBOE_FORCEINLINE std::enable_if<!isComposite< typenameNullValue::Value >::value, SbeOptional< typenameNullValue::Value, NullValue > >::type ordinary (BlockLength offset, OptionalTag) const noexcept
template<typename NullValue>
ONIXS_ICEBOE_FORCEINLINE std::enable_if<!isComposite< typenameNullValue::Value >::value, SbeOptional< typenameNullValue::Value, NullValue > >::type ordinary (BlockLength offset, SchemaVersion since, OptionalTag) const noexcept
template<typename NullValue>
ONIXS_ICEBOE_FORCEINLINE std::enable_if< isComposite< typenameNullValue::Value >::value, SbeOptional< typenameNullValue::Value, NullValue > >::type ordinary (BlockLength offset, OptionalTag) const noexcept
template<typename NullValue>
ONIXS_ICEBOE_FORCEINLINE std::enable_if< isComposite< typenameNullValue::Value >::value, SbeOptional< typenameNullValue::Value, NullValue > >::type ordinary (BlockLength offset, SchemaVersion since, OptionalTag) const noexcept
template<typename Enumeration>
ONIXS_ICEBOE_FORCEINLINE Enumeration enumeration (BlockLength offset) const noexcept
template<typename Enumeration, typename NullValue>
ONIXS_ICEBOE_FORCEINLINE SbeOptionalEnumeration< Enumeration, NullValue > enumeration (BlockLength offset, OptionalTag) const noexcept
template<typename Enumeration, typename NullValue>
ONIXS_ICEBOE_FORCEINLINE SbeOptionalEnumeration< Enumeration, NullValue > enumeration (BlockLength offset, SchemaVersion since, OptionalTag) const noexcept
template<BlockLength Length>
ONIXS_ICEBOE_FORCEINLINE StrRef fixedStr (BlockLength offset) const noexcept
template<BlockLength Length>
ONIXS_ICEBOE_FORCEINLINE SbeOptionalStr fixedStr (BlockLength offset, OptionalTag) const noexcept
template<BlockLength Length>
ONIXS_ICEBOE_FORCEINLINE SbeOptionalStr fixedStr (BlockLength offset, SchemaVersion since, OptionalTag) const noexcept
template<typename Value>
ONIXS_ICEBOE_FORCEINLINE Value decimal (BlockLength offset) const noexcept
template<typename NullValue>
SbeOptional< typename NullValue::Value, NullValue > ONIXS_ICEBOE_FORCEINLINE decimal (BlockLength offset, OptionalTag) const noexcept
template<typename NullValue>
ONIXS_ICEBOE_FORCEINLINE SbeOptional< typename NullValue::Value, NullValue > decimal (BlockLength offset, SchemaVersion since, OptionalTag) const noexcept
template<typename NullValue, typename Callable>
ONIXS_ICEBOE_FORCEINLINE std::enable_if<!isComposite< typenameNullValue::Value >::value, SbeOptionalConverted< decltype(std::declval< Callable >()(std::declval< typenameArgType< Callable >::type >()))> >::type convertible (BlockLength offset, OptionalTag) const noexcept(noexcept(Callable::Nothrow))
template<typename Callable>
ONIXS_ICEBOE_FORCEINLINE auto convertible (BlockLength offset) const noexcept(noexcept(Callable::Nothrow)) -> decltype(std::declval< Callable >()(std::declval< typename ArgType< Callable >::type >()))
Protected Member Functions inherited from BinaryBlockBase
 ~BinaryBlockBase ()=default

Detailed Description

template<class Container, class BlockLength>
class OnixS::ICE::BOE::Messaging::BinaryBlock< Container, BlockLength >

The given class represents an abstraction to be used by descendants as a base class with static polymorphism.

Definition at line 64 of file SbeMessage.h.

Constructor & Destructor Documentation

◆ BinaryBlock()

template<class Container, class BlockLength>
BinaryBlock ( )
protecteddefault

Initializes a blank instance.

◆ ~BinaryBlock()

template<class Container, class BlockLength>
~BinaryBlock ( )
protecteddefault

Member Function Documentation

◆ convertible() [1/2]

template<class Container, class BlockLength>
template<typename Callable>
ONIXS_ICEBOE_FORCEINLINE auto convertible ( BlockLength offset) const -> decltype(std::declval<Callable>()(std::declval<typename ArgType<Callable>::type>()))
inlineprotectednoexcept

Definition at line 247 of file SbeMessage.h.

249 {
250 typedef typename ArgType<Callable>::type InputType;
251 return Callable{}(ordinary<InputType>(offset));
252 }

◆ convertible() [2/2]

template<class Container, class BlockLength>
template<typename NullValue, typename Callable>
ONIXS_ICEBOE_FORCEINLINE std::enable_if<!isComposite< typenameNullValue::Value >::value, SbeOptionalConverted< decltype(std::declval< Callable >()(std::declval< typenameArgType< Callable >::type >()))> >::type convertible ( BlockLength offset,
OptionalTag  ) const
inlineprotectednoexcept

Definition at line 230 of file SbeMessage.h.

231 {
232 typedef typename ArgType<Callable>::type InputType;
233 typedef decltype(std::declval<Callable>()(std::declval<InputType>())) ReturnType;
234
235 static_assert(!std::is_convertible<InputType, ReturnType>::value, "Direct conversion can be done.");
236
237 const auto value = ordinary<NullValue>(offset, optional);
238
239 if(!value)
240 return SbeOptionalConverted<ReturnType>::null();
241
242 return SbeOptionalConverted<ReturnType>(Callable{}(*value));
243 }

◆ decimal() [1/3]

template<class Container, class BlockLength>
template<typename Value>
ONIXS_ICEBOE_FORCEINLINE Value decimal ( BlockLength offset) const
inlineprotectednoexcept

Definition at line 197 of file SbeMessage.h.

198 {
199 return ordinary<Value>(offset);
200 }

◆ decimal() [2/3]

template<class Container, class BlockLength>
template<typename NullValue>
SbeOptional< typename NullValue::Value, NullValue > ONIXS_ICEBOE_FORCEINLINE decimal ( BlockLength offset,
OptionalTag  ) const
inlineprotectednoexcept

Definition at line 205 of file SbeMessage.h.

206 {
207 using Value = typename NullValue::Value;
208
209 assert(container().blockLength() >= (offset + size<Value>()) && "The requested field exceeds provided block boundaries.");
210
211 using RetType = SbeOptional<Value, NullValue>;
212 const void* const location = advanceByBytes(container().block(), offset);
213 return makeFromTuple<RetType>(CompositeExtractor<Value::MemberTraits::Count>:: template extractAsTuple<Value>(location));
214 }
ONIXS_ICEBOE_FORCEINLINE Type * advanceByBytes(Type *pointer, ptrdiff_t distance) noexcept
Advances the pointer to a given offset (distance) in bytes.
Definition Memory.h:110

◆ decimal() [3/3]

template<class Container, class BlockLength>
template<typename NullValue>
ONIXS_ICEBOE_FORCEINLINE SbeOptional< typename NullValue::Value, NullValue > decimal ( BlockLength offset,
SchemaVersion since,
OptionalTag  ) const
inlineprotectednoexcept

Definition at line 219 of file SbeMessage.h.

220 {
221 if(since > container().version())
222 return SbeOptional<typename NullValue::Value, NullValue>::null();
223
224 return decimal<NullValue>(offset, optional);
225 }
const char * version() noexcept

◆ enumeration() [1/3]

template<class Container, class BlockLength>
template<typename Enumeration>
ONIXS_ICEBOE_FORCEINLINE Enumeration enumeration ( BlockLength offset) const
inlineprotectednoexcept
Returns
the field value.

Definition at line 141 of file SbeMessage.h.

142 {
143 using Base = typename underlyingType<Enumeration>::type;
144 return static_cast<Enumeration>(ordinary<Base>(offset));
145 }

◆ enumeration() [2/3]

template<class Container, class BlockLength>
template<typename Enumeration, typename NullValue>
ONIXS_ICEBOE_FORCEINLINE SbeOptionalEnumeration< Enumeration, NullValue > enumeration ( BlockLength offset,
OptionalTag  ) const
inlineprotectednoexcept

Provides access to an optional field value.

Definition at line 150 of file SbeMessage.h.

151 {
152 using Base = typename underlyingType<Enumeration>::type;
153 return {static_cast<Enumeration>(ordinary<Base>(offset))};
154 }

◆ enumeration() [3/3]

template<class Container, class BlockLength>
template<typename Enumeration, typename NullValue>
ONIXS_ICEBOE_FORCEINLINE SbeOptionalEnumeration< Enumeration, NullValue > enumeration ( BlockLength offset,
SchemaVersion since,
OptionalTag  ) const
inlineprotectednoexcept

Provides access to an optional field value.

Definition at line 159 of file SbeMessage.h.

160 {
161 if(since > container().version())
162 return SbeOptionalEnumeration<Enumeration, NullValue>::null();
163
164 return enumeration<Enumeration, NullValue>(offset, optional);
165 }

◆ fixedStr() [1/3]

template<class Container, class BlockLength>
template<BlockLength Length>
ONIXS_ICEBOE_FORCEINLINE StrRef fixedStr ( BlockLength offset) const
inlineprotectednoexcept

Provides access to a string field value.

Definition at line 170 of file SbeMessage.h.

171 {
172 assert(container().blockLength() >= (offset + Length) && "The requested field exceeds provided block boundaries.");
173
174 const Char* const text = reinterpret_cast<const Char*>(advanceByBytes(container().block(), offset));
175 return StrRef(text, stringLen<Length>(text));
176 }
char Char
Character type alias.
Definition String.h:31
std::basic_string_view< Char > StrRef
Definition StrRef.h:46

◆ fixedStr() [2/3]

template<class Container, class BlockLength>
template<BlockLength Length>
ONIXS_ICEBOE_FORCEINLINE SbeOptionalStr fixedStr ( BlockLength offset,
OptionalTag  ) const
inlineprotectednoexcept

Definition at line 180 of file SbeMessage.h.

181 {
182 return {fixedStr<Length>(offset)};
183 }

◆ fixedStr() [3/3]

template<class Container, class BlockLength>
template<BlockLength Length>
ONIXS_ICEBOE_FORCEINLINE SbeOptionalStr fixedStr ( BlockLength offset,
SchemaVersion since,
OptionalTag  ) const
inlineprotectednoexcept

Definition at line 187 of file SbeMessage.h.

188 {
189 if(since > container().version())
190 return SbeOptionalStr::null();
191
192 return fixedStr<Length>(offset, optional);
193 }

◆ ordinary() [1/5]

template<class Container, class BlockLength>
template<typename Value>
ONIXS_ICEBOE_FORCEINLINE Value ordinary ( BlockLength offset) const
inlineprotectednoexcept
Returns
the field value.

Definition at line 81 of file SbeMessage.h.

82 {
83 assert(container().blockLength() >= (offset + size<Value>()) && "The requested field exceeds provided block boundaries.");
84
85 const void* const location = advanceByBytes(container().block(), offset);
86 return getValue<Value>(location);
87 }

◆ ordinary() [2/5]

template<class Container, class BlockLength>
template<typename NullValue>
ONIXS_ICEBOE_FORCEINLINE std::enable_if<!isComposite< typenameNullValue::Value >::value, SbeOptional< typenameNullValue::Value, NullValue > >::type ordinary ( BlockLength offset,
OptionalTag  ) const
inlineprotectednoexcept

Definition at line 92 of file SbeMessage.h.

93 {
94 return {ordinary<typename NullValue::Value>(offset)};
95 }

◆ ordinary() [3/5]

template<class Container, class BlockLength>
template<typename NullValue>
ONIXS_ICEBOE_FORCEINLINE std::enable_if< isComposite< typenameNullValue::Value >::value, SbeOptional< typenameNullValue::Value, NullValue > >::type ordinary ( BlockLength offset,
OptionalTag  ) const
inlineprotectednoexcept

Definition at line 113 of file SbeMessage.h.

114 {
115 using Value = typename NullValue::Value;
116
117 assert(container().blockLength() >= (offset + size<Value>()) && "The requested field exceeds provided block boundaries.");
118
119 using RetType = SbeOptional<Value, NullValue>;
120
121 const void* const location = advanceByBytes(container().block(), offset);
122 return makeFromTuple<RetType>(CompositeExtractor<Value::MemberTraits::Count>:: template extractAsTuple<Value>(location));
123 }

◆ ordinary() [4/5]

template<class Container, class BlockLength>
template<typename NullValue>
ONIXS_ICEBOE_FORCEINLINE std::enable_if<!isComposite< typenameNullValue::Value >::value, SbeOptional< typenameNullValue::Value, NullValue > >::type ordinary ( BlockLength offset,
SchemaVersion since,
OptionalTag  ) const
inlineprotectednoexcept

Definition at line 100 of file SbeMessage.h.

101 {
102 using Value = typename NullValue::Value;
103
104 if(since > container().version())
105 return SbeOptional<Value, NullValue>::null();
106
107 return {ordinary<Value>(offset)};
108 }

◆ ordinary() [5/5]

template<class Container, class BlockLength>
template<typename NullValue>
ONIXS_ICEBOE_FORCEINLINE std::enable_if< isComposite< typenameNullValue::Value >::value, SbeOptional< typenameNullValue::Value, NullValue > >::type ordinary ( BlockLength offset,
SchemaVersion since,
OptionalTag  ) const
inlineprotectednoexcept

Definition at line 128 of file SbeMessage.h.

129 {
130 using RetType = SbeOptional<typename NullValue::Value, NullValue>;
131
132 if(since > container().version())
133 return RetType::null();
134
135 return ordinary<NullValue>(offset, optional);
136 }