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