Bit deserializer. More...
#include "bit-deserializer.h"
Public Member Functions | |
BitDeserializer () | |
uint64_t | GetBits (uint8_t size) |
Pops a given number of bits from the blob front. | |
void | PushByte (uint8_t byte) |
Pushes one byte into the blob to be deserialized. | |
void | PushBytes (std::vector< uint8_t > bytes) |
Pushes some bytes into the blob to be deserialized. | |
void | PushBytes (uint8_t *bytes, uint32_t size) |
Pushes some bytes into the blob to be deserialized. | |
Private Member Functions | |
void | PrepareDeserialization () |
Prepare the byte array to the deserialization. | |
Private Attributes | |
std::deque< bool > | m_blob |
Blob of bits ready to be deserialized. | |
std::vector< uint8_t > | m_bytesBlob |
Blob of bytes to be deserialized. | |
bool | m_deserializing |
True if the deserialization did start already. | |
Bit deserializer.
See also
This class helps converting a variable number, variable sized number of bit-boundary fields stored as byte array representation and extract the original bit-fields.
Note that once the Deserialization starts, it's not anymore possible to add more data to the byte blob to deserialize.
Definition at line 32 of file bit-deserializer.h.
ns3::BitDeserializer::BitDeserializer | ( | ) |
Definition at line 21 of file bit-deserializer.cc.
References m_deserializing, and NS_LOG_FUNCTION.
uint64_t ns3::BitDeserializer::GetBits | ( | uint8_t | size | ) |
Pops a given number of bits from the blob front.
In other terms, 'size' bits are shifted from the contents of the byte blob onto the return value.
The maximum number of bits to be deserialized in one single call is 64.
size | The number of bits to pop. |
Definition at line 55 of file bit-deserializer.cc.
References m_blob, NS_ABORT_MSG_IF, NS_LOG_FUNCTION, and PrepareDeserialization().
Referenced by BitDeserializerTest::DoRun().
|
private |
Prepare the byte array to the deserialization.
Definition at line 74 of file bit-deserializer.cc.
References m_blob, m_bytesBlob, m_deserializing, and NS_LOG_FUNCTION.
Referenced by GetBits().
void ns3::BitDeserializer::PushByte | ( | uint8_t | byte | ) |
Pushes one byte into the blob to be deserialized.
byte | The byte to add. |
Definition at line 47 of file bit-deserializer.cc.
References m_bytesBlob, m_deserializing, NS_ABORT_MSG_IF, and NS_LOG_FUNCTION.
void ns3::BitDeserializer::PushBytes | ( | std::vector< uint8_t > | bytes | ) |
Pushes some bytes into the blob to be deserialized.
bytes | The bytes to add. |
Definition at line 28 of file bit-deserializer.cc.
References m_bytesBlob, m_deserializing, NS_ABORT_MSG_IF, and NS_LOG_FUNCTION.
Referenced by BitDeserializerTest::DoRun().
void ns3::BitDeserializer::PushBytes | ( | uint8_t * | bytes, |
uint32_t | size ) |
Pushes some bytes into the blob to be deserialized.
bytes | The bytes to add. |
size | The length of the array. |
Definition at line 36 of file bit-deserializer.cc.
References m_bytesBlob, m_deserializing, NS_ABORT_MSG_IF, and NS_LOG_FUNCTION.
|
private |
Blob of bits ready to be deserialized.
Definition at line 74 of file bit-deserializer.h.
Referenced by GetBits(), and PrepareDeserialization().
|
private |
Blob of bytes to be deserialized.
Definition at line 75 of file bit-deserializer.h.
Referenced by PrepareDeserialization(), PushByte(), PushBytes(), and PushBytes().
|
private |
True if the deserialization did start already.
Definition at line 76 of file bit-deserializer.h.
Referenced by BitDeserializer(), PrepareDeserialization(), PushByte(), PushBytes(), and PushBytes().