ObjectVectorValue??

278 views
Skip to first unread message

Mihal Brumbulli

unread,
Oct 27, 2009, 9:06:23 AM10/27/09
to ns-3-users
Hi,

I want to pass to my application a std::vector<Ptr<Node> > through
ObjectVectorValue. So, in my application I have:
.AddAttribute ("Nodes", "List of nodes.",
ObjectVectorValue(),
MakeObjectVectorAccessor(&MyApplication::m_nodes),
MakeObjectVectorChecker<Node>())

My question is: How can set this attribute in the simulation?

ps:
I have tried:
Ptr<MyApplication> myApp = CreateObject<MyApplication> ();
std::vector<Ptr<Node> > nodes;
myApp->SetAttribute("Nodes", ObjectVectorValue(nodes));
but it doesn't work.

Mathieu Lacage

unread,
Oct 27, 2009, 3:14:03 PM10/27/09
to ns-3-...@googlegroups.com

Attributes of type 'object vector' cannot be set. i.e., see
src/core/object-vector.cc ObjectVectorAccessor::HasSetter. Now, I have
to confess that I don't remember why this is so: it could just be that
I did not figure out how to make this work correctly or that there is
a fundamental reason why it can't work or that I merely was lazy. If
you could come up with an actual working implementation, I don't see
any reason offhand to refuse such a patch :)

Mathieu
--
Mathieu Lacage <mathieu...@gmail.com>

Mihal Brumbulli

unread,
Oct 27, 2009, 4:03:10 PM10/27/09
to ns-3-users
Thanks Mathieu,

Actually I had seen for myself from src/core/object-vector.cc that
actually it was not possible, but before trying to modify it I was
wondering if there was something I was missing. Anyway I will try to
come up with some solution to the problem.

Thanks again!

On Oct 27, 8:14 pm, Mathieu Lacage <mathieu.lac...@gmail.com> wrote:
> Mathieu Lacage <mathieu.lac...@gmail.com>
Reply all
Reply to author
Forward
0 new messages