| 
    sbepp
    
   | 
 
The main sbepp namespace.  
More...
Namespaces | |
| namespace | cursor_ops | 
| Contains cursor wrappers which allow more precise control over its position.  | |
| namespace | detail | 
| Namespace for various implementation details. Should not be used directly.  | |
Classes | |
| struct | byte_type | 
| Trait to get view's byte type.  More... | |
| class | char_opt_t | 
Built-in char optional type.  More... | |
| class | char_t | 
Built-in char required type.  More... | |
| class | composite_traits | 
Provides various traits/attributes of a <composite> element.  More... | |
| class | cursor | 
| Represents cursor which is used in cursor-based API. Clients should not use undocumented methods.  More... | |
| class | data_traits | 
Provides various traits/attributes of a <data> element.  More... | |
| struct | default_init_t | 
tag for dynamic_array_ref::resize(). Used to skip value initialization.  More... | |
| class | double_opt_t | 
Built-in double optional type.  More... | |
| class | double_t | 
Built-in double required type.  More... | |
| class | enum_traits | 
Provides various traits/attributes of an <enum> element.  More... | |
| class | enum_value_traits | 
Provides various traits/attributes of a <validValue> element.  More... | |
| class | field_traits | 
Provides various traits/attributes of a <field> element.  More... | |
| class | float_opt_t | 
Built-in float optional type.  More... | |
| class | float_t | 
Built-in float required type.  More... | |
| class | group_traits | 
Provides various traits/attributes of a <group> element.  More... | |
| class | int16_opt_t | 
Built-in int16 optional type.  More... | |
| class | int16_t | 
Built-in int16 required type.  More... | |
| class | int32_opt_t | 
Built-in int32 optional type.  More... | |
| class | int32_t | 
Built-in int32 required type.  More... | |
| class | int64_opt_t | 
Built-in int64 optional type.  More... | |
| class | int64_t | 
Built-in int64 required type.  More... | |
| class | int8_opt_t | 
Built-in int8 optional type.  More... | |
| class | int8_t | 
Built-in int8 required type.  More... | |
| struct | is_enum | 
Checks if T is an enumeration.  More... | |
| class | message_traits | 
Provides various traits/attributes of a <message> element.  More... | |
| struct | nullopt_t | 
| Tag type used to initialize optional types with null value.  More... | |
| class | schema_traits | 
Provides various traits/attributes of a <messageSchema> element.  More... | |
| class | set_choice_traits | 
Provides various traits/attributes of a <choice> element.  More... | |
| class | set_traits | 
Provides various traits/attributes of a <set> element.  More... | |
| struct | size_bytes_checked_result | 
Result type of size_bytes_checked  More... | |
| struct | traits_tag | 
| Maps representation type to its tag.  More... | |
| class | type_traits | 
Provides various traits and attributes of a <type> element.  More... | |
| class | uint16_opt_t | 
Built-in uint16 optional type.  More... | |
| class | uint16_t | 
Built-in uint16 required type.  More... | |
| class | uint32_opt_t | 
Built-in uint32 optional type.  More... | |
| class | uint32_t | 
Built-in uint32 required type.  More... | |
| class | uint64_opt_t | 
Built-in uint64 optional type.  More... | |
| class | uint64_t | 
Built-in uint64 required type.  More... | |
| class | uint8_opt_t | 
Built-in uint8 optional type.  More... | |
| class | uint8_t | 
Built-in uint8 required type.  More... | |
| struct | unknown_enum_value_tag | 
| Tag for unknown enum values.  More... | |
Concepts | |
| concept | array_type | 
Concept for sbepp::is_array_type<T>::value  | |
| concept | required_type | 
Concept for sbepp::is_required_type<T>::value  | |
| concept | optional_type | 
Concept for sbepp::is_optional_type<T>::value  | |
| concept | non_array_type | 
Concept for sbepp::is_non_array_type<T>::value  | |
| concept | type | 
Concept for sbepp::is_type<T>::value  | |
| concept | enumeration | 
Concept for sbepp::is_enum<T>::value  | |
| concept | set | 
Concept for sbepp::is_set<T>::value  | |
| concept | composite | 
Concept for sbepp::is_composite<T>::value  | |
| concept | message | 
Concept for sbepp::is_message<T>::value  | |
| concept | flat_group | 
Concept for sbepp::is_flat_group<T>::value  | |
| concept | nested_group | 
Concept for sbepp::is_nested_group<T>::value  | |
| concept | group | 
Concept for sbepp::is_group<T>::value  | |
| concept | data | 
Concept for sbepp::is_data<T>::value  | |
Typedefs | |
| using | length_t = std::uint64_t | 
Represents type_traits::length() value type.  | |
| using | offset_t = std::uint64_t | 
Represents offset trait value type, e.g. type_traits::offset()  | |
| using | version_t = std::uint64_t | 
Represents version trait value type, e.g. type_traits::since_version()  | |
| using | schema_id_t = std::uint32_t | 
Represents schema_traits::id() value type.  | |
| using | message_id_t = std::uint32_t | 
Represents message_traits::id() value type.  | |
| using | block_length_t = std::uint64_t | 
Represents block_length trait value type, e.g. message_traits::block_length()  | |
| using | member_id_t = std::uint16_t | 
Represents id trait value type, e.g. field_traits::id()  | |
| using | choice_index_t = std::uint8_t | 
Represents set_choice_traits::index() value type.  | |
| template<typename View > | |
| using | byte_type_t = typename byte_type<View>::type | 
Shortcut for byte_type<T>::type  | |
| template<typename ValueType > | |
| using | traits_tag_t = typename traits_tag<ValueType>::type | 
Shorthand for sbepp::traits_tag<T>::type  | |
| template<typename T > | |
| using | is_array_type = typename detail::is_array_type_impl<T>::type | 
Checks is T is an array type.  | |
| template<typename T > | |
| using | is_required_type = detail::is_base_of_tmp<detail::required_base, T> | 
Checks if T is a non-array required type.  | |
| template<typename T > | |
| using | is_optional_type = detail::is_base_of_tmp<detail::optional_base, T> | 
Checks if T is a non-array optional type.  | |
| template<typename T > | |
| using | is_non_array_type | 
Checks if T is a non-array type.  | |
| template<typename T > | |
| using | is_type | 
Checks if T is a type of any kind.  | |
| template<typename T > | |
| using | is_set = detail::is_base_of_tmp<detail::bitset_base, T> | 
Checks if T is a set.  | |
| template<typename T > | |
| using | is_composite = detail::is_base_of_tmp<detail::composite_base, T> | 
Checks if T is a composite.  | |
| template<typename T > | |
| using | is_message = detail::is_base_of_tmp<detail::message_base, T> | 
Checks if T is a message.  | |
| template<typename T > | |
| using | is_flat_group = detail::is_base_of_tmp<detail::flat_group_base, T> | 
Checks if T is a flat group.  | |
| template<typename T > | |
| using | is_nested_group = detail::is_base_of_tmp<detail::nested_group_base, T> | 
Checks if T is a nested group.  | |
| template<typename T > | |
| using | is_group | 
Checks if T is a group of any kind.  | |
| template<typename T > | |
| using | is_group_entry = detail::is_base_of_tmp<detail::entry_base, T> | 
Checks if T is a group entry.  | |
| template<typename T > | |
| using | is_data = typename detail::is_data_impl<T>::type | 
Checks if T is a data.  | |
Enumerations | |
| enum class | field_presence { required , optional , constant } | 
Represents presence trait value type, e.g. type_traits::presence()  More... | |
| enum class | endian { little , big , native } | 
Represents schema_traits::byte_order() value type. When SBEPP_HAS_ENDIAN is 1, it's just an alias to std::endian. Requires SBEPP_BYTE_ORDER to be defined if endianness is not detected automatically.  More... | |
| enum class | eos_null { none , single , all } | 
Represents number of null bytes that can be added after the end-of-string by detail::static_array_ref::assign_string()  More... | |
Functions | |
| void | assertion_failed (char const *expr, char const *function, char const *file, long line) | 
| When SBEPP_ASSERT_HANDLER or SBEPP_ENABLE_ASSERTS_WITH_HANDLER is defined, this function is called for failed assertions. Must be defined by the client.   | |
| template<typename T > | |
| constexpr std::size_t | size_bytes (T v) noexcept | 
| Returns the size of the underlying data represented by message/group/entry/data/composite view, including headers.   | |
| template<typename T , typename Byte > | |
| constexpr std::size_t | size_bytes (T v, cursor< Byte > c) noexcept | 
Similar to sbepp::size_bytes but has constant complexity because it expects c to be set at the end of v. Useful to read the whole message and then get its size in constant time. Not applicable to composites.   | |
| template<typename T > | |
| constexpr auto | get_header (T v) noexcept -> decltype(v(detail::get_header_tag{})) | 
| Returns the header of a message/group.   | |
| template<typename T > | |
| constexpr auto | addressof (T v) noexcept -> decltype(v(detail::addressof_tag{})) | 
| Returns pointer to the underlying data referenced by a view.   | |
| template<typename Enum > | |
| constexpr std::underlying_type< Enum >::type | to_underlying (Enum e) noexcept | 
Converts an enumeration to its underlying type. Equivalent to C++23 std::to_underlying()   | |
| template<typename View > | |
| constexpr cursor< byte_type_t< View > > | init_cursor (View view) noexcept | 
| Initializes cursor from a message/group view with the same byte type.   | |
| template<typename View > | |
| constexpr cursor< typename std::add_const< byte_type_t< View > >::type > | init_const_cursor (View view) noexcept | 
Initializes cursor from a message/group view with const byte type.   | |
| template<typename Message > | |
| constexpr auto | fill_message_header (Message m) noexcept -> decltype(m(detail::fill_message_header_tag{})) | 
| Fill message header.   | |
| template<typename Group , typename Size > | |
| constexpr auto | fill_group_header (Group g, Size num_in_group) noexcept -> decltype(g(detail::fill_group_header_tag{}, num_in_group)) | 
| Fill group header.   | |
| template<template< typename > class View, typename Byte > | |
| constexpr View< Byte > | make_view (Byte *ptr, const std::size_t size) noexcept | 
| Construct view from memory buffer.   | |
| template<template< typename > class View, typename Byte > | |
| constexpr View< typename std::add_const< Byte >::type > | make_const_view (Byte *ptr, const std::size_t size) noexcept | 
| Construct read-only view from memory buffer.   | |
| template<typename Visitor , typename View , typename Cursor , typename = detail::enable_if_t<detail::is_visitable_view<View>::value>> | |
| constexpr Visitor && | visit (View view, Cursor &c, Visitor &&visitor={}) | 
| Visit a view using given cursor.   | |
| template<typename Visitor , typename View , typename = detail::enable_if_t<detail::is_visitable_view<View>::value>> | |
| constexpr Visitor && | visit (View view, Visitor &&visitor={}) | 
| Visits a view.   | |
| template<typename Visitor , typename Set > | |
| constexpr Visitor && | visit (Set s, Visitor &&visitor={}) | 
| Visits set choices.   | |
| template<typename Visitor , typename Enum > | |
| constexpr Visitor && | visit (Enum e, Visitor &&visitor={}) | 
| Visits enum value.   | |
| template<typename Visitor , typename View , typename Cursor , typename = detail::enable_if_t<detail::is_visitable_view<View>::value>> | |
| constexpr Visitor && | visit_children (View view, Cursor &c, Visitor &&visitor={}) | 
| Visit view's children using provided cursor.   | |
| template<typename Visitor , typename View , typename = detail::enable_if_t<detail::is_visitable_view<View>::value>> | |
| constexpr Visitor && | visit_children (View view, Visitor &&visitor={}) | 
| Visit view's children.   | |
| template<typename E , typename = detail::enable_if_t<is_enum<E>::value>> | |
| constexpr const char * | enum_to_string (const E e) noexcept | 
| Converts enum to string.   | |
| template<typename Set , typename Visitor > | |
| constexpr auto | visit_set (const Set s, Visitor &&visitor) noexcept -> decltype(s(detail::visit_set_tag{}, std::forward< Visitor >(visitor))) | 
| Visits set choices in order of their declaration.   | |
| template<typename View > | |
| constexpr size_bytes_checked_result | size_bytes_checked (View view, std::size_t size) noexcept | 
Calculate view size with additional safety checks.   | |
Variables | |
| constexpr default_init_t | default_init {} | 
helper to pass default_init_t to dynamic_array_ref::resize().   | |
| constexpr nullopt_t | nullopt {0} | 
| Helper constant used to initialize optional types with null value.   | |
| template<typename T > | |
| constexpr auto | is_array_type_v = is_array_type<T>::value | 
Shorthand for sbepp::is_array_type<T>::value  | |
| template<typename T > | |
| constexpr auto | is_required_type_v = is_required_type<T>::value | 
Shorthand for sbepp::is_required_type<T>::value  | |
| template<typename T > | |
| constexpr auto | is_optional_type_v = is_optional_type<T>::value | 
Shorthand for sbepp::is_optional_type<T>::value  | |
| template<typename T > | |
| constexpr auto | is_non_array_type_v = is_non_array_type<T>::value | 
Shorthand for sbepp::is_non_array_type<T>::value  | |
| template<typename T > | |
| constexpr auto | is_type_v = is_type<T>::value | 
Shorthand for sbepp::is_type<T>::value  | |
| template<typename T > | |
| constexpr auto | is_enum_v = is_enum<T>::value | 
Shorthand for sbepp::is_enum<T>::value  | |
| template<typename T > | |
| constexpr auto | is_set_v = is_set<T>::value | 
Shorthand for sbepp::is_set<T>::value  | |
| template<typename T > | |
| constexpr auto | is_composite_v = is_composite<T>::value | 
Shorthand for sbepp::is_composite<T>::value  | |
| template<typename T > | |
| constexpr auto | is_message_v = is_message<T>::value | 
Shorthand for sbepp::is_message<T>::value  | |
| template<typename T > | |
| constexpr auto | is_flat_group_v = is_flat_group<T>::value | 
Shorthand for sbepp::is_flat_group<T>::value  | |
| template<typename T > | |
| constexpr auto | is_nested_group_v = is_nested_group<T>::value | 
Shorthand for sbepp::is_nested_group<T>::value  | |
| template<typename T > | |
| constexpr auto | is_group_v = is_group<T>::value | 
Shorthand for sbepp::is_group<T>::value  | |
| template<typename T > | |
| constexpr auto | is_data_v = is_data<T>::value | 
Shorthand for sbepp::is_data<T>::value  | |
The main sbepp namespace. 
      
  | 
  strong | 
