A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
type-id.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8#include "type-id.h"
9
10#include "hash.h"
11#include "log.h" // NS_ASSERT and NS_LOG
12#include "singleton.h"
14
15#include <iomanip>
16#include <map>
17#include <sstream>
18#include <vector>
19
20/**
21 * \file
22 * \ingroup object
23 * ns3::TypeId and ns3::IidManager implementations.
24 */
25
26/*********************************************************************
27 * Helper code
28 *********************************************************************/
29
30namespace ns3
31{
32
34
35// IidManager needs to be in ns3 namespace for NS_ASSERT and NS_LOG
36// to find g_log
37
38/**
39 * \ingroup object
40 * \brief TypeId information manager
41 *
42 * Information records are stored in a vector. Name and hash lookup
43 * are performed by maps to the vector index.
44 *
45 * \internal
46 * <b>Hash Chaining</b>
47 *
48 * We require all types to produce distinct hashes. What if we encounter
49 * two types that produce the same hash value? As we move to a
50 * federated distribution model (the App store), it becomes increasingly
51 * likely that the core ns3 team *won't* discover this in test builds.
52 * Therefore, we need to handle this case explicitly.
53 *
54 * Note, we expect this to be *extremely* rare. As of this writing we
55 * have ~400 < 2^9 types, so the probability of getting a collision
56 * when we introduce a new type is ~2^9/2^31 = 2^-22, assuming we
57 * reserve 31 bits for the hash, and one bit for chaining. Even with
58 * double the number of types the probability of having a collision
59 * is only 2 x 10^-4. The probability for a three-fold collision is
60 * 1 x 10^-10.
61 *
62 * Therefore, we'll handle one collision explicitly by reserving
63 * the high order bit of the hash value, and assert on higher level
64 * collisions. The three-fold collision probability should be an
65 * acceptablly small error rate.
66 */
67class IidManager : public Singleton<IidManager>
68{
69 public:
70 /**
71 * Create a new unique type id.
72 * \param [in] name The name of this type id.
73 * \returns The id.
74 */
75 uint16_t AllocateUid(std::string name);
76 /**
77 * Add a deprecated name for the type id. Use of this name raises
78 * a runtime warning, and only one deprecated name is supported.
79 * \param [in] uid The id.
80 * \param [in] name The deprecated name.
81 */
82 void AddDeprecatedName(uint16_t uid, const std::string& name);
83 /**
84 * Set the parent of a type id.
85 * \param [in] uid The id.
86 * \param [in] parent The id of the parent.
87 */
88 void SetParent(uint16_t uid, uint16_t parent);
89 /**
90 * Set the group name of a type id.
91 * \param [in] uid The id.
92 * \param [in] groupName The group name.
93 */
94 void SetGroupName(uint16_t uid, std::string groupName);
95 /**
96 * Set the size of the object class referred to by this id.
97 * \param [in] uid The id.
98 * \param [in] size The object size.
99 */
100 void SetSize(uint16_t uid, std::size_t size);
101 /**
102 * Add a constructor Callback to this type id.
103 * \param [in] uid The id.
104 * \param [in] callback The Callback for the constructor.
105 */
106 void AddConstructor(uint16_t uid, Callback<ObjectBase*> callback);
107 /**
108 * Mark this type id to be excluded from documentation.
109 * \param [in] uid The id.
110 */
111 void HideFromDocumentation(uint16_t uid);
112 /**
113 * Get a type id by name.
114 * \param [in] name The type id to find.
115 * \returns The type id. A type id of 0 means \pname{name} wasn't found.
116 */
117 uint16_t GetUid(std::string name) const;
118 /**
119 * Get a type id by hash value.
120 * \param [in] hash The type id to find.
121 * \returns The type id. A type id of 0 means \pname{hash} wasn't found.
122 */
123 uint16_t GetUid(TypeId::hash_t hash) const;
124 /**
125 * Get the name of a type id.
126 * \param [in] uid The id.
127 * \returns The name of the type id.
128 */
129 std::string GetName(uint16_t uid) const;
130 /**
131 * Get the deprecated name of a type id.
132 * \param [in] uid The id.
133 * \returns The name of the type id.
134 */
135 std::string GetDeprecatedName(uint16_t uid) const;
136 /**
137 * Get the hash of a type id.
138 * \param [in] uid The id.
139 * \returns The hash of the type id.
140 */
141 TypeId::hash_t GetHash(uint16_t uid) const;
142 /**
143 * Get the parent of a type id.
144 * \param [in] uid The id.
145 * \returns The parent type id of the type id.
146 */
147 uint16_t GetParent(uint16_t uid) const;
148 /**
149 * Get the group name of a type id.
150 * \param [in] uid The id.
151 * \returns The group name of the type id.
152 */
153 std::string GetGroupName(uint16_t uid) const;
154 /**
155 * Get the size of a type id.
156 * \param [in] uid The id.
157 * \returns The size of the type id.
158 */
159 std::size_t GetSize(uint16_t uid) const;
160 /**
161 * Get the constructor Callback of a type id.
162 * \param [in] uid The id.
163 * \returns The constructor Callback of the type id.
164 */
165 Callback<ObjectBase*> GetConstructor(uint16_t uid) const;
166 /**
167 * Check if a type id has a constructor Callback.
168 * \param [in] uid The id.
169 * \returns \c true if the type id has a constructor Callback.
170 */
171 bool HasConstructor(uint16_t uid) const;
172 /**
173 * Get the total number of type ids.
174 * \returns The total number.
175 */
176 uint16_t GetRegisteredN() const;
177 /**
178 * Get a type id by index.
179 *
180 * The type id value 0 indicates not registered, so there is an offset
181 * of 1 between the index and the type id value. This function converts
182 * from an index to the type id value.
183 * \param [in] i The index.
184 * \returns The type id.
185 */
186 uint16_t GetRegistered(uint16_t i) const;
187 /**
188 * Record a new attribute in a type id.
189 * \param [in] uid The id.
190 * \param [in] name The name of the new attribute
191 * \param [in] help Some help text which describes the purpose of this
192 * attribute.
193 * \param [in] flags Flags which describe how this attribute can be
194 * read and/or written.
195 * \param [in] initialValue The initial value for this attribute.
196 * \param [in] accessor An instance of the associated AttributeAccessor
197 * subclass.
198 * \param [in] checker An instance of the associated AttributeChecker
199 * subclass.
200 * \param [in] supportLevel The support/deprecation status for this attribute.
201 * \param [in] supportMsg Upgrade hint if this attribute is no longer supported.
202 */
203 void AddAttribute(uint16_t uid,
204 std::string name,
205 std::string help,
206 uint32_t flags,
207 Ptr<const AttributeValue> initialValue,
211 const std::string& supportMsg = "");
212 /**
213 * Set the initial value of an Attribute.
214 * \param [in] uid The id.
215 * \param [in] i The attribute to manipulate
216 * \param [in] initialValue The new initial value to use for this attribute.
217 */
218 void SetAttributeInitialValue(uint16_t uid,
219 std::size_t i,
220 Ptr<const AttributeValue> initialValue);
221 /**
222 * Get the number of attributes.
223 * \param [in] uid The id.
224 * \returns The number of attributes associated to this TypeId
225 */
226 std::size_t GetAttributeN(uint16_t uid) const;
227 /**
228 * Get Attribute information by index.
229 * \param [in] uid The id.
230 * \param [in] i Index into attribute array
231 * \returns The information associated to attribute whose index is \pname{i}.
232 */
233 TypeId::AttributeInformation GetAttribute(uint16_t uid, std::size_t i) const;
234 /**
235 * Record a new TraceSource.
236 * \param [in] uid The id.
237 * \param [in] name The name of the new trace source
238 * \param [in] help Some help text which describes the purpose of this
239 * trace source.
240 * \param [in] accessor A pointer to a TraceSourceAccessor which can be
241 * used to connect/disconnect sinks to this trace source.
242 * \param [in] callback Fully qualified typedef name for the callback
243 * signature. Generally this should begin with the
244 * "ns3::" namespace qualifier.
245 * \param [in] supportLevel The support/deprecation status for this attribute.
246 * \param [in] supportMsg Upgrade hint if this attribute is no longer supported.
247 */
248 void AddTraceSource(uint16_t uid,
249 std::string name,
250 std::string help,
252 std::string callback,
254 const std::string& supportMsg = "");
255 /**
256 * Get the number of Trace sources.
257 * \param [in] uid The id.
258 * \returns The number of trace sources defined in this TypeId.
259 */
260 std::size_t GetTraceSourceN(uint16_t uid) const;
261 /**
262 * Get the trace source by index.
263 * \param [in] uid The id.
264 * \param [in] i Index into trace source array.
265 * \returns Detailed information about the requested trace source.
266 */
267 TypeId::TraceSourceInformation GetTraceSource(uint16_t uid, std::size_t i) const;
268 /**
269 * Check if this TypeId should not be listed in documentation.
270 * \param [in] uid The id.
271 * \returns \c true if this TypeId should be hidden from the user.
272 */
273 bool MustHideFromDocumentation(uint16_t uid) const;
274
275 private:
276 /**
277 * Check if a type id has a given TraceSource.
278 * \param [in] uid The id.
279 * \param [in] name The TraceSource name.
280 * \returns \c true if \pname{uid} has the TraceSource \pname{name}.
281 */
282 bool HasTraceSource(uint16_t uid, std::string name);
283 /**
284 * Check if a type id has a given Attribute.
285 * \param [in] uid The id.
286 * \param [in] name The Attribute name.
287 * \returns \c true if \pname{uid} has the Attribute \pname{name}.
288 */
289 bool HasAttribute(uint16_t uid, std::string name);
290 /**
291 * Hashing function.
292 * \param [in] name The type id name.
293 * \returns The hashed value of \pname{name}.
294 */
295 static TypeId::hash_t Hasher(const std::string name);
296
297 /** The information record about a single type id. */
299 {
300 /** The type id name. */
301 std::string name;
302 /** A deprecated type id name. */
303 std::string deprecatedName;
304 /** The type id hash value. */
306 /** The parent type id. */
307 uint16_t parent;
308 /** The group name. */
309 std::string groupName;
310 /** The size of the object represented by this type id. */
311 std::size_t size;
312 /** \c true if a constructor Callback has been registered. */
314 /** The constructor Callback. */
316 /** \c true if this type should be omitted from documentation. */
318 /** The container of Attributes. */
319 std::vector<TypeId::AttributeInformation> attributes;
320 /** The container of TraceSources. */
321 std::vector<TypeId::TraceSourceInformation> traceSources;
322 /** Support level/deprecation. */
324 /** Support message. */
325 std::string supportMsg;
326 };
327
328 /** Iterator type. */
329 typedef std::vector<IidInformation>::const_iterator Iterator;
330
331 /**
332 * Retrieve the information record for a type.
333 * \param [in] uid The id.
334 * \returns The information record.
335 */
337
338 /** The container of all type id records. */
339 std::vector<IidInformation> m_information;
340
341 /** Type of the by-name index. */
342 typedef std::map<std::string, uint16_t> namemap_t;
343 /** The by-name index. */
345
346 /** Type of the by-hash index. */
347 typedef std::map<TypeId::hash_t, uint16_t> hashmap_t;
348 /** The by-hash index. */
350
351 /** IidManager constants. */
352 enum
353 {
354 /**
355 * Hash chaining flag.
356 *
357 * To handle the first collision, we reserve the high bit as a
358 * chain flag.
359 */
360 HashChainFlag = 0x80000000
361 };
362};
363
364// static
366IidManager::Hasher(const std::string name)
367{
369 return hasher.clear().GetHash32(name);
370}
371
372/**
373 * \ingroup object
374 * \internal
375 * IidManager shorthand for use in NS_LOG
376 */
377#define IID "IidManager"
378/**
379 * \ingroup object
380 * \internal
381 * IidManager shorthand for use in NS_LOG
382 */
383#define IIDL IID << ": "
384
385uint16_t
386IidManager::AllocateUid(std::string name)
387{
388 NS_LOG_FUNCTION(IID << name);
389 // Type names are definitive: equal names are equal types
390 NS_ABORT_MSG_UNLESS(m_namemap.count(name) == 0,
391 "Trying to allocate twice the same uid: " << name);
392
393 TypeId::hash_t hash = Hasher(name) & (~HashChainFlag);
394 if (m_hashmap.count(hash) == 1)
395 {
396 NS_LOG_ERROR("Hash chaining TypeId for '"
397 << name << "'. "
398 << "This is not a bug, but is extremely unlikely. "
399 << "Please contact the ns3 developers.");
400 // ns3 developer contacted about this message:
401 // You have four options (in order of difficulty):
402 // 1. Let it ride, and play the odds that a third collision
403 // never appears.
404 // 2. Change the name of the new (or old) tag, even trivially, to
405 // remove the collision.
406 // 3. Switch to 64-bit hashes.
407 // 4. Implement 2-bit (or higher) chaining.
408 //
409 // Oh, by the way, I owe you a beer, since I bet Mathieu that
410 // this would never happen.. -- Peter Barnes, LLNL
411
412 NS_ASSERT_MSG(m_hashmap.count(hash | HashChainFlag) == 0,
413 "Triplicate hash detected while chaining TypeId for '"
414 << name << "'. Please contact the ns3 developers for assistance.");
415 // ns3 developer contacted about this message:
416 // You have three options: #2-4 above.
417 //
418 // Oh, by the way, I have no idea how this crazy hashing idea got
419 // into ns3. -- Peter Barnes, LLNL
420
421 // Alphabetize the two types, so it's deterministic
423 if (name > hinfo->name)
424 { // new type gets chained
425 NS_LOG_LOGIC(IIDL << "New TypeId '" << name << "' getting chained.");
426 hash = hash | HashChainFlag;
427 }
428 else
429 { // chain old type
430 NS_LOG_LOGIC(IIDL << "Old TypeId '" << hinfo->name << "' getting chained.");
431 uint16_t oldUid = GetUid(hinfo->hash);
432 m_hashmap.erase(m_hashmap.find(hinfo->hash));
433 hinfo->hash = hash | HashChainFlag;
434 m_hashmap.insert({hinfo->hash, oldUid});
435 // leave new hash unchained
436 }
437 }
438
439 IidInformation information;
440 information.name = name;
441 information.hash = hash;
442 information.parent = 0;
443 information.groupName = "";
444 information.size = (std::size_t)(-1);
445 information.hasConstructor = false;
446 information.mustHideFromDocumentation = false;
447 information.supportLevel = TypeId::SUPPORTED;
448 m_information.push_back(information);
449 std::size_t tuid = m_information.size();
450 NS_ASSERT(tuid <= 0xffff);
451 auto uid = static_cast<uint16_t>(tuid);
452
453 // Add to both maps:
454 m_namemap.insert({name, uid});
455 m_hashmap.insert({hash, uid});
456 NS_LOG_LOGIC(IIDL << uid);
457 return uid;
458}
459
462{
463 NS_LOG_FUNCTION(IID << uid);
464 NS_ASSERT_MSG(uid <= m_information.size() && uid != 0,
465 "The uid " << uid << " for this TypeId is invalid");
466 NS_LOG_LOGIC(IIDL << m_information[uid - 1].name);
467 return const_cast<IidInformation*>(&m_information[uid - 1]);
468}
469
470void
471IidManager::AddDeprecatedName(uint16_t uid, const std::string& name)
472{
473 NS_LOG_FUNCTION(IID << uid << name);
475 NS_ASSERT_MSG(info->deprecatedName.empty(),
476 "Deprecated name already added: " << info->deprecatedName);
477 const auto [it, success] = m_namemap.insert({name, uid});
478 NS_ASSERT_MSG(success,
479 "Deprecated name " << name << " insertion failed (possibly a duplicate?)");
480 info->deprecatedName = name;
481}
482
483void
484IidManager::SetParent(uint16_t uid, uint16_t parent)
485{
486 NS_LOG_FUNCTION(IID << uid << parent);
487 NS_ASSERT(parent <= m_information.size());
488 IidInformation* information = LookupInformation(uid);
489 information->parent = parent;
490}
491
492void
493IidManager::SetGroupName(uint16_t uid, std::string groupName)
494{
495 NS_LOG_FUNCTION(IID << uid << groupName);
496 IidInformation* information = LookupInformation(uid);
497 information->groupName = groupName;
498}
499
500void
501IidManager::SetSize(uint16_t uid, std::size_t size)
502{
503 NS_LOG_FUNCTION(IID << uid << size);
504 IidInformation* information = LookupInformation(uid);
505 information->size = size;
506}
507
508void
510{
511 NS_LOG_FUNCTION(IID << uid);
512 IidInformation* information = LookupInformation(uid);
513 information->mustHideFromDocumentation = true;
514}
515
516void
518{
519 NS_LOG_FUNCTION(IID << uid << &callback);
520 IidInformation* information = LookupInformation(uid);
521 if (information->hasConstructor)
522 {
523 NS_FATAL_ERROR(information->name << " already has a constructor.");
524 }
525 information->hasConstructor = true;
526 information->constructor = callback;
527}
528
529uint16_t
530IidManager::GetUid(std::string name) const
531{
532 NS_LOG_FUNCTION(IID << name);
533 uint16_t uid = 0;
534 auto it = m_namemap.find(name);
535 if (it != m_namemap.end())
536 {
537 uid = it->second;
538 }
539 NS_LOG_LOGIC(IIDL << uid);
540 return uid;
541}
542
543uint16_t
545{
546 NS_LOG_FUNCTION(IID << hash);
547 auto it = m_hashmap.find(hash);
548 uint16_t uid = 0;
549 if (it != m_hashmap.end())
550 {
551 uid = it->second;
552 }
553 NS_LOG_LOGIC(IIDL << uid);
554 return uid;
555}
556
557std::string
558IidManager::GetName(uint16_t uid) const
559{
560 NS_LOG_FUNCTION(IID << uid);
561 IidInformation* information = LookupInformation(uid);
562 NS_LOG_LOGIC(IIDL << information->name);
563 return information->name;
564}
565
566std::string
568{
569 NS_LOG_FUNCTION(IID << uid);
570 IidInformation* information = LookupInformation(uid);
571 NS_LOG_LOGIC(IIDL << information->deprecatedName);
572 return information->deprecatedName;
573}
574
576IidManager::GetHash(uint16_t uid) const
577{
578 NS_LOG_FUNCTION(IID << uid);
579 IidInformation* information = LookupInformation(uid);
580 TypeId::hash_t hash = information->hash;
581 NS_LOG_LOGIC(IIDL << hash);
582 return hash;
583}
584
585uint16_t
586IidManager::GetParent(uint16_t uid) const
587{
588 NS_LOG_FUNCTION(IID << uid);
589 IidInformation* information = LookupInformation(uid);
590 uint16_t pid = information->parent;
591 NS_LOG_LOGIC(IIDL << pid);
592 return pid;
593}
594
595std::string
596IidManager::GetGroupName(uint16_t uid) const
597{
598 NS_LOG_FUNCTION(IID << uid);
599 IidInformation* information = LookupInformation(uid);
600 NS_LOG_LOGIC(IIDL << information->groupName);
601 return information->groupName;
602}
603
604std::size_t
605IidManager::GetSize(uint16_t uid) const
606{
607 NS_LOG_FUNCTION(IID << uid);
608 IidInformation* information = LookupInformation(uid);
609 std::size_t size = information->size;
610 NS_LOG_LOGIC(IIDL << size);
611 return size;
612}
613
615IidManager::GetConstructor(uint16_t uid) const
616{
617 NS_LOG_FUNCTION(IID << uid);
618 IidInformation* information = LookupInformation(uid);
619 if (!information->hasConstructor)
620 {
621 NS_FATAL_ERROR("Requested constructor for " << information->name
622 << " but it does not have one.");
623 }
624 return information->constructor;
625}
626
627bool
628IidManager::HasConstructor(uint16_t uid) const
629{
630 NS_LOG_FUNCTION(IID << uid);
631 IidInformation* information = LookupInformation(uid);
632 bool hasC = information->hasConstructor;
633 NS_LOG_LOGIC(IIDL << hasC);
634 return hasC;
635}
636
637uint16_t
639{
641 return static_cast<uint16_t>(m_information.size());
642}
643
644uint16_t
646{
647 NS_LOG_FUNCTION(IID << i);
648 return i + 1;
649}
650
651bool
652IidManager::HasAttribute(uint16_t uid, std::string name)
653{
654 NS_LOG_FUNCTION(IID << uid << name);
655 IidInformation* information = LookupInformation(uid);
656 while (true)
657 {
658 for (auto i = information->attributes.begin(); i != information->attributes.end(); ++i)
659 {
660 if (i->name == name)
661 {
662 NS_LOG_LOGIC(IIDL << true);
663 return true;
664 }
665 }
666 IidInformation* parent = LookupInformation(information->parent);
667 if (parent == information)
668 {
669 // top of inheritance tree
670 NS_LOG_LOGIC(IIDL << false);
671 return false;
672 }
673 // check parent
674 information = parent;
675 }
676 NS_LOG_LOGIC(IIDL << false);
677 return false;
678}
679
680void
682 std::string name,
683 std::string help,
684 uint32_t flags,
685 Ptr<const AttributeValue> initialValue,
688 TypeId::SupportLevel supportLevel,
689 const std::string& supportMsg)
690{
691 NS_LOG_FUNCTION(IID << uid << name << help << flags << initialValue << accessor << checker
692 << supportLevel << supportMsg);
693 IidInformation* information = LookupInformation(uid);
694 if (name.find(' ') != std::string::npos)
695 {
696 NS_FATAL_ERROR("Attribute name \"" << name << "\" may not contain spaces ' ', "
697 << "encountered when registering TypeId \""
698 << information->name << "\"");
699 }
700 if (HasAttribute(uid, name))
701 {
702 NS_FATAL_ERROR("Attribute \"" << name << "\" already registered on tid=\""
703 << information->name << "\"");
704 }
706 info.name = name;
707 info.help = help;
708 info.flags = flags;
709 info.initialValue = initialValue;
710 info.originalInitialValue = initialValue;
711 info.accessor = accessor;
712 info.checker = checker;
713 info.supportLevel = supportLevel;
714 info.supportMsg = supportMsg;
715 information->attributes.push_back(info);
716 NS_LOG_LOGIC(IIDL << information->attributes.size() - 1);
717}
718
719void
721 std::size_t i,
722 Ptr<const AttributeValue> initialValue)
723{
724 NS_LOG_FUNCTION(IID << uid << i << initialValue);
725 IidInformation* information = LookupInformation(uid);
726 NS_ASSERT(i < information->attributes.size());
727 information->attributes[i].initialValue = initialValue;
728}
729
730std::size_t
731IidManager::GetAttributeN(uint16_t uid) const
732{
733 NS_LOG_FUNCTION(IID << uid);
734 IidInformation* information = LookupInformation(uid);
735 std::size_t size = information->attributes.size();
736 NS_LOG_LOGIC(IIDL << size);
737 return size;
738}
739
741IidManager::GetAttribute(uint16_t uid, std::size_t i) const
742{
743 NS_LOG_FUNCTION(IID << uid << i);
744 IidInformation* information = LookupInformation(uid);
745 NS_ASSERT(i < information->attributes.size());
746 NS_LOG_LOGIC(IIDL << information->name);
747 return information->attributes[i];
748}
749
750bool
751IidManager::HasTraceSource(uint16_t uid, std::string name)
752{
753 NS_LOG_FUNCTION(IID << uid << name);
754 IidInformation* information = LookupInformation(uid);
755 while (true)
756 {
757 for (auto i = information->traceSources.begin(); i != information->traceSources.end(); ++i)
758 {
759 if (i->name == name)
760 {
761 NS_LOG_LOGIC(IIDL << true);
762 return true;
763 }
764 }
765 IidInformation* parent = LookupInformation(information->parent);
766 if (parent == information)
767 {
768 // top of inheritance tree
769 NS_LOG_LOGIC(IIDL << false);
770 return false;
771 }
772 // check parent
773 information = parent;
774 }
775 NS_LOG_LOGIC(IIDL << false);
776 return false;
777}
778
779void
781 std::string name,
782 std::string help,
784 std::string callback,
785 TypeId::SupportLevel supportLevel,
786 const std::string& supportMsg)
787{
788 NS_LOG_FUNCTION(IID << uid << name << help << accessor << callback << supportLevel
789 << supportMsg);
790 IidInformation* information = LookupInformation(uid);
791 if (HasTraceSource(uid, name))
792 {
793 NS_FATAL_ERROR("Trace source \"" << name << "\" already registered on tid=\""
794 << information->name << "\"");
795 }
797 source.name = name;
798 source.help = help;
799 source.accessor = accessor;
800 source.callback = callback;
801 source.supportLevel = supportLevel;
802 source.supportMsg = supportMsg;
803 information->traceSources.push_back(source);
804 NS_LOG_LOGIC(IIDL << information->traceSources.size() - 1);
805}
806
807std::size_t
809{
810 NS_LOG_FUNCTION(IID << uid);
811 IidInformation* information = LookupInformation(uid);
812 std::size_t size = information->traceSources.size();
813 NS_LOG_LOGIC(IIDL << size);
814 return size;
815}
816
818IidManager::GetTraceSource(uint16_t uid, std::size_t i) const
819{
820 NS_LOG_FUNCTION(IID << uid << i);
821 IidInformation* information = LookupInformation(uid);
822 NS_ASSERT(i < information->traceSources.size());
823 NS_LOG_LOGIC(IIDL << information->name);
824 return information->traceSources[i];
825}
826
827bool
829{
830 NS_LOG_FUNCTION(IID << uid);
831 IidInformation* information = LookupInformation(uid);
832 bool hide = information->mustHideFromDocumentation;
833 NS_LOG_LOGIC(IIDL << hide);
834 return hide;
835}
836
837} // namespace ns3
838
839namespace ns3
840{
841
842/*********************************************************************
843 * The TypeId class
844 *********************************************************************/
845
846TypeId::TypeId(const std::string& name)
847{
848 NS_LOG_FUNCTION(this << name);
849 uint16_t uid = IidManager::Get()->AllocateUid(name);
850 NS_LOG_LOGIC(uid);
851 NS_ASSERT(uid != 0);
852 m_tid = uid;
853}
854
855TypeId::TypeId(uint16_t tid)
856 : m_tid(tid)
857{
858 NS_LOG_FUNCTION(this << tid);
859}
860
861TypeId
862TypeId::AddDeprecatedName(const std::string& name)
863{
864 NS_LOG_FUNCTION(this << name);
866 NS_LOG_INFO("Set deprecated name " << name << " for TypeId "
868 return *this;
869}
870
871TypeId
872TypeId::LookupByName(std::string name)
873{
874 NS_LOG_FUNCTION(name);
875 uint16_t uid = IidManager::Get()->GetUid(name);
876 NS_ASSERT_MSG(uid, "Assert in TypeId::LookupByName: " << name << " not found");
877 if (IidManager::Get()->GetDeprecatedName(uid) == name)
878 {
879 std::cerr << "Deprecation warning for name " << name << "; use "
880 << IidManager::Get()->GetName(uid) << " instead" << std::endl;
881 }
882 return TypeId(uid);
883}
884
885bool
887{
888 NS_LOG_FUNCTION(name << tid->GetUid());
889 uint16_t uid = IidManager::Get()->GetUid(name);
890 if (uid == 0)
891 {
892 return false;
893 }
894 *tid = TypeId(uid);
895 if (IidManager::Get()->GetDeprecatedName(uid) == name)
896 {
897 std::cerr << "Deprecation warning for name " << name << "; use "
898 << IidManager::Get()->GetName(uid) << " instead" << std::endl;
899 }
900 return true;
901}
902
903TypeId
905{
906 uint16_t uid = IidManager::Get()->GetUid(hash);
907 NS_ASSERT_MSG(uid != 0,
908 "Assert in TypeId::LookupByHash: 0x" << std::hex << hash << std::dec
909 << " not found");
910 return TypeId(uid);
911}
912
913bool
915{
916 uint16_t uid = IidManager::Get()->GetUid(hash);
917 if (uid == 0)
918 {
919 return false;
920 }
921 *tid = TypeId(uid);
922 return true;
923}
924
925uint16_t
931
932TypeId
934{
937}
938
939std::tuple<bool, TypeId, TypeId::AttributeInformation>
940TypeId::FindAttribute(const TypeId& tid, const std::string& name)
941{
942 TypeId currentTid = tid;
943 TypeId parentTid;
944 while (true)
945 {
946 for (std::size_t i = 0; i < currentTid.GetAttributeN(); ++i)
947 {
948 const AttributeInformation& attributeInfo = currentTid.GetAttribute(i);
949 if (attributeInfo.name == name)
950 {
951 return {true, currentTid, attributeInfo};
952 }
953 }
954
955 parentTid = currentTid.GetParent();
956
957 if (parentTid == currentTid)
958 {
959 break;
960 }
961
962 currentTid = parentTid;
963 }
964 return {false, TypeId(), AttributeInformation()};
965}
966
967bool
970 bool permissive) const
971{
972 NS_LOG_FUNCTION(this << name << info);
973 auto [found, tid, attribute] = FindAttribute(*this, name);
974 if (found)
975 {
976 if (attribute.supportLevel == TypeId::SUPPORTED)
977 {
978 *info = attribute;
979 return true;
980 }
981 else if (attribute.supportLevel == TypeId::DEPRECATED)
982 {
983 if (!permissive)
984 {
985 std::cerr << "Attribute '" << name << "' is deprecated: " << attribute.supportMsg
986 << std::endl;
987 }
988 *info = attribute;
989 return true;
990 }
991 else if (attribute.supportLevel == TypeId::OBSOLETE)
992 {
993 NS_FATAL_ERROR("Attribute '"
994 << name << "' is obsolete, with no fallback: " << attribute.supportMsg);
995 }
996 }
997 return false;
998}
999
1000TypeId
1002{
1003 NS_LOG_FUNCTION(this << tid.GetUid());
1005 return *this;
1006}
1007
1008TypeId
1009TypeId::SetGroupName(std::string groupName)
1010{
1011 NS_LOG_FUNCTION(this << groupName);
1012 IidManager::Get()->SetGroupName(m_tid, groupName);
1013 return *this;
1014}
1015
1016TypeId
1017TypeId::SetSize(std::size_t size)
1018{
1019 NS_LOG_FUNCTION(this << size);
1020 IidManager::Get()->SetSize(m_tid, size);
1021 return *this;
1022}
1023
1024TypeId
1026{
1027 NS_LOG_FUNCTION(this);
1028 uint16_t parent = IidManager::Get()->GetParent(m_tid);
1029 return TypeId(parent);
1030}
1031
1032bool
1034{
1035 NS_LOG_FUNCTION(this);
1036 uint16_t parent = IidManager::Get()->GetParent(m_tid);
1037 return parent != m_tid;
1038}
1039
1040bool
1042{
1043 NS_LOG_FUNCTION(this << other.GetUid());
1044 TypeId tmp = *this;
1045 while (tmp != other && tmp != tmp.GetParent())
1046 {
1047 tmp = tmp.GetParent();
1048 }
1049 return tmp == other && *this != other;
1050}
1051
1052std::string
1054{
1055 NS_LOG_FUNCTION(this);
1056 std::string groupName = IidManager::Get()->GetGroupName(m_tid);
1057 return groupName;
1058}
1059
1060std::string
1062{
1063 NS_LOG_FUNCTION(this);
1064 std::string name = IidManager::Get()->GetName(m_tid);
1065 return name;
1066}
1067
1070{
1072 return hash;
1073}
1074
1075std::size_t
1077{
1078 NS_LOG_FUNCTION(this);
1079 std::size_t size = IidManager::Get()->GetSize(m_tid);
1080 return size;
1081}
1082
1083bool
1085{
1086 NS_LOG_FUNCTION(this);
1087 bool hasConstructor = IidManager::Get()->HasConstructor(m_tid);
1088 return hasConstructor;
1089}
1090
1091void
1097
1098TypeId
1099TypeId::AddAttribute(std::string name,
1100 std::string help,
1101 const AttributeValue& initialValue,
1104 SupportLevel supportLevel,
1105 const std::string& supportMsg)
1106{
1107 NS_LOG_FUNCTION(this << name << help << &initialValue << accessor << checker << supportLevel
1108 << supportMsg);
1110 name,
1111 help,
1112 ATTR_SGC,
1113 initialValue.Copy(),
1114 accessor,
1115 checker,
1116 supportLevel,
1117 supportMsg);
1118 return *this;
1119}
1120
1121TypeId
1122TypeId::AddAttribute(std::string name,
1123 std::string help,
1124 uint32_t flags,
1125 const AttributeValue& initialValue,
1128 SupportLevel supportLevel,
1129 const std::string& supportMsg)
1130{
1131 NS_LOG_FUNCTION(this << name << help << flags << &initialValue << accessor << checker
1132 << supportLevel << supportMsg);
1134 name,
1135 help,
1136 flags,
1137 initialValue.Copy(),
1138 accessor,
1139 checker,
1140 supportLevel,
1141 supportMsg);
1142 return *this;
1143}
1144
1145bool
1147{
1148 NS_LOG_FUNCTION(this << i << initialValue);
1149 IidManager::Get()->SetAttributeInitialValue(m_tid, i, initialValue);
1150 return true;
1151}
1152
1155{
1156 NS_LOG_FUNCTION(this);
1158 return cb;
1159}
1160
1161bool
1163{
1164 NS_LOG_FUNCTION(this);
1166 return mustHide;
1167}
1168
1169std::size_t
1171{
1172 NS_LOG_FUNCTION(this);
1173 std::size_t n = IidManager::Get()->GetAttributeN(m_tid);
1174 return n;
1175}
1176
1178TypeId::GetAttribute(std::size_t i) const
1179{
1180 NS_LOG_FUNCTION(this << i);
1181 return IidManager::Get()->GetAttribute(m_tid, i);
1182}
1183
1184std::string
1186{
1187 NS_LOG_FUNCTION(this << i);
1189 return GetName() + "::" + info.name;
1190}
1191
1192std::size_t
1194{
1195 NS_LOG_FUNCTION(this);
1197}
1198
1200TypeId::GetTraceSource(std::size_t i) const
1201{
1202 NS_LOG_FUNCTION(this << i);
1203 return IidManager::Get()->GetTraceSource(m_tid, i);
1204}
1205
1206TypeId
1207TypeId::AddTraceSource(std::string name,
1208 std::string help,
1210 std::string callback,
1211 SupportLevel supportLevel,
1212 const std::string& supportMsg)
1213{
1214 NS_LOG_FUNCTION(this << name << help << accessor << callback << supportLevel << supportMsg);
1216 ->AddTraceSource(m_tid, name, help, accessor, callback, supportLevel, supportMsg);
1217 return *this;
1218}
1219
1220TypeId
1222{
1223 NS_LOG_FUNCTION(this);
1225 return *this;
1226}
1227
1230{
1231 NS_LOG_FUNCTION(this << name);
1232 TypeId tid;
1233 TypeId nextTid = *this;
1235 do
1236 {
1237 tid = nextTid;
1238 for (std::size_t i = 0; i < tid.GetTraceSourceN(); i++)
1239 {
1240 tmp = tid.GetTraceSource(i);
1241 if (tmp.name == name)
1242 {
1244 {
1245 *info = tmp;
1246 return tmp.accessor;
1247 }
1248 else if (tmp.supportLevel == TypeId::DEPRECATED)
1249 {
1250 std::cerr << "TraceSource '" << name << "' is deprecated: " << tmp.supportMsg
1251 << std::endl;
1252 *info = tmp;
1253 return tmp.accessor;
1254 }
1255 else if (tmp.supportLevel == TypeId::OBSOLETE)
1256 {
1257 NS_FATAL_ERROR("TraceSource '" << name << "' is obsolete, with no fallback: "
1258 << tmp.supportMsg);
1259 }
1260 }
1261 }
1262 nextTid = tid.GetParent();
1263 } while (nextTid != tid);
1264 return nullptr;
1265}
1266
1268TypeId::LookupTraceSourceByName(std::string name) const
1269{
1271 return LookupTraceSourceByName(name, &info);
1272}
1273
1274uint16_t
1276{
1277 NS_LOG_FUNCTION(this);
1278 return m_tid;
1279}
1280
1281void
1282TypeId::SetUid(uint16_t uid)
1283{
1284 NS_LOG_FUNCTION(this << uid);
1285 m_tid = uid;
1286}
1287
1288/**
1289 * \brief Insertion operator for TypeId
1290 * \param [in] os the output stream
1291 * \param [in] tid the TypeId
1292 * \returns the updated output stream.
1293 */
1294std::ostream&
1295operator<<(std::ostream& os, TypeId tid)
1296{
1297 os << tid.GetName();
1298 return os;
1299}
1300
1301/**
1302 * \brief Extraction operator for TypeId
1303 * \param [in] is the input stream
1304 * \param [out] tid the TypeId value
1305 * \returns the updated input stream.
1306 */
1307std::istream&
1308operator>>(std::istream& is, TypeId& tid)
1309{
1310 std::string tidString;
1311 is >> tidString;
1312 bool ok = TypeId::LookupByNameFailSafe(tidString, &tid);
1313 if (!ok)
1314 {
1315 is.setstate(std::ios_base::badbit);
1316 }
1317 return is;
1318}
1319
1321
1322bool
1324{
1325 return a.m_tid < b.m_tid;
1326}
1327
1328} // namespace ns3
Hold a value for an Attribute.
Definition attribute.h:59
virtual Ptr< AttributeValue > Copy() const =0
Callback template class.
Definition callback.h:422
Generic Hash function interface.
Definition hash.h:76
uint32_t GetHash32(const char *buffer, const std::size_t size)
Compute 32-bit hash of a byte buffer.
Definition hash.h:225
Hasher & clear()
Restore initial state.
Definition hash.cc:45
TypeId information manager.
Definition type-id.cc:68
@ HashChainFlag
Hash chaining flag.
Definition type-id.cc:360
TypeId::hash_t GetHash(uint16_t uid) const
Get the hash of a type id.
Definition type-id.cc:576
std::map< TypeId::hash_t, uint16_t > hashmap_t
Type of the by-hash index.
Definition type-id.cc:347
std::vector< IidInformation >::const_iterator Iterator
Iterator type.
Definition type-id.cc:329
uint16_t GetRegisteredN() const
Get the total number of type ids.
Definition type-id.cc:638
uint16_t GetParent(uint16_t uid) const
Get the parent of a type id.
Definition type-id.cc:586
std::map< std::string, uint16_t > namemap_t
Type of the by-name index.
Definition type-id.cc:342
void SetAttributeInitialValue(uint16_t uid, std::size_t i, Ptr< const AttributeValue > initialValue)
Set the initial value of an Attribute.
Definition type-id.cc:720
void SetGroupName(uint16_t uid, std::string groupName)
Set the group name of a type id.
Definition type-id.cc:493
void SetParent(uint16_t uid, uint16_t parent)
Set the parent of a type id.
Definition type-id.cc:484
std::vector< IidInformation > m_information
The container of all type id records.
Definition type-id.cc:339
void SetSize(uint16_t uid, std::size_t size)
Set the size of the object class referred to by this id.
Definition type-id.cc:501
std::string GetGroupName(uint16_t uid) const
Get the group name of a type id.
Definition type-id.cc:596
bool HasTraceSource(uint16_t uid, std::string name)
Check if a type id has a given TraceSource.
Definition type-id.cc:751
uint16_t GetRegistered(uint16_t i) const
Get a type id by index.
Definition type-id.cc:645
Callback< ObjectBase * > GetConstructor(uint16_t uid) const
Get the constructor Callback of a type id.
Definition type-id.cc:615
std::size_t GetAttributeN(uint16_t uid) const
Get the number of attributes.
Definition type-id.cc:731
uint16_t GetUid(std::string name) const
Get a type id by name.
Definition type-id.cc:530
void AddConstructor(uint16_t uid, Callback< ObjectBase * > callback)
Add a constructor Callback to this type id.
Definition type-id.cc:517
void HideFromDocumentation(uint16_t uid)
Mark this type id to be excluded from documentation.
Definition type-id.cc:509
std::string GetName(uint16_t uid) const
Get the name of a type id.
Definition type-id.cc:558
std::size_t GetTraceSourceN(uint16_t uid) const
Get the number of Trace sources.
Definition type-id.cc:808
std::size_t GetSize(uint16_t uid) const
Get the size of a type id.
Definition type-id.cc:605
TypeId::TraceSourceInformation GetTraceSource(uint16_t uid, std::size_t i) const
Get the trace source by index.
Definition type-id.cc:818
std::string GetDeprecatedName(uint16_t uid) const
Get the deprecated name of a type id.
Definition type-id.cc:567
bool MustHideFromDocumentation(uint16_t uid) const
Check if this TypeId should not be listed in documentation.
Definition type-id.cc:828
IidManager::IidInformation * LookupInformation(uint16_t uid) const
Retrieve the information record for a type.
Definition type-id.cc:461
bool HasConstructor(uint16_t uid) const
Check if a type id has a constructor Callback.
Definition type-id.cc:628
bool HasAttribute(uint16_t uid, std::string name)
Check if a type id has a given Attribute.
Definition type-id.cc:652
static TypeId::hash_t Hasher(const std::string name)
Hashing function.
Definition type-id.cc:366
void AddDeprecatedName(uint16_t uid, const std::string &name)
Add a deprecated name for the type id.
Definition type-id.cc:471
hashmap_t m_hashmap
The by-hash index.
Definition type-id.cc:349
uint16_t AllocateUid(std::string name)
Create a new unique type id.
Definition type-id.cc:386
void AddAttribute(uint16_t uid, std::string name, std::string help, uint32_t flags, Ptr< const AttributeValue > initialValue, Ptr< const AttributeAccessor > accessor, Ptr< const AttributeChecker > checker, TypeId::SupportLevel supportLevel=TypeId::SUPPORTED, const std::string &supportMsg="")
Record a new attribute in a type id.
Definition type-id.cc:681
void AddTraceSource(uint16_t uid, std::string name, std::string help, Ptr< const TraceSourceAccessor > accessor, std::string callback, TypeId::SupportLevel supportLevel=TypeId::SUPPORTED, const std::string &supportMsg="")
Record a new TraceSource.
Definition type-id.cc:780
TypeId::AttributeInformation GetAttribute(uint16_t uid, std::size_t i) const
Get Attribute information by index.
Definition type-id.cc:741
namemap_t m_namemap
The by-name index.
Definition type-id.cc:344
Smart pointer class similar to boost::intrusive_ptr.
A template singleton.
Definition singleton.h:57
static IidManager * Get()
Definition singleton.h:96
a unique identifier for an interface.
Definition type-id.h:48
bool IsChildOf(TypeId other) const
Check if this TypeId is a child of another.
Definition type-id.cc:1041
std::size_t GetTraceSourceN() const
Get the number of Trace sources.
Definition type-id.cc:1193
bool SetAttributeInitialValue(std::size_t i, Ptr< const AttributeValue > initialValue)
Set the initial value of an Attribute.
Definition type-id.cc:1146
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition type-id.cc:872
bool HasParent() const
Check if this TypeId has a parent.
Definition type-id.cc:1033
TypeId SetSize(std::size_t size)
Set the size of this type.
Definition type-id.cc:1017
hash_t GetHash() const
Get the hash.
Definition type-id.cc:1069
TypeId AddTraceSource(std::string name, std::string help, Ptr< const TraceSourceAccessor > accessor, std::string callback, SupportLevel supportLevel=SUPPORTED, const std::string &supportMsg="")
Record a new TraceSource.
Definition type-id.cc:1207
bool MustHideFromDocumentation() const
Check if this TypeId should not be listed in documentation.
Definition type-id.cc:1162
TypeId AddDeprecatedName(const std::string &name)
Add an deprecated name for a TypeId.
Definition type-id.cc:862
@ ATTR_SGC
The attribute can be read, and written at any time.
Definition type-id.h:56
static bool LookupByHashFailSafe(hash_t hash, TypeId *tid)
Get a TypeId by hash.
Definition type-id.cc:914
TypeId::TraceSourceInformation GetTraceSource(std::size_t i) const
Get the trace source by index.
Definition type-id.cc:1200
std::string GetGroupName() const
Get the group name.
Definition type-id.cc:1053
TypeId HideFromDocumentation()
Hide this TypeId from documentation.
Definition type-id.cc:1221
Callback< ObjectBase * > GetConstructor() const
Get the constructor callback.
Definition type-id.cc:1154
static uint16_t GetRegisteredN()
Get the number of registered TypeIds.
Definition type-id.cc:926
std::string GetAttributeFullName(std::size_t i) const
Get the Attribute name by index.
Definition type-id.cc:1185
bool HasConstructor() const
Check if this TypeId has a constructor.
Definition type-id.cc:1084
std::size_t GetAttributeN() const
Get the number of attributes.
Definition type-id.cc:1170
TypeId GetParent() const
Get the parent of this TypeId.
Definition type-id.cc:1025
void SetUid(uint16_t uid)
Set the internal id of this TypeId.
Definition type-id.cc:1282
uint16_t m_tid
The TypeId value.
Definition type-id.h:584
TypeId SetGroupName(std::string groupName)
Set the group name.
Definition type-id.cc:1009
static TypeId LookupByHash(hash_t hash)
Get a TypeId by hash.
Definition type-id.cc:904
static TypeId GetRegistered(uint16_t i)
Get a TypeId by index.
Definition type-id.cc:933
std::size_t GetSize() const
Get the size of this object.
Definition type-id.cc:1076
Ptr< const TraceSourceAccessor > LookupTraceSourceByName(std::string name) const
Find a TraceSource by name.
Definition type-id.cc:1268
uint32_t hash_t
Type of hash values.
Definition type-id.h:109
TypeId()
Default constructor.
Definition type-id.h:624
TypeId::AttributeInformation GetAttribute(std::size_t i) const
Get Attribute information by index.
Definition type-id.cc:1178
uint16_t GetUid() const
Get the internal id of this TypeId.
Definition type-id.cc:1275
static bool LookupByNameFailSafe(std::string name, TypeId *tid)
Get a TypeId by name.
Definition type-id.cc:886
bool LookupAttributeByName(std::string name, AttributeInformation *info, bool permissive=false) const
Find an Attribute by name, retrieving the associated AttributeInformation.
Definition type-id.cc:968
SupportLevel
The level of support or deprecation for attributes or trace sources.
Definition type-id.h:62
@ SUPPORTED
Attribute or trace source is currently used.
Definition type-id.h:63
@ OBSOLETE
Attribute or trace source is not used anymore; simulation fails.
Definition type-id.h:65
@ DEPRECATED
Attribute or trace source is deprecated; user is warned.
Definition type-id.h:64
TypeId AddAttribute(std::string name, std::string help, const AttributeValue &initialValue, Ptr< const AttributeAccessor > accessor, Ptr< const AttributeChecker > checker, SupportLevel supportLevel=SUPPORTED, const std::string &supportMsg="")
Record in this TypeId the fact that a new attribute exists.
Definition type-id.cc:1099
static std::tuple< bool, TypeId, AttributeInformation > FindAttribute(const TypeId &tid, const std::string &name)
Find an attribute by name in the inheritance tree for a given TypeId.
Definition type-id.cc:940
std::string GetName() const
Get the name.
Definition type-id.cc:1061
TypeId SetParent()
Set the parent TypeId.
Definition type-id.h:663
void DoAddConstructor(Callback< ObjectBase * > callback)
Implementation for AddConstructor().
Definition type-id.cc:1092
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition assert.h:75
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
Definition abort.h:133
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition log.h:243
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
#define IIDL
Definition type-id.cc:383
#define IID
Definition type-id.cc:377
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
ns3::Hasher, ns3::Hash32() and ns3::Hash64() function declarations.
Debug message logging.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
std::istream & operator>>(std::istream &is, Angles &a)
Definition angles.cc:172
bool operator<(const EventId &a, const EventId &b)
Definition event-id.h:168
ns3::Singleton declaration and template implementation.
The information record about a single type id.
Definition type-id.cc:299
std::string groupName
The group name.
Definition type-id.cc:309
uint16_t parent
The parent type id.
Definition type-id.cc:307
std::string deprecatedName
A deprecated type id name.
Definition type-id.cc:303
std::vector< TypeId::TraceSourceInformation > traceSources
The container of TraceSources.
Definition type-id.cc:321
std::size_t size
The size of the object represented by this type id.
Definition type-id.cc:311
std::string supportMsg
Support message.
Definition type-id.cc:325
std::string name
The type id name.
Definition type-id.cc:301
std::vector< TypeId::AttributeInformation > attributes
The container of Attributes.
Definition type-id.cc:319
Callback< ObjectBase * > constructor
The constructor Callback.
Definition type-id.cc:315
bool hasConstructor
true if a constructor Callback has been registered.
Definition type-id.cc:313
bool mustHideFromDocumentation
true if this type should be omitted from documentation.
Definition type-id.cc:317
TypeId::hash_t hash
The type id hash value.
Definition type-id.cc:305
TypeId::SupportLevel supportLevel
Support level/deprecation.
Definition type-id.cc:323
Attribute implementation.
Definition type-id.h:70
Ptr< const AttributeValue > originalInitialValue
Default initial value.
Definition type-id.h:78
TypeId::SupportLevel supportLevel
Support level/deprecation.
Definition type-id.h:86
std::string name
Attribute name.
Definition type-id.h:72
Ptr< const AttributeAccessor > accessor
Accessor object.
Definition type-id.h:82
uint32_t flags
AttributeFlags value.
Definition type-id.h:76
Ptr< const AttributeChecker > checker
Checker object.
Definition type-id.h:84
std::string supportMsg
Support message.
Definition type-id.h:88
Ptr< const AttributeValue > initialValue
Configured initial value.
Definition type-id.h:80
std::string help
Attribute help string.
Definition type-id.h:74
TraceSource implementation.
Definition type-id.h:93
std::string name
Trace name.
Definition type-id.h:95
std::string supportMsg
Support message.
Definition type-id.h:105
std::string help
Trace help string.
Definition type-id.h:97
Ptr< const TraceSourceAccessor > accessor
Trace accessor.
Definition type-id.h:101
std::string callback
Callback function signature type.
Definition type-id.h:99
TypeId::SupportLevel supportLevel
Support level/deprecation.
Definition type-id.h:103
ns3::TraceSourceAccessor and ns3::MakeTraceSourceAccessor declarations.
ns3::TypeId declaration; inline and template implementations.