QueryAttributesAndTraces: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(add Doxygen links, add table of contents) |
||
Line 1: | Line 1: | ||
{{TOC}} | |||
Particularly for non-standard objects, you may wish to query for the attributes and traces declared by the object. The associated <code>TypeId</code> object provides methods to get that information. An example is below, where <code>Sender</code> is a custom class defined in a user script. | Particularly for non-standard objects, you may wish to query for the attributes and traces declared by the object. The associated <code>TypeId</code> object provides methods to get that information. An example is below, where <code>Sender</code> is a custom class defined in a user script. | ||
Line 17: | Line 18: | ||
cout << endl; | cout << endl; | ||
</pre></code> | </pre></code> | ||
Note also that [http://www.nsnam.org/doxygen/group___trace_source_list.html Trace sources] and [http://www.nsnam.org/doxygen/group___attribute_list.html Attributes] are also automatically documented via Doxygen. | |||
[[Category:Samples]] | [[Category:Samples]] |
Latest revision as of 05:16, 28 May 2008
Main Page - Roadmap - Summer Projects - Project Ideas - Developer FAQ - Tools - Related Projects
HOWTOs - Installation - Troubleshooting - User FAQ - Samples - Models - Education - Contributed Code - Papers
Particularly for non-standard objects, you may wish to query for the attributes and traces declared by the object. The associated TypeId
object provides methods to get that information. An example is below, where Sender
is a custom class defined in a user script.
TypeId tid = Sender::GetTypeId();
cout << endl << "Attributes for Sender:" << endl;
uint32_t tidn = tid.GetAttributeN();
for (uint32_t tidcount = 0; tidcount < tidn; tidcount++) {
cout << " " << tid.GetAttributeFullName(tidcount) << " - " <<
tid.GetAttributeHelp(tidcount) << endl;
}
cout << endl << "Trace Sources for Sender:" << endl;
tidn = tid.GetTraceSourceN();
for (uint32_t tidcount = 0; tidcount < tidn; tidcount++) {
cout << " " << tid.GetTraceSourceName(tidcount) << " - " <<
tid.GetTraceSourceHelp(tidcount) << endl;
}
cout << endl;
Note also that Trace sources and Attributes are also automatically documented via Doxygen.