Represents schema_traits::byte_order() value type. When SBEPP_HAS_ENDIAN is 1, it's just an alias to std::endian. Requires SBEPP_BYTE_ORDER to be defined if endianness is not detected automatically. 
| Enumerator | |
|---|---|
| little | little-endian  | 
| big | big-endian  | 
| native | current platform endianness  | 
      
  | 
  strong | 
Represents number of null bytes that can be added after the end-of-string by detail::static_array_ref::assign_string() 
      
  | 
  strong | 
Represents presence trait value type, e.g. type_traits::presence() 
| Enumerator | |
|---|---|
| required | field is required  | 
| optional | field is optional  | 
| constant | field is constant  | 
      
  | 
  constexprnoexcept | 
Returns pointer to the underlying data referenced by a view.
| v | view | 
| void sbepp::assertion_failed | ( | char const * | expr, | 
| char const * | function, | ||
| char const * | file, | ||
| long | line ) | 
When SBEPP_ASSERT_HANDLER or SBEPP_ENABLE_ASSERTS_WITH_HANDLER is defined, this function is called for failed assertions. Must be defined by the client.
| expr | expression that failed | 
| function | enclosing function name | 
| file | file name | 
| line | line number | 
      
  | 
  constexprnoexcept | 
Converts enum to string.
| e | enum to convert | 
nullptr if e holds unknown valuesbepp::visit, will be removed in the next major update. 
      
  | 
  constexprnoexcept | 
