HOWTO determine the path of an attribute or trace source

From Nsnam
Revision as of 16:52, 20 August 2009 by Nicolabaldo (Talk | contribs) (New page: ==Aggregated Objects== $-prefixed items in a path are used to perform an aggregation lookup using the TypeId of the Object you are looking for. Since almost all TypeIds have a ns3:: prefix...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Aggregated Objects

$-prefixed items in a path are used to perform an aggregation lookup using the TypeId of the Object you are looking for. Since almost all TypeIds have a ns3:: prefix, you will usually see the compound prefix $ns3::

Example:

/NodeList/*/$ns3::TcpL4Protocol

the above path works because ns3::TcpL4Protocol instances are aggregated to the node in which they exist. On the other hand see this one:

/NodeList/0/DeviceList/0/$ns3::WifiRemoteStationManager

the above path is getting device 0 in node 0, and, then, doing GetObject<WifiRemoteStationManager> on it but it gets null because the remote station manager is not aggregated to the device.


Objects referenced by attributes of other Objects

2) non-$ prefixed non-terminating items in a path are used to perform an attribute lookup on an attribute of type Pointer. This is often used as an alternative to object aggregation.

As an example, when using a wifi device:

/NodeList/0/DeviceList/0/RemoteStationManager/MacTxDataFailed

the above path works, because devices with TypeId ns3::WifiNetDevice have a RemoteStationManager attribute which is of type Ptr<WifiRemoteStationManager>. On the other hand, see this one:

/NodeList/0/TcpL4Protocol
the above path doesn't work,
/NodeList/0
gets you to a Node Object, and there is no Attribute named TcpL4Protocol. All this in spite of the fact that TcpL4Protocol is aggregated with Node -- remember that for querying aggregated objects you need the $ prefix.


Hint

A nice way to figure out a path is to use the ConfigStore: if you use it to dump all attributes in a text file, you can see a valid path for each attribute (this, arguably, does not work for trace sources).


References

http://groups.google.com/group/ns-3-users/browse_thread/thread/c162f5a8d13fe9d1/67b21278f7abf925?lnk=gst&q=config#67b21278f7abf925 http://mailman.isi.edu/pipermail/ns-developers/2009-August/006350.html