jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
jau::TROOctets Class Reference

Transient read only and endian aware octet data, i.e. More...

#include <octets.hpp>

Inheritance diagram for jau::TROOctets:
Collaboration diagram for jau::TROOctets:

Public Member Functions

 TROOctets () noexcept
 Default constructor with nullptr memory, zero size and lb_endian::native byte order. More...
 
 TROOctets (const TROOctets &o) noexcept=default
 
 TROOctets (const uint8_t *source, const nsize_t len, const lb_endian_t byte_order_val) noexcept
 Transient passthrough read-only memory, w/o ownership . More...
 
 TROOctets (TROOctets &&o) noexcept=default
 
virtual ~TROOctets () noexcept=default
 
constexpr lb_endian_t byte_order () const noexcept
 Returns byte order of this octet store. More...
 
void check_range (const nsize_t i, const nsize_t count, const char *file, int line) const
 
EUI48 get_eui48 (const nsize_t i) const
 
EUI48 get_eui48_nc (const nsize_t i) const noexcept
 
int8_t get_int8 (const nsize_t i) const
 
constexpr int8_t get_int8_nc (const nsize_t i) const noexcept
 
constexpr uint8_t const * get_ptr () const noexcept
 
uint8_t const * get_ptr (const nsize_t i) const
 
constexpr uint8_t const * get_ptr_nc (const nsize_t i) const noexcept
 
std::string get_string (const nsize_t i) const
 Assumes a null terminated string. More...
 
std::string get_string (const nsize_t i, const nsize_t length) const
 Assumes a string with defined length, not necessarily null terminated. More...
 
std::string get_string_nc (const nsize_t i) const noexcept
 Assumes a null terminated string. More...
 
uint128dp_t get_uint128 (const nsize_t i) const
 
constexpr uint128dp_t get_uint128_nc (const nsize_t i) const noexcept
 
uint16_t get_uint16 (const nsize_t i) const
 
constexpr uint16_t get_uint16_nc (const nsize_t i) const noexcept
 
uint192dp_t get_uint192 (const nsize_t i) const
 
constexpr uint192dp_t get_uint192_nc (const nsize_t i) const noexcept
 
uint256dp_t get_uint256 (const nsize_t i) const
 
constexpr uint256dp_t get_uint256_nc (const nsize_t i) const noexcept
 
uint32_t get_uint32 (const nsize_t i) const
 
constexpr uint32_t get_uint32_nc (const nsize_t i) const noexcept
 
uint64_t get_uint64 (const nsize_t i) const
 
constexpr uint64_t get_uint64_nc (const nsize_t i) const noexcept
 
uint8_t get_uint8 (const nsize_t i) const
 
constexpr uint8_t get_uint8_nc (const nsize_t i) const noexcept
 
std::unique_ptr< const uuid_tget_uuid (const nsize_t i, const uuid_t::TypeSize tsize) const
 
uuid128_t get_uuid128 (const nsize_t i) const
 
uuid128_t get_uuid128_nc (const nsize_t i) const noexcept
 
uuid16_t get_uuid16 (const nsize_t i) const
 
uuid16_t get_uuid16_nc (const nsize_t i) const noexcept
 
constexpr bool is_range_valid (const nsize_t i, const nsize_t count) const noexcept
 
bool operator!= (const TROOctets &rhs) const noexcept
 
TROOctetsoperator= (const TROOctets &o) noexcept=default
 
TROOctetsoperator= (TROOctets &&o) noexcept=default
 
bool operator== (const TROOctets &rhs) const noexcept
 
constexpr nsize_t size () const noexcept
 Returns the used memory size for read and write operations, may be zero. More...
 
std::string toString () const noexcept
 

Protected Member Functions

constexpr uint8_t * data () noexcept
 
void setData (uint8_t *data_, nsize_t size_, const lb_endian_t byte_order) noexcept
 Internally sets the _size and _data fields after validation. More...
 
constexpr void setSize (nsize_t s) noexcept
 

Static Protected Member Functions

static void checkPtr (uint8_t *data_, nsize_t size_) noexcept
 Validates the given data_ and size_. More...
 

Detailed Description

Transient read only and endian aware octet data, i.e.

non persistent passthrough, owned by caller.

Endian byte order is passed at construction.

Constructor and assignment operations are noexcept. In case invalid arguments are passed, abort() is being called. This is a design choice based on reusing already existing underlying resources.

Definition at line 66 of file octets.hpp.

Constructor & Destructor Documentation

◆ TROOctets() [1/4]

jau::TROOctets::TROOctets ( const uint8_t *  source,
const nsize_t  len,
const lb_endian_t  byte_order_val 
)
inlinenoexcept

Transient passthrough read-only memory, w/o ownership .

Aborts if source is nullptr and len > 0.

