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. More... | |
void | PushByte (uint8_t byte) |
Pushes one byte into the blob to be deserialized. More... | |
void | PushBytes (std::vector< uint8_t > bytes) |
Pushes some bytes into the blob to be deserialized. More... | |
void | PushBytes (uint8_t *bytes, uint32_t size) |
Pushes some bytes into the blob to be deserialized. More... | |
Private Member Functions | |
void | PrepareDeserialization () |
Prepare the byte array to the deserialization. More... | |
Private Attributes | |
std::deque< bool > | m_blob |
Blob of bits ready to be deserialized. More... | |
std::vector< uint8_t > | m_bytesBlob |
Blob of bytes to be deserialized. More... | |
bool | m_deserializing |
True if the deserialization did start already. More... | |
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 43 of file bit-deserializer.h.
ns3::BitDeserializer::BitDeserializer | ( | ) |
Definition at line 32 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 66 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 85 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 58 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 39 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 47 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 85 of file bit-deserializer.h.
Referenced by GetBits(), and PrepareDeserialization().
|
private |
Blob of bytes to be deserialized.
Definition at line 86 of file bit-deserializer.h.
Referenced by PrepareDeserialization(), PushByte(), and PushBytes().
|
private |
True if the deserialization did start already.
Definition at line 87 of file bit-deserializer.h.
Referenced by BitDeserializer(), PrepareDeserialization(), PushByte(), and PushBytes().