21 #include "ns3/assert.h"
45 NS_LOG_FUNCTION (
this << static_cast<uint32_t> (type) << &buffer << static_cast<uint32_t> (len));
50 : m_type (address.m_type),
105 std::memcpy (
m_data, buffer, len);
124 NS_LOG_FUNCTION (
this << static_cast<uint32_t> (type) << static_cast<uint32_t> (len));
141 static uint8_t type = 1;
150 return 1 + 1 +
m_len;
221 for (uint8_t i = 0; i < a.
GetLength (); i++)
237 os.setf (std::ios::hex, std::ios::basefield);
239 os << std::setw (2) << (uint32_t) address.
m_type <<
"-" << std::setw (2) << (uint32_t) address.
m_len <<
"-";
240 for (uint8_t i = 0; i < (address.
m_len-1); ++i)
242 os << std::setw (2) << (uint32_t)address.
m_data[i] <<
":";
245 os << std::setw (2) << (uint32_t) address.
m_data[address.
m_len-1];
246 os.setf (std::ios::dec, std::ios::basefield);
255 std::istringstream iss;
258 iss >> std::hex >> retval >> std::dec;
266 std::string::size_type firstDash, secondDash;
267 firstDash = v.find (
"-");
268 secondDash = v.find (
"-", firstDash+1);
269 std::string type = v.substr (0, firstDash-0);
270 std::string len = v.substr (firstDash+1, secondDash-(firstDash+1));
276 std::string::size_type col = secondDash + 1;
277 for (uint8_t i = 0; i < address.
m_len; ++i)
280 std::string::size_type next;
281 next = v.find (
":", col);
282 if (next == std::string::npos)
284 tmp = v.substr (col, v.size ()-col);
290 tmp = v.substr (col, next-col);
bool IsInvalid(void) const
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
void Write(const uint8_t *buffer, uint32_t size)
#define NS_LOG_FUNCTION(parameters)
bool IsMatchingType(uint8_t type) const
#define NS_ASSERT(condition)
bool operator<(const Room &a, const Room &b)
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
static uint8_t AsInt(std::string v)
Address()
Create an invalid address.
TAG_BUFFER_INLINE uint8_t ReadU8(void)
a polymophic address class
bool CheckCompatible(uint8_t type, uint8_t len) const
uint32_t CopyAllTo(uint8_t *buffer, uint8_t len) const
Address & operator=(const Address &address)
uint8_t GetLength(void) const
uint32_t CopyAllFrom(const uint8_t *buffer, uint8_t len)
void Deserialize(TagBuffer buffer)
uint32_t GetSerializedSize(void) const
Get the number of bytes needed to serialize the underlying Address Typically, this is GetLength () + ...
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
bool operator!=(Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > a, Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > b)
Inequality test.
uint32_t CopyFrom(const uint8_t *buffer, uint8_t len)
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
uint32_t CopyTo(uint8_t buffer[MAX_SIZE]) const
void Serialize(TagBuffer buffer) const
Serialize this address in host byte order to a byte buffer.
bool operator==(const EventId &a, const EventId &b)
void Read(uint8_t *buffer, uint32_t size)
ATTRIBUTE_HELPER_CPP(ObjectFactory)
NS_LOG_COMPONENT_DEFINE("Address")
static uint8_t Register(void)
Allocate a new type id for a new type of address.