Parameters
sourcea non nullptr memory, otherwise throws exception. Actual capacity known by owner.
lenreadable size of the memory, may be zero
byte_orderlb_endian::little or lb_endian::big byte order, one may pass lb_endian::native.

Definition at line 123 of file octets.hpp.

◆ TROOctets() [2/4]

jau::TROOctets::TROOctets ( )
inlinenoexcept

Default constructor with nullptr memory, zero size and lb_endian::native byte order.

Conveniently exists to allow instantiation of variables intended for later assignment.

Definition at line 136 of file octets.hpp.

◆ TROOctets() [3/4]

jau::TROOctets::TROOctets ( const TROOctets o)
defaultnoexcept

◆ TROOctets() [4/4]

jau::TROOctets::TROOctets ( TROOctets &&  o)
defaultnoexcept

◆ ~TROOctets()

virtual jau::TROOctets::~TROOctets ( )
virtualdefaultnoexcept

Member Function Documentation

◆ checkPtr()

static void jau::TROOctets::checkPtr ( uint8_t *  data_,
nsize_t  size_ 
)
inlinestaticprotectednoexcept

Validates the given data_ and size_.

Aborts if data_ is nullptr and size_ > 0.

Parameters
data_a memory pointer
size_claimed memory size

Definition at line 85 of file octets.hpp.

Here is the caller graph for this function:

◆ data()

constexpr uint8_t * jau::TROOctets::data ( )
inlineconstexprprotectednoexcept

Definition at line 92 of file octets.hpp.

Here is the caller graph for this function:

◆ setData()

void jau::TROOctets::setData ( uint8_t *  data_,
nsize_t  size_,
const lb_endian_t  byte_order 
)
inlineprotectednoexcept

Internally sets the _size and _data fields after validation.

Aborts if data_ is nullptr and size_ > 0.

Parameters
data_a memory pointer
size_used memory size
byte_orderlb_endian::little or lb_endian::big byte order, one may pass lb_endian::native.

Definition at line 103 of file octets.hpp.

Here is the caller graph for this function:

◆ setSize()

constexpr void jau::TROOctets::setSize ( nsize_t  s)
inlineconstexprprotectednoexcept

Definition at line 111 of file octets.hpp.

Here is the caller graph for this function:

◆ operator=() [1/2]

TROOctets & jau::TROOctets::operator= ( const TROOctets o)
defaultnoexcept

◆ operator=() [2/2]

TROOctets & jau::TROOctets::operator= ( TROOctets &&  o)
defaultnoexcept

◆ check_range()

void jau::TROOctets::check_range ( const nsize_t  i,
const nsize_t  count,
const char *  file,
int  line 
) const
inline

Definition at line 148 of file octets.hpp.

Here is the caller graph for this function:

◆ is_range_valid()

constexpr bool jau::TROOctets::is_range_valid ( const nsize_t  i,
const nsize_t  count 
) const
inlineconstexprnoexcept

Definition at line 154 of file octets.hpp.

◆ byte_order()

constexpr lb_endian_t jau::TROOctets::byte_order ( ) const
inlineconstexprnoexcept

Returns byte order of this octet store.

Definition at line 159 of file octets.hpp.

Here is the caller graph for this function:

◆ size()

constexpr nsize_t jau::TROOctets::size ( ) const
inlineconstexprnoexcept

Returns the used memory size for read and write operations, may be zero.

Definition at line 162 of file octets.hpp.

Here is the caller graph for this function:

◆ get_uint8()

uint8_t jau::TROOctets::get_uint8 ( const nsize_t  i) const
inline

Definition at line 164 of file octets.hpp.

Here is the caller graph for this function:

◆ get_uint8_nc()

constexpr uint8_t jau::TROOctets::get_uint8_nc ( const nsize_t  i) const
inlineconstexprnoexcept

Definition at line 168 of file octets.hpp.

Here is the caller graph for this function:

◆ get_int8()

int8_t jau::TROOctets::get_int8 ( const nsize_t  i) const
inline

Definition at line 172 of file octets.hpp.

◆ get_int8_nc()

constexpr int8_t jau::TROOctets::get_int8_nc ( const nsize_t  i) const
inlineconstexprnoexcept

Definition at line 176 of file octets.hpp.

◆ get_uint16()

uint16_t jau::TROOctets::get_uint16 ( const nsize_t  i) const
inline

Definition at line 180 of file octets.hpp.

Here is the caller graph for this function:

◆ get_uint16_nc()

constexpr uint16_t jau::TROOctets::get_uint16_nc ( const nsize_t  i) const
inlineconstexprnoexcept

Definition at line 184 of file octets.hpp.

Here is the caller graph for this function:

◆ get_uint32()

uint32_t jau::TROOctets::get_uint32 ( const nsize_t  i) const
inline

Definition at line 188 of file octets.hpp.

