Zserio C++17 runtime library  0.5.0
Built for Zserio 2.17.0
zserio::builtin Namespace Reference

Functions

uint8_t numBits (uint64_t numValues)
 
template<typename BITMASK1 , typename BITMASK2 >
bool isSet (BITMASK1 bitmaskValue, BITMASK2 requiredMask)
 
template<typename T , std::enable_if_t< std::is_enum_v< T >, int > = 0>
constexpr auto valueOf (T value)
 

Function Documentation

◆ isSet()

template<typename BITMASK1 , typename BITMASK2 >
bool zserio::builtin::isSet ( BITMASK1  bitmaskValue,
BITMASK2  requiredMask 
)

Checks whether the requiredMask is set within the bitmaskValue.

This method implements zserio built-in operator isset.

Parameters
bitmaskValueBitmask value to check.
requiredMaskMask to use.
Returns
True when the requiredMask is set within the bitmaskValue, false otherwise.

Definition at line 26 of file BuiltInOperators.h.

◆ numBits()

uint8_t zserio::builtin::numBits ( uint64_t  numValues)

Gets the minimum number of bits required to encode numValues different values.

This method implements Zserio built-in operator numbits.

Note: Please note that this method returns 0 if numValues is zero.

Examples: numbits(0) = 0 numbits(1) = 1 numbits(2) = 1 numbits(3) = 2 numbits(4) = 2 numbits(8) = 3 numbits(16) = 4

Parameters
numValuesThe number of different values from which to calculate number of bits.
Returns
Number of bis required to encode numValues different values.

Definition at line 9 of file BuiltInOperators.cpp.

◆ valueOf()

template<typename T , std::enable_if_t< std::is_enum_v< T >, int > = 0>
constexpr auto zserio::builtin::valueOf ( value)
constexpr

Gets the underlying numeric value of an enumeration.

Parameters
valueEnumeration item.
Returns
Underlying numeric value of the given enumeration item.

Gets the underlying numeric value of an bitmask.

Parameters
valueBitmask value.
Returns
Underlying numeric value of the given bitmask value.

Definition at line 61 of file BuiltInOperators.h.