Zserio C++17 runtime library  0.5.0
Built for Zserio 2.17.0
zserio::Extended< T > Class Template Reference

#include <Extended.h>

Public Member Functions

 Extended (Extended &&other)=default
 
template<typename ALLOC >
 Extended (Extended &&other, const ALLOC &allocator)
 
 Extended (const Extended &other)=default
 
template<typename ALLOC >
 Extended (const Extended &other, const ALLOC &allocator)
 
template<typename... ARGS, typename = std::enable_if_t<!detail::is_single_type_v<Extended, ARGS...> && std::is_constructible_v<T, ARGS...>>>
constexpr Extended (ARGS &&... args)
 
Extendedoperator= (Extended &&other)=default
 
Extendedoperator= (const Extended &other)=default
 
 ~Extended ()=default
 
constexpr const T & value () const noexcept
 
T & value () noexcept
 
constexpr T & operator* () noexcept
 
constexpr const T & operator* () const noexcept
 
T * operator-> () noexcept
 
const T * operator-> () const noexcept
 
constexpr operator bool () const noexcept
 
bool isPresent () const noexcept
 
void setPresent (bool present) noexcept
 

Detailed Description

template<typename T>
class zserio::Extended< T >

Wrapper around an extended field (defined using 'extended' keyword in Zserio schema).

The value storage is always allocated, even though the field is not present. This allows to easily keep continuous allocation and the behaviour is the same as was in the old C++11 generator.

Definition at line 32 of file Extended.h.

Constructor & Destructor Documentation

◆ Extended() [1/5]

template<typename T >
zserio::Extended< T >::Extended ( Extended< T > &&  other)
default

◆ Extended() [2/5]

template<typename T >
template<typename ALLOC >
zserio::Extended< T >::Extended ( Extended< T > &&  other,
const ALLOC &  allocator 
)
inline

Definition at line 38 of file Extended.h.

◆ Extended() [3/5]

template<typename T >
zserio::Extended< T >::Extended ( const Extended< T > &  other)
default

◆ Extended() [4/5]

template<typename T >
template<typename ALLOC >
zserio::Extended< T >::Extended ( const Extended< T > &  other,
const ALLOC &  allocator 
)
inline

Definition at line 46 of file Extended.h.

◆ Extended() [5/5]

template<typename T >
template<typename... ARGS, typename = std::enable_if_t<!detail::is_single_type_v<Extended, ARGS...> && std::is_constructible_v<T, ARGS...>>>
constexpr zserio::Extended< T >::Extended ( ARGS &&...  args)
inlineexplicitconstexpr

In-place extended value constructor from T's arguments.

Definition at line 57 of file Extended.h.

◆ ~Extended()

template<typename T >
zserio::Extended< T >::~Extended ( )
default

Member Function Documentation

◆ isPresent()

template<typename T >
bool zserio::Extended< T >::isPresent ( ) const
inlinenoexcept

Gets whether the extended value is present.

Returns
True if the extended value is present, false otherwise.

Definition at line 141 of file Extended.h.

◆ operator bool()

template<typename T >
constexpr zserio::Extended< T >::operator bool ( ) const
inlineexplicitconstexprnoexcept

Explicit bool conversion operators - provided for convenience.

Returns
True if the extended value is present, false otherwise.

Definition at line 131 of file Extended.h.

◆ operator*() [1/2]

template<typename T >
constexpr const T& zserio::Extended< T >::operator* ( ) const
inlineconstexprnoexcept

Returns the extended value.

Returns
Reference to the constant extended value.

Definition at line 101 of file Extended.h.

◆ operator*() [2/2]

template<typename T >
constexpr T& zserio::Extended< T >::operator* ( )
inlineconstexprnoexcept

Returns the extended value.

Returns
Reference to stored value.

Definition at line 91 of file Extended.h.

◆ operator->() [1/2]

template<typename T >
const T* zserio::Extended< T >::operator-> ( ) const
inlinenoexcept

Returns the extended value.

Returns
Pointer to the constant extended value.

Definition at line 121 of file Extended.h.

◆ operator->() [2/2]

template<typename T >
T* zserio::Extended< T >::operator-> ( )
inlinenoexcept

Returns the extended value.

Returns
Pointer to the extended value.

Definition at line 111 of file Extended.h.

◆ operator=() [1/2]

template<typename T >
Extended& zserio::Extended< T >::operator= ( const Extended< T > &  other)
default

◆ operator=() [2/2]

template<typename T >
Extended& zserio::Extended< T >::operator= ( Extended< T > &&  other)
default

◆ setPresent()

template<typename T >
void zserio::Extended< T >::setPresent ( bool  present)
inlinenoexcept

Sets whether the extended value is present.

Note that setting of the presence manually can lead to an invalid zserio object, which will not pass the zserio::detail::validate step. This method is designed to be used by zserio::detail::read. If there is a strong need to modify the presence manually it must be ensured that:

  1. when this field is set to be present:
    • all previous extended fields in a compound type must be also present
  2. when this field is set to be missing:
    • all following extended fields in a compound type must be also missing
Parameters
presentTrue when the extended value is present, false otherwise.

Definition at line 159 of file Extended.h.

◆ value() [1/2]

template<typename T >
constexpr const T& zserio::Extended< T >::value ( ) const
inlineconstexprnoexcept

Const extended value getter.

Returns
Constant reference to the value.

Definition at line 71 of file Extended.h.

◆ value() [2/2]

template<typename T >
T& zserio::Extended< T >::value ( )
inlinenoexcept

Non-const extended value getter.

Returns
Reference to the extended value.

Definition at line 81 of file Extended.h.


The documentation for this class was generated from the following file: