本文整理汇总了C++中buffer::Iterator类的典型用法代码示例。如果您正苦于以下问题:C++ Iterator类的具体用法?C++ Iterator怎么用?C++ Iterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Iterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
uint8_t
IeLinkMetricReport::DeserializeInformationField (Buffer::Iterator start, uint8_t length)
{
Buffer::Iterator i = start;
m_metric = i.ReadLsbtohU32 ();
return i.GetDistanceFrom (start);
}
示例2:
void
PeerLinkFrameStart::Serialize (Buffer::Iterator start) const
{
Buffer::Iterator i = start;
NS_ASSERT (m_subtype < 3);
i = m_protocol.Serialize (i);
if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
{
i.WriteHtolsbU16 (m_capability);
}
if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) == m_subtype)
{
i.WriteHtolsbU16 (m_aid);
}
if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
{
i = m_rates.Serialize (i);
i = m_rates.extended.Serialize (i);
}
if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype)
{
i = m_meshId.Serialize (i);
}
if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
{
i = m_config.Serialize (i);
}
else
{
i.WriteHtolsbU16 (m_reasonCode);
}
}
示例3: readDone
bool HTTPClientConnection::readDone() {
int rc;
while (true) {
Buffer::Iterator it = in_.begin();
Response* response = new Response;
rc = Parser::parseResponse(&it, response);
if (rc < 0) {
delete response;
LOG(LogMessage::ERROR) << "Error parsing response";
return false;
} else if (rc > 0) {
delete response;
return true;
} else /* rc == 0 */ {
in_.consume(it.bytesRead());
if (! handleResponse(response)) { // response ownership xfer
return false;
}
if (it.eob()) {
return true;
}
}
}
}
示例4:
void
UanHeaderRcCtsGlobal::Serialize (Buffer::Iterator start) const
{
start.WriteU16 (m_rateNum);
start.WriteU16 (m_retryRate);
start.WriteU32 ( (uint32_t)(m_timeStampTx.GetSeconds () * 1000.0 + 0.5));
start.WriteU32 ( (uint32_t)(m_winTime.GetSeconds () * 1000.0 + 0.5));
}
示例5: GetSerializedSize
uint32_t
RrepAckHeader::Deserialize (Buffer::Iterator start )
{
Buffer::Iterator i = start;
m_reserved = i.ReadU8 ();
uint32_t dist = i.GetDistanceFrom (start);
NS_ASSERT (dist == GetSerializedSize ());
return dist;
}
示例6: Seconds
uint32_t
UanHeaderRcData::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator rbuf = start;
m_frameNo = start.ReadU8 ();
m_propDelay = Seconds ( ((double) start.ReadU16 ()) / 1000.0 );
return rbuf.GetDistanceFrom (start);
}
示例7: WriteTo
void
RrepHeader::Serialize (Buffer::Iterator i) const
{
i.WriteU8 (m_flags);
i.WriteU8 (m_prefixSize);
i.WriteU8 (m_hopCount);
WriteTo (i, m_dst);
i.WriteHtonU32 (m_dstSeqNo);
WriteTo (i, m_origin);
i.WriteHtonU32 (m_lifeTime);
}
示例8: WriteTo
void
IePerr::SerializeInformationField (Buffer::Iterator i) const
{
i.WriteU8 (0);
i.WriteU8 (m_addressUnits.size ());
for (unsigned int j = 0; j < m_addressUnits.size (); j++)
{
WriteTo (i, m_addressUnits[j].destination);
i.WriteHtolsbU32 (m_addressUnits[j].seqnum);
}
}
示例9:
Buffer::Iterator
CapabilityInformation::Serialize (Buffer::Iterator start) const
{
NS_LOG_FUNCTION (this << &start);
start.WriteHtolsbU16 (m_capability);
return start;
}
示例10: ReadFrom
uint8_t
IePerr::DeserializeInformationField (Buffer::Iterator start, uint8_t length)
{
Buffer::Iterator i = start;
i.Next (1); //Mode flags is not used now
uint8_t numOfDest = i.ReadU8 ();
NS_ASSERT ((2 + 10 * numOfDest ) == length);
length = 0; //to avoid compiler warning in optimized builds
for (unsigned int j = 0; j < numOfDest; j++)
{
HwmpProtocol::FailedDestination unit;
ReadFrom (i, unit.destination);
unit.seqnum = i.ReadLsbtohU32 ();
m_addressUnits.push_back (unit);
}
return i.GetDistanceFrom (start);
}
示例11: readDone
bool HTTPServerConnection::readDone() {
int rc;
while (true) {
request_.clear();
Buffer::Iterator it = in_.begin();
rc = Parser::parseRequest(&it, &request_);
if (rc < 0) {
LOG(LogMessage::ERROR) << "Error parsing request";
return false;
} else if (rc > 0) {
return true;
} else /* rc == 0 */ {
in_.consume(it.bytesRead());
if (! handleRequest(&request_)) {
return false;
}
}
}
}
示例12: switch
uint32_t
TypeHeader::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
uint8_t type = i.ReadU8 ();
m_valid = true;
switch (type)
{
case AODVTYPE_RREQ:
case AODVTYPE_RREP:
case AODVTYPE_RERR:
case AODVTYPE_RREP_ACK:
{
m_type = (MessageType) type;
break;
}
default:
m_valid = false;
}
uint32_t dist = i.GetDistanceFrom (start);
NS_ASSERT (dist == GetSerializedSize ());
return dist;
}
示例13: UanAddress
uint32_t
UanHeaderRcCts::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator rbuf = start;
m_address = UanAddress (rbuf.ReadU8 ());
m_frameNo = rbuf.ReadU8 ();
m_retryNo = rbuf.ReadU8 ();
m_timeStampRts = Seconds ( ( (double) rbuf.ReadU32 ()) / 1000.0 );
m_delay = Seconds ( ( (double) rbuf.ReadU32 ()) / 1000.0 );
return rbuf.GetDistanceFrom (start);
}
示例14: ReadFrom
uint32_t
RrepHeader::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
m_flags = i.ReadU8 ();
m_prefixSize = i.ReadU8 ();
m_hopCount = i.ReadU8 ();
ReadFrom (i, m_dst);
m_dstSeqNo = i.ReadNtohU32 ();
ReadFrom (i, m_origin);
m_lifeTime = i.ReadNtohU32 ();
uint32_t dist = i.GetDistanceFrom (start);
NS_ASSERT (dist == GetSerializedSize ());
return dist;
}
示例15:
void
RrepAckHeader::Serialize (Buffer::Iterator i ) const
{
i.WriteU8 (m_reserved);
}