A template class for TLV items (Tag / Length / Value).
More...
|
typedef LENGTH | Length |
| Redefinition of the length integer type. More...
|
|
typedef TAG | Tag |
| Redefinition of the tag integer type. More...
|
|
template<typename TAG, typename LENGTH, QtlByteBlock::ByteOrder ORDER>
class QtlTlv< TAG, LENGTH, ORDER >
A template class for TLV items (Tag / Length / Value).
- Template Parameters
-
TAG | An integer type representing tag fields. |
LENGTH | An integer type representing length fields. |
ORDER | Byte order to use for serialization. |
◆ Tag
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
typedef TAG QtlTlv< TAG, LENGTH, ORDER >::Tag |
Redefinition of the tag integer type.
◆ Length
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
Redefinition of the length integer type.
◆ QtlTlv() [1/2]
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
Default constructor.
- Parameters
-
[in] | tag | Tag value. |
[in] | value | Binary data. |
◆ QtlTlv() [2/2]
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
Copy constructor.
- Parameters
-
[in] | other | Other instance to copy. |
◆ operator=()
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
const QtlTlv& QtlTlv< TAG, LENGTH, ORDER >::operator= |
( |
const QtlTlv< TAG, LENGTH, ORDER > & |
other | ) |
|
|
inline |
Assignment operator.
- Parameters
-
[in] | other | Other instance to copy. |
- Returns
- A reference to this object.
◆ operator==()
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
bool QtlTlv< TAG, LENGTH, ORDER >::operator== |
( |
const QtlTlv< TAG, LENGTH, ORDER > & |
other | ) |
const |
|
inline |
Comparison operator.
- Parameters
-
[in] | other | Other instance to compare. |
- Returns
- True is the two objects are identical, false otherwise.
◆ operator!=()
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
bool QtlTlv< TAG, LENGTH, ORDER >::operator!= |
( |
const QtlTlv< TAG, LENGTH, ORDER > & |
other | ) |
const |
|
inline |
Comparison operator.
- Parameters
-
[in] | other | Other instance to compare. |
- Returns
- True is the two objects are different, false otherwise.
◆ tag()
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
TAG QtlTlv< TAG, LENGTH, ORDER >::tag |
( |
| ) |
const |
|
inline |
Get the tag.
- Returns
- The tag.
◆ setTag()
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
void QtlTlv< TAG, LENGTH, ORDER >::setTag |
( |
const TAG & |
tag | ) |
|
|
inline |
◆ value()
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
Get the binary value.
- Returns
- The binary value.
◆ valueSize()
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
int QtlTlv< TAG, LENGTH, ORDER >::valueSize |
( |
| ) |
const |
|
inline |
Get the size of binary value.
- Returns
- The size of binary value.
◆ setValue()
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
Set the binary value.
- Parameters
-
[in] | value | The binary value. |
◆ setIntValue()
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
template<typename INT >
void QtlTlv< TAG, LENGTH, ORDER >::setIntValue |
( |
const INT & |
value | ) |
|
|
inline |
Set the value as an integer.
The binary content is set according to the size of INT and the byte order of this instance.
- Template Parameters
-
INT | The integer type of the value. |
- Parameters
-
[in] | value | The integer value. |
◆ getIntValue() [1/2]
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
template<typename INT >
bool QtlTlv< TAG, LENGTH, ORDER >::getIntValue |
( |
INT & |
value | ) |
const |
|
inline |
Get the value as an integer.
The binary content is deserialized according to the size of INT and the byte order of this instance.
- Template Parameters
-
INT | The integer type of the value. |
- Parameters
-
[out] | value | The integer value. |
- Returns
- True if the binary content has the right size, false otherwise.
◆ getIntValue() [2/2]
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
template<typename INT >
INT QtlTlv< TAG, LENGTH, ORDER >::getIntValue |
( |
| ) |
const |
|
inline |
Get the value as an integer.
The binary content is deserialized according to the size of INT and the byte order of this instance.
- Template Parameters
-
INT | The integer type of the value. |
- Returns
- The integer value or zero if the binary content has the wrong size.
◆ appendTo()
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
Serialize the TLV at end of a given byte block.
- Parameters
-
[in,out] | data | The byte block to use. Its size is increased to include the TLV. |
◆ readAt()
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
bool QtlTlv< TAG, LENGTH, ORDER >::readAt |
( |
const QtlByteBlock & |
data, |
|
|
int & |
index, |
|
|
int |
end = -1 |
|
) |
| |
Deserialize the TLV from a given byte block.
- Parameters
-
[in] | data | The byte block to use. |
[in,out] | index | Index in the byte block where to read the TLV. If the TLV is correctly read, index is updated to point after the read TLV. |
[in] | end | Next index after last byte to read. If negative, use the end of byte block. |
- Returns
- True on success, false on error (incorrect data, block too short).
◆ intLengthMax()
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
static int QtlTlv< TAG, LENGTH, ORDER >::intLengthMax |
( |
| ) |
|
|
inlinestaticprivate |
Get the maximal value length as an int
type.
- Returns
- The maximal value length as an
int
type.
◆ lengthMax()
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
static LENGTH QtlTlv< TAG, LENGTH, ORDER >::lengthMax |
( |
| ) |
|
|
inlinestaticprivate |
Get the maximal value length as a LENGTH
type.
- Returns
- The maximal value length as a
LENGTH
type.
◆ ByteOrder
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
Redefinition of the byte order for this class.
◆ _tag
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
TAG QtlTlv< TAG, LENGTH, ORDER >::_tag |
|
private |
◆ _value
template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
The documentation for this class was generated from the following files: