39 uint16_t AllocateUid (std::string name);
40 void SetParent (uint16_t uid, uint16_t parent);
41 void SetGroupName (uint16_t uid, std::string groupName);
43 void HideFromDocumentation (uint16_t uid);
44 uint16_t GetUid (std::string name)
const;
45 std::string GetName (uint16_t uid)
const;
46 uint16_t GetParent (uint16_t uid)
const;
47 std::string GetGroupName (uint16_t uid)
const;
49 bool HasConstructor (uint16_t uid)
const;
50 uint32_t GetRegisteredN (
void)
const;
51 uint16_t GetRegistered (uint32_t i)
const;
52 void AddAttribute (uint16_t uid,
59 void SetAttributeInitialValue(uint16_t uid,
62 uint32_t GetAttributeN (uint16_t uid)
const;
73 bool HasTraceSource (uint16_t uid, std::string name);
74 bool HasAttribute (uint16_t uid, std::string name);
83 std::vector<struct ns3::TypeId::AttributeInformation>
attributes;
84 std::vector<struct ns3::TypeId::TraceSourceInformation>
traceSources;
86 typedef std::vector<struct IidInformation>::const_iterator
Iterator;
93 IidManager::IidManager ()
99 IidManager::AllocateUid (std::string name)
103 for (
Iterator i = m_information.begin (); i != m_information.end (); i++)
107 NS_FATAL_ERROR (
"Trying to allocate twice the same uid: " << name);
113 information.
name = name;
118 m_information.push_back (information);
119 uint32_t uid = m_information.size ();
125 IidManager::LookupInformation (uint16_t uid)
const
128 NS_ASSERT (uid <= m_information.size () && uid != 0);
129 return const_cast<struct
IidInformation *
> (&m_information[uid-1]);
133 IidManager::SetParent (uint16_t uid, uint16_t parent)
136 NS_ASSERT (parent <= m_information.size ());
138 information->
parent = parent;
141 IidManager::SetGroupName (uint16_t uid, std::string groupName)
148 IidManager::HideFromDocumentation (uint16_t uid)
169 IidManager::GetUid (std::string name)
const
173 for (
Iterator i = m_information.begin (); i != m_information.end (); i++)
185 IidManager::GetName (uint16_t uid)
const
189 return information->
name;
192 IidManager::GetParent (uint16_t uid)
const
196 return information->
parent;
199 IidManager::GetGroupName (uint16_t uid)
const
207 IidManager::GetConstructor (uint16_t uid)
const
213 NS_FATAL_ERROR (
"Requested constructor for "<<information->
name<<
" but it does not have one.");
219 IidManager::HasConstructor (uint16_t uid)
const
227 IidManager::GetRegisteredN (
void)
const
230 return m_information.size ();
233 IidManager::GetRegistered (uint32_t i)
const
240 IidManager::HasAttribute (uint16_t uid,
247 for (std::vector<struct ns3::TypeId::AttributeInformation>::const_iterator i = information->
attributes.begin ();
256 if (parent == information)
262 information = parent;
268 IidManager::AddAttribute (uint16_t uid,
276 NS_LOG_FUNCTION (
this << uid << name << help << flags << initialValue << accessor << checker);
278 if (HasAttribute (uid, name))
280 NS_FATAL_ERROR (
"Attribute \"" << name <<
"\" already registered on tid=\"" <<
281 information->
name <<
"\"");
300 NS_ASSERT (i < information->attributes.size ());
301 information->
attributes[i].initialValue = initialValue;
307 IidManager::GetAttributeN (uint16_t uid)
const
318 NS_ASSERT (i < information->attributes.size ());
319 return information->attributes[i];
323 IidManager::HasTraceSource (uint16_t uid,
330 for (std::vector<struct ns3::TypeId::TraceSourceInformation>::const_iterator i = information->
traceSources.begin ();
339 if (parent == information)
345 information = parent;
351 IidManager::AddTraceSource (uint16_t uid,
358 if (HasTraceSource (uid, name))
360 NS_FATAL_ERROR (
"Trace source \"" << name <<
"\" already registered on tid=\"" <<
361 information->
name <<
"\"");
381 NS_ASSERT (i < information->traceSources.size ());
382 return information->traceSources[i];
385 IidManager::MustHideFromDocumentation (uint16_t uid)
const
419 NS_ASSERT_MSG (uid != 0,
"Assert in TypeId::LookupByName: " << name <<
" not found");
459 if (tmp.
name == name)
466 }
while (nextTid != tid);
496 return parent !=
m_tid;
503 while (tmp != other && tmp != tmp.
GetParent ())
507 return tmp == other && *
this != other;
530 return hasConstructor;
547 NS_LOG_FUNCTION (
this << name << help << &initialValue << accessor << checker);
560 NS_LOG_FUNCTION (
this << name << help << flags << &initialValue << accessor << checker);
655 if (info.
name == name)
661 }
while (nextTid != tid);
685 std::string tidString;
690 is.setstate (std::ios_base::badbit);