[Ns-developers] Node names

craigdo@ee.washington.edu craigdo at ee.washington.edu
Fri May 16 10:36:01 PDT 2008


> > I think it's rather obvious how to use it,
> > node->SetName("AccessPoint");
> 
> How does this mesh with the helper API and NodeContainer ? Do 
> you expect
> users to call container.Get (i)->SetName () ?

I would expect exactly that.

If you think about how the helpers are used, there is typically a situation
where we make a bunch of identical nodes, but select one or more of those to
be made distinguished in some way.  In order to do the things you need to
make a node distinguished, you generally need to get the associated node
pointer and at least add it into another container.  It is also often the
case that it will be precisely these nodes that you are really interested
in.  In mixed-wireless.cc you can see a nice example of just such a
situation:

  NodeContainer backbone;
  backbone.Create (backboneNodes);

  ...

  NodeContainer newLanNodes;
  newLanNodes.Create (lanNodes - 1);
  NodeContainer lan (backbone.Get (i), newLanNodes);

If you want to assign a name, it means that instead of just the anonymous
backbone.Get above, we would see something like,

  NodeContainer backbone;
  backbone.Create (backboneNodes);

  ...

  NodeContainer newLanNodes;
  newLanNodes.Create (lanNodes - 1);
  Ptr<Node> n = backbone.Get (i);
  n->SetName ("my meaningful name")
  NodeContainer lan (n, newLanNodes);

-- Craig




More information about the Ns-developers mailing list