|
libdoip
0.1.0
DoIP (Diagnostics over Internet Protocol) ISO 13400 C++17 Library
|
Generic fixed-length identifier class template. More...
#include <DoIPIdentifiers.h>


Public Types | |
| using | value_type = uint8_t |
| using | size_type = size_t |
| using | difference_type = std::ptrdiff_t |
| using | reference = uint8_t & |
| using | const_reference = const uint8_t & |
| using | iterator = typename std::array< uint8_t, IdLength >::iterator |
| using | const_iterator = typename std::array< uint8_t, IdLength >::const_iterator |
Public Member Functions | |
| GenericFixedId () | |
| Default constructor - creates an identifier filled with zeros. More... | |
| GenericFixedId (const std::string &id_string) | |
| Construct from string. More... | |
| GenericFixedId (const char *id_cstr) | |
| Construct from C-style string. More... | |
| GenericFixedId (const uint8_t *data, size_t length) | |
| Construct from byte sequence. More... | |
| GenericFixedId (const ByteArray &byte_array) | |
| Construct from ByteArray. More... | |
| template<typename integral , typename = std::enable_if_t<std::is_integral_v<integral>>> | |
| GenericFixedId (integral id_value) | |
| Construct a new Generic Fixed Id object. More... | |
| GenericFixedId (const GenericFixedId &other)=default | |
| Copy constructor. More... | |
| GenericFixedId & | operator= (const GenericFixedId &other)=default |
| Copy assignment operator. More... | |
| GenericFixedId (GenericFixedId &&other) noexcept=default | |
| Move constructor. More... | |
| GenericFixedId & | operator= (GenericFixedId &&other) noexcept=default |
| Move assignment operator. More... | |
| ~GenericFixedId ()=default | |
| Destructor. More... | |
| std::string | toString () const |
| Get identifier as string. More... | |
| std::string | toHexString () const |
| Get identifier as hex string, bytes separated by '. More... | |
| ByteArrayRef | asByteArray () const |
| Get identifier as ByteArray with exactly IdLength bytes. More... | |
| const std::array< uint8_t, ID_LENGTH > & | getArray () const |
| Get direct access to the underlying array. More... | |
| const uint8_t * | data () const |
| Get pointer to raw data. More... | |
| ByteArray & | appendTo (ByteArray &bytes) const |
| Appends this identifier to the given byte array. More... | |
| constexpr size_t | size () const |
| Get the size (always IdLength) More... | |
| bool | isEmpty () const |
| Check if identifier is all zeros or all padding characters. More... | |
| bool | operator== (const GenericFixedId &other) const |
| Equality operator. More... | |
| bool | operator!= (const GenericFixedId &other) const |
| Inequality operator. More... | |
| const uint8_t & | operator[] (size_t index) const |
| Array subscript operator (const) More... | |
| constexpr char | getPadChar () |
| Get the char used to pad shorter identifiers. More... | |
| constexpr uint8_t | getPadByte () |
| Get the byte used to pad shorter identifiers. More... | |
| auto | begin () noexcept |
| Iterator support - begin. More... | |
| auto | begin () const noexcept |
| Iterator support - begin (const) More... | |
| auto | cbegin () const noexcept |
| Iterator support - cbegin. More... | |
| auto | end () noexcept |
| Iterator support - end. More... | |
| auto | end () const noexcept |
| Iterator support - end (const) More... | |
| auto | cend () const noexcept |
| Iterator support - cend. More... | |
Static Public Attributes | |
| static constexpr size_t | ID_LENGTH = IdLength |
| Length of the identifier in bytes. More... | |
| static const GenericFixedId | Zero {} |
| Static instance containing only zeros. More... | |
Generic fixed-length identifier class template.
| IdLength | The length of the identifier in bytes. |
| zeroPadding | Whether to use zero-padding (true) or character-padding (false). |
| padChar | The character to use for padding (default is null byte). |
Definition at line 22 of file DoIPIdentifiers.h.
| using doip::GenericFixedId< IdLength, zeroPadding, padChar >::const_iterator = typename std::array<uint8_t, IdLength>::const_iterator |
Definition at line 36 of file DoIPIdentifiers.h.
| using doip::GenericFixedId< IdLength, zeroPadding, padChar >::const_reference = const uint8_t& |
Definition at line 34 of file DoIPIdentifiers.h.
| using doip::GenericFixedId< IdLength, zeroPadding, padChar >::difference_type = std::ptrdiff_t |
Definition at line 32 of file DoIPIdentifiers.h.
| using doip::GenericFixedId< IdLength, zeroPadding, padChar >::iterator = typename std::array<uint8_t, IdLength>::iterator |
Definition at line 35 of file DoIPIdentifiers.h.
| using doip::GenericFixedId< IdLength, zeroPadding, padChar >::reference = uint8_t& |
Definition at line 33 of file DoIPIdentifiers.h.
| using doip::GenericFixedId< IdLength, zeroPadding, padChar >::size_type = size_t |
Definition at line 31 of file DoIPIdentifiers.h.
| using doip::GenericFixedId< IdLength, zeroPadding, padChar >::value_type = uint8_t |
Definition at line 30 of file DoIPIdentifiers.h.
|
inline |
Default constructor - creates an identifier filled with zeros.
Definition at line 41 of file DoIPIdentifiers.h.
|
inlineexplicit |
Construct from string.
| id_string | The identifier as string. If shorter than IdLength, padded with zeros. If longer, truncated. |
Definition at line 48 of file DoIPIdentifiers.h.
References doip::GenericFixedId< IdLength, zeroPadding, padChar >::ID_LENGTH.
|
inlineexplicit |
Construct from C-style string.
| id_cstr | The identifier as C-string. If shorter than IdLength, padded with zeros. If longer, truncated. |
Definition at line 59 of file DoIPIdentifiers.h.
References doip::GenericFixedId< IdLength, zeroPadding, padChar >::ID_LENGTH.
|
inline |
Construct from byte sequence.
| data | Pointer to byte data |
| length | Length of the byte data. If shorter than IdLength, padded with zeros. If longer, truncated. |
Definition at line 75 of file DoIPIdentifiers.h.
References doip::GenericFixedId< IdLength, zeroPadding, padChar >::data(), and doip::GenericFixedId< IdLength, zeroPadding, padChar >::ID_LENGTH.
|
inlineexplicit |
Construct from ByteArray.
| byte_array | The identifier as ByteArray. If shorter than IdLength, padded with zeros. If longer, truncated. |
Definition at line 90 of file DoIPIdentifiers.h.
References doip::GenericFixedId< IdLength, zeroPadding, padChar >::ID_LENGTH.
|
inlineexplicit |
Construct a new Generic Fixed Id object.
| integral | the integral type |
| id_value | the identifier value as integral type |
Definition at line 104 of file DoIPIdentifiers.h.
References doip::GenericFixedId< IdLength, zeroPadding, padChar >::ID_LENGTH.
|
default |
Copy constructor.
|
defaultnoexcept |
Move constructor.
|
default |
Destructor.
|
inline |
Appends this identifier to the given byte array.
| bytes | the byte array to append to |
Definition at line 207 of file DoIPIdentifiers.h.
|
inline |
Get identifier as ByteArray with exactly IdLength bytes.
Definition at line 179 of file DoIPIdentifiers.h.
References doip::GenericFixedId< IdLength, zeroPadding, padChar >::ID_LENGTH.
|
inlinenoexcept |
Iterator support - begin (const)
Definition at line 296 of file DoIPIdentifiers.h.
|
inlinenoexcept |
Iterator support - begin.
Definition at line 289 of file DoIPIdentifiers.h.
Referenced by doip::message::makeVehicleIdentificationResponse().
|
inlinenoexcept |
Iterator support - cbegin.
Definition at line 303 of file DoIPIdentifiers.h.
|
inlinenoexcept |
Iterator support - cend.
Definition at line 324 of file DoIPIdentifiers.h.
|
inline |
Get pointer to raw data.
Definition at line 197 of file DoIPIdentifiers.h.
Referenced by doip::GenericFixedId< IdLength, zeroPadding, padChar >::GenericFixedId().
|
inlinenoexcept |
Iterator support - end (const)
Definition at line 317 of file DoIPIdentifiers.h.
|
inlinenoexcept |
Iterator support - end.
Definition at line 310 of file DoIPIdentifiers.h.
Referenced by doip::message::makeVehicleIdentificationResponse().
|
inline |
Get direct access to the underlying array.
Definition at line 188 of file DoIPIdentifiers.h.
|
inlineconstexpr |
Get the byte used to pad shorter identifiers.
Definition at line 280 of file DoIPIdentifiers.h.
|
inlineconstexpr |
Get the char used to pad shorter identifiers.
Definition at line 271 of file DoIPIdentifiers.h.
|
inline |
Check if identifier is all zeros or all padding characters.
Definition at line 226 of file DoIPIdentifiers.h.
|
inline |
Inequality operator.
| other | The other identifier to compare with |
Definition at line 252 of file DoIPIdentifiers.h.
|
default |
Copy assignment operator.
|
defaultnoexcept |
Move assignment operator.
|
inline |
Equality operator.
| other | The other identifier to compare with |
Definition at line 242 of file DoIPIdentifiers.h.
|
inline |
Array subscript operator (const)
| index | Index (0 to IdLength-1) |
Definition at line 262 of file DoIPIdentifiers.h.
|
inlineconstexpr |
Get the size (always IdLength)
Definition at line 217 of file DoIPIdentifiers.h.
Referenced by doip::message::makeVehicleIdentificationResponse().
|
inline |
Get identifier as hex string, bytes separated by '.
'
Definition at line 162 of file DoIPIdentifiers.h.
References doip::GenericFixedId< IdLength, zeroPadding, padChar >::ID_LENGTH.
Referenced by doip::operator<<().
|
inline |
Get identifier as string.
Definition at line 145 of file DoIPIdentifiers.h.
References doip::GenericFixedId< IdLength, zeroPadding, padChar >::ID_LENGTH.
Referenced by doip::operator<<().
|
staticconstexpr |
Length of the identifier in bytes.
Definition at line 27 of file DoIPIdentifiers.h.
Referenced by doip::GenericFixedId< IdLength, zeroPadding, padChar >::asByteArray(), doip::GenericFixedId< IdLength, zeroPadding, padChar >::GenericFixedId(), doip::DoIPServer::setDefaultEid(), doip::GenericFixedId< IdLength, zeroPadding, padChar >::toHexString(), and doip::GenericFixedId< IdLength, zeroPadding, padChar >::toString().
|
inlinestatic |
Static instance containing only zeros.
Definition at line 329 of file DoIPIdentifiers.h.