Fill group header.
Automatically fills these fields in group header:
blockLengthnumInGroupnumGroups (if exists in header)numVarDataFields (if exists in header)| g | group | 
| num_in_group | number if entries in group | 
      
  | 
  constexprnoexcept | 
Fill message header.
Automatically fills these fields in message header:
schemaIdtemplateIdversionblockLengthnumGroups (if exists in header)numVarDataFields (if exists in header)| m | message | 
      
  | 
  constexprnoexcept | 
Returns the header of a message/group.
| v | message/group view | 
      
  | 
  constexprnoexcept | 
Initializes cursor from a message/group view with const byte type. 
Example:
| view | message or group view | 
      
  | 
  constexprnoexcept | 
Initializes cursor from a message/group view with the same byte type.
Example:
| view | message or group view | 
      
  | 
  constexprnoexcept | 
Construct read-only view from memory buffer.
View's byte type will be a const-qualified buffer byte type. Example:
| View | view template | 
| Byte | byte type | 
| ptr | buffer start | 
| size | buffer size | 
      
  | 
  constexprnoexcept | 
Construct view from memory buffer.
View will have the same byte type as provided buffer. Example:
| View | view template | 
| Byte | byte type | 
| ptr | buffer start | 
| size | buffer size | 
      
  | 
  constexprnoexcept | 