◆ get_uint32_nc()

constexpr uint32_t jau::TROOctets::get_uint32_nc ( const nsize_t  i) const
inlineconstexprnoexcept

Definition at line 192 of file octets.hpp.

◆ get_eui48()

EUI48 jau::TROOctets::get_eui48 ( const nsize_t  i) const
inline

Definition at line 196 of file octets.hpp.

◆ get_eui48_nc()

EUI48 jau::TROOctets::get_eui48_nc ( const nsize_t  i) const
inlinenoexcept

Definition at line 200 of file octets.hpp.

◆ get_uint64()

uint64_t jau::TROOctets::get_uint64 ( const nsize_t  i) const
inline

Definition at line 204 of file octets.hpp.

◆ get_uint64_nc()

constexpr uint64_t jau::TROOctets::get_uint64_nc ( const nsize_t  i) const
inlineconstexprnoexcept

Definition at line 208 of file octets.hpp.

◆ get_uint128()

uint128dp_t jau::TROOctets::get_uint128 ( const nsize_t  i) const
inline

Definition at line 212 of file octets.hpp.

◆ get_uint128_nc()

constexpr uint128dp_t jau::TROOctets::get_uint128_nc ( const nsize_t  i) const
inlineconstexprnoexcept

Definition at line 216 of file octets.hpp.

◆ get_uint192()

uint192dp_t jau::TROOctets::get_uint192 ( const nsize_t  i) const
inline

Definition at line 220 of file octets.hpp.

◆ get_uint192_nc()

constexpr uint192dp_t jau::TROOctets::get_uint192_nc ( const nsize_t  i) const
inlineconstexprnoexcept

Definition at line 224 of file octets.hpp.

◆ get_uint256()

uint256dp_t jau::TROOctets::get_uint256 ( const nsize_t  i) const
inline

Definition at line 228 of file octets.hpp.

◆ get_uint256_nc()

constexpr uint256dp_t jau::TROOctets::get_uint256_nc ( const nsize_t  i) const
inlineconstexprnoexcept

Definition at line 232 of file octets.hpp.

◆ get_string() [1/2]

std::string jau::TROOctets::get_string ( const nsize_t  i) const
inline

Assumes a null terminated string.

Definition at line 237 of file octets.hpp.

◆ get_string_nc()

std::string jau::TROOctets::get_string_nc ( const nsize_t  i) const
inlinenoexcept

Assumes a null terminated string.

Definition at line 242 of file octets.hpp.

◆ get_string() [2/2]

std::string jau::TROOctets::get_string ( const nsize_t  i,
const nsize_t  length 
) const
inline

Assumes a string with defined length, not necessarily null terminated.

Definition at line 247 of file octets.hpp.

◆ get_uuid16()

uuid16_t jau::TROOctets::get_uuid16 ( const nsize_t  i) const
inline

Definition at line 252 of file octets.hpp.

◆ get_uuid16_nc()

uuid16_t jau::TROOctets::get_uuid16_nc ( const nsize_t  i) const
inlinenoexcept

Definition at line 255 of file octets.hpp.

◆ get_uuid128()

uuid128_t jau::TROOctets::get_uuid128 ( const nsize_t  i) const
inline

Definition at line 259 of file octets.hpp.

◆ get_uuid128_nc()

uuid128_t jau::TROOctets::get_uuid128_nc ( const nsize_t  i) const
inlinenoexcept

Definition at line 263 of file octets.hpp.

◆ get_uuid()

std::unique_ptr< const uuid_t > jau::TROOctets::get_uuid ( const nsize_t  i,
const uuid_t::TypeSize  tsize 
) const
inline

Definition at line 267 of file octets.hpp.

◆ get_ptr() [1/2]

constexpr uint8_t const * jau::TROOctets::get_ptr ( ) const
inlineconstexprnoexcept

Definition at line 272 of file octets.hpp.

Here is the caller graph for this function:

◆ get_ptr() [2/2]

uint8_t const * jau::TROOctets::get_ptr ( const nsize_t  i) const
inline

Definition at line 273 of file octets.hpp.

◆ get_ptr_nc()

constexpr uint8_t const * jau::TROOctets::get_ptr_nc ( const nsize_t  i) const
inlineconstexprnoexcept

Definition at line 277 of file octets.hpp.

Here is the caller graph for this function:

◆ operator==()

bool jau::TROOctets::operator== ( const TROOctets rhs) const
inlinenoexcept

Definition at line 281 of file octets.hpp.

◆ operator!=()

bool jau::TROOctets::operator!= ( const TROOctets rhs) const
inlinenoexcept

Definition at line 284 of file octets.hpp.

◆ toString()

std::string jau::TROOctets::toString ( ) const
inlinenoexcept

Definition at line 288 of file octets.hpp.


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