You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ns-3-...@googlegroups.com
Hye! I need help creating a new attribute of type std::set for a class created by me. How can I create an attribute like this? What's the easiest way to transmit a std::set as a parameter? Thank's in advance.
Konstantinos
unread,
May 27, 2015, 4:07:36 AM5/27/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ns-3-...@googlegroups.com, ns3.us...@gmail.com
Hi,
IMHO, the std::set is similar to the std::vector which has already been discussed in the list.
Now, when you refer to 'transmit' a set you mean in a packet? I do not know if this is the easiest, but this is the correct way: you need to iterate on each element of the set and write it onto the packet. You will also need one extra field in the packet to identify how many elements you need to read when you receive this packet.
ns3.us...@gmail.com
unread,
May 27, 2015, 4:46:37 AM5/27/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ns-3-...@googlegroups.com
Thank you for your answer, Konstantinos. Now I understand why it wasn't working..
I have pairs like: pair<Ipv4Adress, string> used to represent nodes (to associate the IP adress and a string name). With these pairs I create a set of pairs. I need to transmit the set in the helper constructor and therefor to install the helper on the created nodes so that they could process the set of pairs representing neighbour nodes. I will also need to send the set of pairs in the payload of the packets, although I don't know exactly how to do this..
Konstantinos
unread,
May 27, 2015, 5:39:43 AM5/27/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ns-3-...@googlegroups.com, ns3.us...@gmail.com
As I said, this issue is very similar to the 'std::vector'
The next is some guidelines/pseudocode:
Create your 'set';
Create your helper;
Set your 'set' in your helper; e.g. using the pass by reference.
Use the 'set' in the helper;
pdbarnes
unread,
May 27, 2015, 10:12:46 AM5/27/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ns-3-...@googlegroups.com
The only technical requirement to inventing a new Attribute type is that you can serialize/deserialize to/from a string. In principle a vector could be serialized as "value0|value1|..." assuming the elements themselves could be serialized. A set could be serialized the same way. The difficult bit will be the templates to serialize arbitrary elements.
> IMHO, the std::set is similar to the std::vector which has already been discussed