11#include "ns3/fatal-error.h"
36 : m_nixVector(
o.m_nixVector),
38 m_totalBitSize(
o.m_totalBitSize),
71 nix.DumpNixVector(os);
72 os <<
" (" <<
nix.GetRemainingBits() <<
" bits left)";
83 NS_FATAL_ERROR(
"Can't add more than 32 bits to a nix-vector at one time");
139 NS_FATAL_ERROR(
"Can't extract more than 32 bits to a nix-vector at one time");
148 NS_FATAL_ERROR(
"You've tried to extract too many bits of the Nix-vector, "
155 NS_FATAL_ERROR(
"You've specified a number of bits for Nix-vector <= 0!");
234 "NixVector minimum serialized length is " <<
sizeof(
m_totalBitSize) <<
" bytes");
253 "NixVector serialized length should have been " << 16 +
nixVectorLength
254 <<
" but buffer is shorter");
288 std::vector<uint32_t>::const_reverse_iterator
rIter;
Neighbor-index data structure for nix-vector routing.
void AddNeighborIndex(uint32_t newBits, uint32_t numberOfBits)
uint32_t m_used
For tracking where we are in the nix-vector.
uint32_t GetSerializedSize() const
uint32_t m_epoch
Epoch of the Nix-vector creation.
uint32_t GetRemainingBits() const
NixVector & operator=(const NixVector &o)
uint32_t m_totalBitSize
A counter of how total bits are in the nix-vector.
uint32_t Serialize(uint32_t *buffer, uint32_t maxSize) const
uint32_t ExtractNeighborIndex(uint32_t numberOfBits)
NixBits_t m_nixVector
the actual nix-vector
void SetEpoch(uint32_t epoch)
Set the NixVector Epoch.
void DumpNixVector(std::ostream &os) const
Print the NixVector.
uint32_t Deserialize(const uint32_t *buffer, uint32_t size)
Ptr< NixVector > Copy() const
uint32_t BitCount(uint32_t numberOfNeighbors) const
void PrintDec2BinNix(uint32_t decimalNum, uint32_t bitCount, std::ostream &os) const
Internal for pretty printing of nix-vector (no fill)
uint32_t GetEpoch() const
Get the NixVector Epoch.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
std::vector< uint32_t > NixBits_t
typedef for the nixVector