A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::BitDeserializer Class Reference

Bit deserializer. More...

#include "bit-deserializer.h"

+ Collaboration diagram for ns3::BitDeserializer:

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.
 

Detailed Description

Bit deserializer.

See also

See also
ns3::BitSerializer

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.

Constructor & Destructor Documentation

◆ BitDeserializer()

ns3::BitDeserializer::BitDeserializer ( )

Definition at line 21 of file bit-deserializer.cc.

References m_deserializing, and NS_LOG_FUNCTION.

Member Function Documentation

◆ GetBits()

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.

Parameters
sizeThe number of bits to pop.
Returns
The popped bits value

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrepareDeserialization()

void ns3::BitDeserializer::PrepareDeserialization ( )
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().

+ Here is the caller graph for this function:

◆ PushByte()

void ns3::BitDeserializer::PushByte ( uint8_t byte)

Pushes one byte into the blob to be deserialized.

Parameters
byteThe 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.

◆ PushBytes() [1/2]

void ns3::BitDeserializer::PushBytes ( std::vector< uint8_t > bytes)

Pushes some bytes into the blob to be deserialized.

Parameters
bytesThe 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().

+ Here is the caller graph for this function:

◆ PushBytes() [2/2]

void ns3::BitDeserializer::PushBytes ( uint8_t * bytes,
uint32_t size )

Pushes some bytes into the blob to be deserialized.

Parameters
bytesThe bytes to add.
sizeThe 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.

Member Data Documentation

◆ m_blob

std::deque<bool> ns3::BitDeserializer::m_blob
private

Blob of bits ready to be deserialized.

Definition at line 74 of file bit-deserializer.h.

Referenced by GetBits(), and PrepareDeserialization().

◆ m_bytesBlob

std::vector<uint8_t> ns3::BitDeserializer::m_bytesBlob
private

Blob of bytes to be deserialized.

Definition at line 75 of file bit-deserializer.h.

Referenced by PrepareDeserialization(), PushByte(), PushBytes(), and PushBytes().

◆ m_deserializing

bool ns3::BitDeserializer::m_deserializing
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().


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