QueryAttributesAndTraces
Jump to navigation
Jump to search
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;