issue about WifiInformationElement::Serialize (buffer::iterator) const

25 views
Skip to first unread message

Le Tian

unread,
Aug 17, 2015, 11:41:25 AM8/17/15
to ns-3-users
Hi all,

I have a question about WifiInformationElement::Serialize (buffer::iterator) const function.

Buffer::Iterator

WifiInformationElement::Serialize (Buffer::Iterator i) const

{

  i.WriteU8 (ElementId ());

  i.WriteU8 (GetInformationFieldSize ());

  SerializeInformationField (i);

  i.Next (GetInformationFieldSize ());

  return i;

}


In my opinion, SerializeInformationField (i) in above definiton already update i, so is it necessary to update i again with i.Next (GetInformationFieldSize ())?


Kind regards

Le

Tommaso Pecorella

unread,
Aug 17, 2015, 12:12:57 PM8/17/15
to ns-3-users
Hi,

yes, it's necessary. SerializeInformationField will update its own private copy of the iterator, and the iterator of the calling function will be unaffected.
Basically, you need this trick (or you'd have to use pointers to iterators).

Have fun,

T.

Le Tian

unread,
Aug 18, 2015, 2:49:54 AM8/18/15
to ns-3-...@googlegroups.com
Hi Tommaso,

I understand, thanks a lot.

Kind regards
Le

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages