Config set default new attribute

43 views
Skip to first unread message

wirele...@gmail.com

unread,
Mar 14, 2017, 9:55:22 PM3/14/17
to ns-3-users
I am trying to set a default value for a value using attributes in GetTypeId however the attribute string changes but the integer accessor doesnt change. I ran config store to see what the value of the attribute name is and it is correct but the accessor didnt change. 
Thanks!! 

pdbarnes

unread,
Mar 15, 2017, 10:53:54 AM3/15/17
to ns-3-users
I don't understand your question. When you set a default value for an Attribute on a TypeId, that affects the initialization of new instances of that TypeId. The Accessor is just the mechanism which lets other objects read an Attribute by name.

If this comment doesn't help, please attach a short code snippet showing what you are doing.

Peter

Message has been deleted

wirele...@gmail.com

unread,
Mar 15, 2017, 3:17:39 PM3/15/17
to ns-3-users
static TypeId tid = TypeId ("ns3::Dcf")
    .SetParent<Object> ()
  .AddAttribute ("Aifsn", "The AIFSN: the default value conforms to simple DCA.",
                   UintegerValue (2),
                   MakeUintegerAccessor (&Dcf::SetAifsn,
                                         &Dcf::GetAifsn),
                   MakeUintegerChecker<uint32_t> ())

Thank you for taking the time to help me out. So In my main code I use config::set default the value of "Aifsn" and when I run config store I see the value has changed to what I set as default in my program. However, if I print out in dcf-manager the value of aifsn it is still the value without the config set default. I understand this attribute does not have a constructor could this be the issue why it isnt set? I want to do an if statement on the aifsn value in a function in the dcf-manager . Thank you 

pdbarnes

unread,
Mar 15, 2017, 4:18:17 PM3/15/17
to ns-3-users
Are you creating DcfManager after you set the new default?

Please Attach a complete example.

P

Reply all
Reply to author
Forward
0 new messages