Returns the size of the underlying data represented by message/group/entry/data/composite view, including headers.
In general case, for message/group/entry, the complexity is O(a^n) where n is the depth of the level. For composites and data it's O(1).
| v | view object | 
      
  | 
  constexprnoexcept | 
Similar to sbepp::size_bytes but has constant complexity because it expects c to be set at the end of v. Useful to read the whole message and then get its size in constant time. Not applicable to composites. 
| v | view object | 
| c | cursor | 
      
  | 
  constexprnoexcept | 
Calculate view size with additional safety checks. 
Similar to size_bytes() but stops if view cannot fit into the given size. Useful to check that incoming message is fully contained within given buffer.
| view | message or group view | 
| size | buffer size | 
      
  | 
  constexprnoexcept | 
Converts an enumeration to its underlying type. Equivalent to C++23 std::to_underlying() 
| e | enumerator | 
      
  | 
  constexpr | 
Visits enum value.
| Visitor | visitor type | 
| e | enum value to visit | 
| visitor | visitor instance, must have on_enum_value member function with the signature equivalent to void on_enum_value(Enum, EnumValueTag)  | 
visitorIf e is one of validValue-s from schema, calls visitor.on_enum_value(e, EnumValueTag{}) where EnumValueTag is a matched value's tag that can be passed to enum_value_traits. Otherwise, calls visitor.on_enum_value(e, sbepp::unknown_enum_value_tag{}).
      
  | 
  constexpr | 
