A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
type-id.h
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#ifndef TYPE_ID_H
9#define TYPE_ID_H
10
12#include "attribute-helper.h"
13#include "attribute.h"
14#include "callback.h"
15#include "deprecated.h"
16#include "hash.h"
18
19#include <stdint.h>
20#include <string>
21
22/**
23 * @file
24 * @ingroup object
25 * ns3::TypeId declaration; inline and template implementations.
26 */
27
28namespace ns3
29{
30
31class ObjectBase;
32
33/**
34 * @ingroup object
35 * @brief a unique identifier for an interface.
36 *
37 * This class records a lot of meta-information about a
38 * subclass of the Object base class:
39 * - the base class of the subclass
40 * - the set of accessible constructors in the subclass
41 * - the set of 'attributes' accessible in the subclass
42 *
43 * @see attribute_TypeId
44 *
45 * @internal
46 * See the discussion in IidManager about hash chaining of TypeId's.
47 */
48class TypeId
49{
50 public:
51 /** Flags describing when a given attribute can be read or written. */
53 {
54 ATTR_GET = 1 << 0, /**< The attribute can be read */
55 ATTR_SET = 1 << 1, /**< The attribute can be written */
56 ATTR_CONSTRUCT = 1 << 2, /**< The attribute can be written at construction-time */
58 ATTR_CONSTRUCT, /**< The attribute can be read, and written at any time */
59 };
60
61 /** The level of support or deprecation for attributes or trace sources. */
62 enum class SupportLevel
63 {
64 SUPPORTED, /**< Attribute or trace source is currently used. */
65 DEPRECATED, /**< Attribute or trace source is deprecated; user is warned. */
66 OBSOLETE /**< Attribute or trace source is not used anymore; simulation fails. */
67 };
68
69 /**
70 * Deprecated support level simple enums.
71 *
72 * Use the `TypeId::SupportLevel` enum class symbols instead.
73 * @{
74 */
75 NS_DEPRECATED_3_44("Use SupportLevel::SUPPORTED instead")
76 static constexpr auto SUPPORTED = SupportLevel::SUPPORTED;
77 NS_DEPRECATED_3_44("Use SupportLevel::DEPRECATED instead")
78 static constexpr auto DEPRECATED = SupportLevel::DEPRECATED;
79 NS_DEPRECATED_3_44("Use SupportLevel::OBSOLETE instead")
80 static constexpr auto OBSOLETE = SupportLevel::OBSOLETE;
81
82 /**@}*/
83
84 /** Attribute implementation. */
86 {
87 /** Attribute name. */
88 std::string name;
89 /** Attribute help string. */
90 std::string help;
91 /** AttributeFlags value. */
93 /** Default initial value. */
95 /** Configured initial value. */
97 /** Accessor object. */
99 /** Checker object. */
101 /** Support level/deprecation. */
103 /** Support message. */
104 std::string supportMsg;
105 };
106
107 /** TraceSource implementation. */
109 {
110 /** Trace name. */
111 std::string name;
112 /** Trace help string. */
113 std::string help;
114 /** Callback function signature type. */
115 std::string callback;
116 /** Trace accessor. */
118 /** Support level/deprecation. */
120 /** Support message. */
121 std::string supportMsg;
122 };
123
124 /** Type of hash values. */
126
127 /**
128 * Get a TypeId by name.
129 *
130 * @param [in] name The name of the requested TypeId
131 * @returns The unique id associated with the requested name.
132 *
133 * This method cannot fail: it will crash if the input
134 * name is not a valid TypeId name.
135 *
136 * @hidecaller
137 */
138 static TypeId LookupByName(std::string name);
139 /**
140 * Get a TypeId by name.
141 *
142 * @param [in] name The name of the requested TypeId
143 * @param [out] tid A pointer to the TypeId instance where the
144 * result of this function should be stored.
145 * @returns \c true if the requested name was found.
146 */
147 static bool LookupByNameFailSafe(std::string name, TypeId* tid);
148 /**
149 * Get a TypeId by hash.
150 *
151 * @param [in] hash The hash to lookup
152 * @returns The unique id associated with the requested hash.
153 *
154 * This method cannot fail: it will crash if the input
155 * hash does not match an existing TypeId.
156 */
157 static TypeId LookupByHash(hash_t hash);
158 /**
159 * Get a TypeId by hash.
160 *
161 * @param [in] hash The hash of the requested TypeId
162 * @param [out] tid A pointer to the TypeId instance where the
163 * result of this function should be stored.
164 * @returns \c true if the requested hash was found.
165 */
166 static bool LookupByHashFailSafe(hash_t hash, TypeId* tid);
167
168 /**
169 * Get the number of registered TypeIds.
170 *
171 * @returns The number of TypeId instances registered.
172 */
173 static uint16_t GetRegisteredN();
174 /**
175 * Get a TypeId by index.
176 *
177 * @param [in] i Index of the TypeId.
178 * @returns The TypeId instance whose index is \c i.
179 */
180 static TypeId GetRegistered(uint16_t i);
181
182 /**
183 * Constructor.
184 *
185 * @param [in] name The name of the interface to construct.
186 *
187 * No two instances can share the same name. The name is expected to be
188 * the full c++ typename of associated c++ object.
189 */
190 explicit TypeId(const std::string& name);
191
192 /**
193 * Add an deprecated name for a TypeId.
194 *
195 * @param [in] name The deprecated name.
196 * @return This TypeId instance.
197 *
198 * To allow for deprecations (such as moving a TypeId into a namespace
199 * but wishing to preserve the original string from namespace ns3),
200 * one additional deprecated name can be registered for a TypeId. This
201 * deprecated name is not retrievable by GetName(). A runtime warning is
202 * generated if the name is used, and only one deprecated name is supported.
203 */
204 TypeId AddDeprecatedName(const std::string& name);
205
206 /**
207 * Get the parent of this TypeId.
208 *
209 * @returns The parent of this TypeId
210 *
211 * This method cannot fail. It will return itself
212 * if this TypeId has no parent. i.e., it is at the top
213 * of the TypeId hierarchy. Currently, this is the
214 * case for the TypeId associated to the ns3::ObjectBase class
215 * only.
216 */
217 TypeId GetParent() const;
218
219 /**
220 * Check if this TypeId has a parent.
221 *
222 * @return \c true if this TypeId has a parent.
223 */
224 bool HasParent() const;
225
226 /**
227 * Check if this TypeId is a child of another.
228 *
229 * @param [in] other A parent TypeId
230 * @returns \c true if the input TypeId is really a parent of this TypeId.
231 *
232 * Calling this method is roughly similar to calling dynamic_cast
233 * except that you do not need object instances: you can do the check
234 * with TypeId instances instead.
235 */
236 bool IsChildOf(TypeId other) const;
237
238 /**
239 * Get the group name.
240 *
241 * @returns The name of the group associated to this TypeId.
242 */
243 std::string GetGroupName() const;
244
245 /**
246 * Get the name.
247 *
248 * @returns The name of this interface.
249 * @hidecaller
250 */
251 std::string GetName() const;
252
253 /**
254 * Get the hash.
255 *
256 * @returns The hash of this interface.
257 */
258 hash_t GetHash() const;
259
260 /**
261 * Get the size of this object.
262 *
263 * @returns The size of this interface.
264 */
265 std::size_t GetSize() const;
266
267 /**
268 * Check if this TypeId has a constructor.
269 *
270 * @returns \c true if this TypeId has a constructor
271 */
272 bool HasConstructor() const;
273
274 /**
275 * Get the number of attributes.
276 *
277 * @returns The number of attributes associated to this TypeId
278 */
279 std::size_t GetAttributeN() const;
280 /**
281 * Get Attribute information by index.
282 *
283 * @param [in] i Index into attribute array
284 * @returns The information associated to attribute whose index is \pname{i}.
285 */
286 TypeId::AttributeInformation GetAttribute(std::size_t i) const;
287 /**
288 * Get the Attribute name by index.
289 *
290 * @param [in] i Index into attribute array
291 * @returns The full name associated to the attribute whose index is \pname{i}.
292 */
293 std::string GetAttributeFullName(std::size_t i) const;
294
295 /**
296 * Get the constructor callback.
297 *
298 * @returns A callback which can be used to instantiate an object
299 * of this type.
300 */
302
303 /**
304 * Check if this TypeId should not be listed in documentation.
305 *
306 * @returns \c true if this TypeId should be hidden from the user.
307 */
308 bool MustHideFromDocumentation() const;
309
310 /**
311 * Get the number of Trace sources.
312 *
313 * @returns The number of trace sources defined in this TypeId.
314 */
315 std::size_t GetTraceSourceN() const;
316 /**
317 * Get the trace source by index.
318 *
319 * @param [in] i Index into trace source array.
320 * @returns Detailed information about the requested trace source.
321 */
323
324 /**
325 * Set the parent TypeId.
326 *
327 * @param [in] tid The TypeId of the base class.
328 * @return This TypeId instance.
329 *
330 * Record in this TypeId which TypeId is the TypeId
331 * of the base class of the subclass.
332 *
333 * @hidecaller
334 */
336 /**
337 * Set the parent TypeId.
338 *
339 * @tparam T \explicit The parent TypeID type.
340 * @return This TypeId instance.
341 *
342 * Record in this TypeId which TypeId is the TypeId
343 * of the base class of the subclass.
344 *
345 * @hidecaller
346 */
347 template <typename T>
349
350 /**
351 * Set the group name.
352 *
353 * @param [in] groupName The name of the group this TypeId belongs to.
354 * @returns This TypeId instance.
355 *
356 * The group name is purely an advisory information used to
357 * group together types according to a user-specific grouping
358 * scheme.
359 */
360 TypeId SetGroupName(std::string groupName);
361
362 /**
363 * Set the size of this type.
364 *
365 * Call this way:
366 * @code
367 * SetSize (sizeof (<typename>));
368 * @endcode
369 * This is done automatically by NS_LOG_ENSURE_REGISTERED()
370 * A ridiculously large reported size is a symptom that the
371 * type hasn't been registered.
372 *
373 * @param [in] size The size of the object, in bytes.
374 * @returns This TypeId instance.
375 */
376 TypeId SetSize(std::size_t size);
377
378 /**
379 * Record in this TypeId the fact that the default constructor
380 * is accessible.
381 *
382 * @tparam T \explicit The class name represented by this TypeId.
383 * @returns This TypeId instance
384 */
385 template <typename T>
387
388 /**
389 * Record in this TypeId the fact that a new attribute exists.
390 *
391 * @param [in] name The name of the new attribute
392 * @param [in] help Some help text which describes the purpose of this
393 * attribute.
394 * @param [in] initialValue The initial value for this attribute.
395 * @param [in] accessor An instance of the associated AttributeAccessor
396 * subclass.
397 * @param [in] checker An instance of the associated AttributeChecker
398 * subclass.
399 * @param [in] supportLevel Support/deprecation status of the attribute.
400 * @param [in] supportMsg Upgrade hint if this attribute is no longer
401 * supported. If the attribute is \c DEPRECATED the attribute
402 * behavior still exists, but user code should be updated
403 * following guidance in the hint.
404 * If the attribute is \c OBSOLETE, the hint should indicate
405 * which class the attribute functional has been moved to,
406 * or that the functionality is no longer supported.
407 * See test file type-id-test-suite.cc for examples.
408 * @returns This TypeId instance
409 */
410 TypeId AddAttribute(std::string name,
411 std::string help,
412 const AttributeValue& initialValue,
416 const std::string& supportMsg = "");
417
418 /**
419 * Set the initial value of an Attribute.
420 *
421 * @param [in] i The attribute to manipulate
422 * @param [in] initialValue The new initial value to use for this attribute.
423 * @returns \c true if the call was successfully.
424 */
425 bool SetAttributeInitialValue(std::size_t i, Ptr<const AttributeValue> initialValue);
426
427 /**
428 * Record in this TypeId the fact that a new attribute exists.
429 *
430 * @param [in] name The name of the new attribute
431 * @param [in] help Some help text which describes the purpose of this
432 * attribute
433 * @param [in] flags Flags which describe how this attribute can be read and/or written.
434 * @param [in] initialValue The initial value for this attribute.
435 * @param [in] accessor An instance of the associated AttributeAccessor
436 * subclass.
437 * @param [in] checker An instance of the associated AttributeChecker
438 * subclass.
439 * @param [in] supportLevel Support/deprecation status of the attribute.
440 * @param [in] supportMsg Upgrade hint if this attribute is no longer
441 * supported. If the attribute is \c DEPRECATED the attribute
442 * behavior still exists, but user code should be updated
443 * following guidance in the hint..
444 * If the attribute is \c OBSOLETE, the hint should indicate
445 * which class the attribute functional has been moved to,
446 * or that the functionality is no longer supported.
447 * @returns This TypeId instance
448 */
449 TypeId AddAttribute(std::string name,
450 std::string help,
451 uint32_t flags,
452 const AttributeValue& initialValue,
456 const std::string& supportMsg = "");
457
458 /**
459 * Record a new TraceSource.
460 *
461 * @param [in] name The name of the new trace source
462 * @param [in] help Some help text which describes the purpose of this
463 * trace source.
464 * @param [in] accessor A pointer to a TraceSourceAccessor which can be
465 * used to connect/disconnect sinks to this trace source.
466 * @param [in] callback Fully qualified typedef name for the callback
467 * signature. Generally this should begin with the
468 * "ns3::" namespace qualifier.
469 * @param [in] supportLevel Support/deprecation status of the attribute.
470 * @param [in] supportMsg Upgrade hint if this attribute is no longer
471 * supported. If the attribute is \c DEPRECATED the attribute
472 * behavior still exists, but user code should be updated
473 * following guidance in the hint..
474 * If the attribute is \c OBSOLETE, the hint should indicate
475 * which class the attribute functional has been moved to,
476 * or that the functionality is no longer supported.
477 * See test file type-id-test-suite.cc for examples.
478 * @returns This TypeId instance.
479 */
480 TypeId AddTraceSource(std::string name,
481 std::string help,
483 std::string callback,
485 const std::string& supportMsg = "");
486
487 /**
488 * Hide this TypeId from documentation.
489 * @returns This TypeId instance.
490 */
492
493 /**
494 * Find an attribute by name in the inheritance tree for a given TypeId.
495 *
496 * @param [in] tid The TypeId to start the search from.
497 * @param [in] name The name of the attribute to search for.
498 * @return A tuple containing a boolean that indicates whether the attribute was found, the
499 * TypeId where the attribute was found, and the AttributeInformation of the found attribute.
500 */
501 static std::tuple<bool, TypeId, AttributeInformation> FindAttribute(const TypeId& tid,
502 const std::string& name);
503
504 /**
505 * Find an Attribute by name, retrieving the associated AttributeInformation.
506 *
507 * @param [in] name The name of the requested attribute
508 * @param [in,out] info A pointer to the TypeId::AttributeInformation
509 * data structure where the result value of this method
510 * will be stored.
511 * @param [in] permissive If false (by default), will generate warnings and errors for
512 * deprecated and obsolete attributes, respectively. If set to true, warnings for deprecated
513 * attributes will be suppressed.
514 * @returns \c true if the requested attribute could be found.
515 */
516 bool LookupAttributeByName(std::string name,
518 bool permissive = false) const;
519 /**
520 * Find a TraceSource by name.
521 *
522 * If no matching trace source is found, this method returns zero.
523 *
524 * @param [in] name The name of the requested trace source
525 * @return The trace source accessor which can be used to connect
526 * and disconnect trace sinks with the requested trace source on
527 * an object instance.
528 */
530 /**
531 * Find a TraceSource by name, retrieving the associated TraceSourceInformation.
532 *
533 * @param [in] name The name of the requested trace source.
534 * @param [out] info A pointer to the TypeId::TraceSourceInformation
535 * data structure where the result value of this method
536 * will be stored.
537 * @return The trace source accessor which can be used to connect
538 * and disconnect trace sinks with the requested trace source on
539 * an object instance.
540 */
542 TraceSourceInformation* info) const;
543
544 /**
545 * Get the internal id of this TypeId.
546 *
547 * @returns The internal integer which uniquely identifies this TypeId.
548 *
549 * This is really an internal method which users are not expected
550 * to use.
551 */
552 uint16_t GetUid() const;
553 /**
554 * Set the internal id of this TypeId.
555 *
556 * @param [in] uid The internal integer which uniquely identifies
557 * this TypeId. This TypeId should already have been registered.
558 *
559 * Typically this is used in serialization/deserialization.
560 *
561 * This method is even more internal than GetUid(). Use
562 * at your own risk and don't be surprised that it eats raw
563 * babies on full-moon nights.
564 */
565 void SetUid(uint16_t uid);
566
567 /** Default constructor. This produces an invalid TypeId. */
568 inline TypeId();
569 /**
570 * Copy constructor.
571 * @param [in] o The other TypeId.
572 */
573 inline TypeId(const TypeId& o);
574 /**
575 * Assignment.
576 * @param [in] o The other TypeId.
577 * @returns The copied TypeId.
578 */
579 inline TypeId& operator=(const TypeId& o);
580 /** Destructor. */
581 inline ~TypeId();
582
583 private:
584 /**
585 * @name Comparison operators.
586 * Standard comparison operators.
587 * @{
588 */
589 friend inline bool operator==(TypeId a, TypeId b);
590 friend inline bool operator!=(TypeId a, TypeId b);
591 friend bool operator<(TypeId a, TypeId b);
592 /**@}*/
593
594 /**
595 * Construct from an integer value.
596 * @param [in] tid The TypeId value as an integer.
597 */
598 explicit TypeId(uint16_t tid);
599 /**
600 * Implementation for AddConstructor().
601 *
602 * @param [in] callback Callback which constructs an instance of this TypeId.
603 */
605
606 /** The TypeId value. */
607 uint16_t m_tid;
608};
609
610/**
611 * @relates TypeId
612 * Output streamer.
613 *
614 * @param [in,out] os The output stream.
615 * @param [in] tid The TypeId.
616 * @returns The output stream.
617 */
618std::ostream& operator<<(std::ostream& os, TypeId tid);
619/**
620 * @relates TypeId
621 * Input Streamer.
622 * @param [in,out] is The input stream.
623 * @param [out] tid The TypeId to set from the stream.
624 * @returns The input stream.
625 */
626std::istream& operator>>(std::istream& is, TypeId& tid);
627
628/**
629 * @brief Stream insertion operator.
630 * @param [in] os The reference to the output stream.
631 * @param [in] level The TypeId::SupportLevel.
632 * @return The reference to the output stream.
633 */
634std::ostream& operator<<(std::ostream& os, TypeId::SupportLevel level);
635
636/**
637 * Comparison operator.
638 * @param [in] a One value.
639 * @param [in] b The other value.
640 * @returns The result of the comparison.
641 * @{
642 */
643inline bool operator==(TypeId a, TypeId b);
644inline bool operator!=(TypeId a, TypeId b);
645bool operator<(TypeId a, TypeId b);
646/** @} */
647
649
650} // namespace ns3
651
652namespace ns3
653{
654
656 : m_tid(0)
657{
658}
659
661 : m_tid(o.m_tid)
662{
663}
664
665TypeId&
667{
668 m_tid = o.m_tid;
669 return *this;
670}
671
673{
674}
675
676inline bool
678{
679 return a.m_tid == b.m_tid;
680}
681
682inline bool
684{
685 return a.m_tid != b.m_tid;
686}
687
688/*************************************************************************
689 * The TypeId implementation which depends on templates
690 *************************************************************************/
691
692template <typename T>
693TypeId
695{
696 return SetParent(T::GetTypeId());
697}
698
699template <typename T>
700TypeId
702{
703 struct Maker
704 {
705 static ObjectBase* Create()
706 {
707 ObjectBase* base = new T();
708 return base;
709 }
710 };
711
712 Callback<ObjectBase*> cb = MakeCallback(&Maker::Create);
714 return *this;
715}
716
717} // namespace ns3
718
719#endif /* TYPE_ID_H */
ns3::MakeAccessorHelper declarations and template implementations.
Attribute helper (ATTRIBUTE_ )macros definition.
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
Declaration of the various callback functions.
Hold a value for an Attribute.
Definition attribute.h:59
Callback template class.
Definition callback.h:428
Anchor the ns-3 type and attribute system.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
a unique identifier for an interface.
Definition type-id.h:49
bool IsChildOf(TypeId other) const
Check if this TypeId is a child of another.
Definition type-id.cc:1041
friend bool operator!=(TypeId a, TypeId b)
Comparison operator.
Definition type-id.h:683
static constexpr auto SUPPORTED
Deprecated support level simple enums.
Definition type-id.h:76
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
TypeId AddAttribute(std::string name, std::string help, const AttributeValue &initialValue, Ptr< const AttributeAccessor > accessor, Ptr< const AttributeChecker > checker, SupportLevel supportLevel=SupportLevel::SUPPORTED, const std::string &supportMsg="")
Record in this TypeId the fact that a new attribute exists.
Definition type-id.cc:1099
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
static constexpr auto DEPRECATED
Definition type-id.h:78
bool MustHideFromDocumentation() const
Check if this TypeId should not be listed in documentation.
Definition type-id.cc:1162
static constexpr auto OBSOLETE
Definition type-id.h:80
TypeId AddDeprecatedName(const std::string &name)
Add an deprecated name for a TypeId.
Definition type-id.cc:862
AttributeFlag
Flags describing when a given attribute can be read or written.
Definition type-id.h:53
@ ATTR_GET
The attribute can be read.
Definition type-id.h:54
@ ATTR_SGC
The attribute can be read, and written at any time.
Definition type-id.h:57
@ ATTR_SET
The attribute can be written.
Definition type-id.h:55
@ ATTR_CONSTRUCT
The attribute can be written at construction-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
TypeId AddConstructor()
Record in this TypeId the fact that the default constructor is accessible.
Definition type-id.h:701
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:607
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
friend bool operator==(TypeId a, TypeId b)
Comparison operator.
Definition type-id.h:677
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
TypeId & operator=(const TypeId &o)
Assignment.
Definition type-id.h:666
~TypeId()
Destructor.
Definition type-id.h:672
friend bool operator<(TypeId a, TypeId b)
Comparison operator.
Definition type-id.cc:1338
uint32_t hash_t
Type of hash values.
Definition type-id.h:125
TypeId()
Default constructor.
Definition type-id.h:655
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
TypeId(const std::string &name)
Constructor.
Definition type-id.cc:846
static bool LookupByNameFailSafe(std::string name, TypeId *tid)
Get a TypeId by name.
Definition type-id.cc:886
TypeId AddTraceSource(std::string name, std::string help, Ptr< const TraceSourceAccessor > accessor, std::string callback, SupportLevel supportLevel=SupportLevel::SUPPORTED, const std::string &supportMsg="")
Record a new TraceSource.
Definition type-id.cc:1207
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:63
@ SUPPORTED
Attribute or trace source is currently used.
Definition type-id.h:64
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:694
void DoAddConstructor(Callback< ObjectBase * > callback)
Implementation for AddConstructor().
Definition type-id.cc:1092
NS_DEPRECATED macro definition.
#define ATTRIBUTE_HELPER_HEADER(type)
Declare the attribute value, accessor and checkers for class type.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition callback.h:690
#define NS_DEPRECATED_3_44(msg)
Tag for things deprecated in version ns-3.44.
Definition deprecated.h:112
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:454
ns3::Hasher, ns3::Hash32() and ns3::Hash64() function declarations.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool operator!=(Callback< R, Args... > a, Callback< R, Args... > b)
Inequality test.
Definition callback.h:664
bool operator==(const EventId &a, const EventId &b)
Definition event-id.h:146
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:159
Attribute implementation.
Definition type-id.h:86
Ptr< const AttributeValue > originalInitialValue
Default initial value.
Definition type-id.h:94
TypeId::SupportLevel supportLevel
Support level/deprecation.
Definition type-id.h:102
std::string name
Attribute name.
Definition type-id.h:88
Ptr< const AttributeAccessor > accessor
Accessor object.
Definition type-id.h:98
uint32_t flags
AttributeFlags value.
Definition type-id.h:92
Ptr< const AttributeChecker > checker
Checker object.
Definition type-id.h:100
std::string supportMsg
Support message.
Definition type-id.h:104
Ptr< const AttributeValue > initialValue
Configured initial value.
Definition type-id.h:96
std::string help
Attribute help string.
Definition type-id.h:90
TraceSource implementation.
Definition type-id.h:109
std::string name
Trace name.
Definition type-id.h:111
std::string supportMsg
Support message.
Definition type-id.h:121
std::string help
Trace help string.
Definition type-id.h:113
Ptr< const TraceSourceAccessor > accessor
Trace accessor.
Definition type-id.h:117
std::string callback
Callback function signature type.
Definition type-id.h:115
TypeId::SupportLevel supportLevel
Support level/deprecation.
Definition type-id.h:119
ns3::TraceSourceAccessor and ns3::MakeTraceSourceAccessor declarations.