Visits set choices.
| Visitor | visitor type | 
| s | set to visit | 
| visitor | visitor instance, must have on_set_choice member function with the signature equivalent to void on_set_choice(bool, ChoiceTag).  | 
visitorVisits set choices in order of their schema declaration. For each choice calls visitor.on_set_choice(choice_value, ChoiceTag{}), where choice_value is the bool value of a choice and ChoiceTag is its tag that can be passed to set_choice_traits.
      
  | 
  constexpr | 
Visit a view using given cursor.
| Visitor | visitor type | 
| view | message, group, entry or composite view | 
| c | cursor, passed as is to visitor  | 
| visitor | visitor | 
visitor
      
  | 
  constexpr | 
Visits a view.
| Visitor | visitor type | 
| view | message, group, entry or composite view | 
| visitor | visitor | 
visitor
      
  | 
  constexpr | 
Visit view's children using provided cursor.
| Visitor | visitor type | 
| view | message, group, entry or composite view | 
| c | cursor, ignored for composites, otherwise must point to the first view's child  | 
| visitor | visitor | 
visitor
      
  | 
  constexpr | 
Visit view's children.
| Visitor | visitor type | 
| view | message, group, entry or composite view | 
| visitor | visitor | 
visitor
      
  | 
  constexprnoexcept | 
Visits set choices in order of their declaration.
| s | set to visit | 
| visitor | visitor. Must have signature void (bool choice_value, const char* choice_name)  | 
visitorsbepp::visit, will be removed in the next major update. 
      
  | 
  inlineconstexpr | 
helper to pass default_init_t to dynamic_array_ref::resize(). 
Example: ref.resize(n, sbepp::default_init);. 
      
  | 
  inlineconstexpr | 
Helper constant used to initialize optional types with null value.
Example: msg.optionalField(sbepp::nullopt);