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;
78 static constexpr auto DEPRECATED = SupportLevel::DEPRECATED;
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 static TypeId LookupByName(std::string name);
137 /**
138 * Get a TypeId by name.
139 *
140 * @param [in] name The name of the requested TypeId
141 * @param [out] tid A pointer to the TypeId instance where the
142 * result of this function should be stored.
143 * @returns \c true if the requested name was found.
144 */
145 static bool LookupByNameFailSafe(std::string name, TypeId* tid);
146 /**
147 * Get a TypeId by hash.
148 *
149 * @param [in] hash The hash to lookup
150 * @returns The unique id associated with the requested hash.
151 *
152 * This method cannot fail: it will crash if the input
153 * hash does not match an existing TypeId.
154 */
155 static TypeId LookupByHash(hash_t hash);
156 /**
157 * Get a TypeId by hash.
158 *
159 * @param [in] hash The hash of the requested TypeId
160 * @param [out] tid A pointer to the TypeId instance where the
161 * result of this function should be stored.
162 * @returns \c true if the requested hash was found.
163 */
164 static bool LookupByHashFailSafe(hash_t hash, TypeId* tid);
165
166 /**
167 * Get the number of registered TypeIds.
168 *
169 * @returns The number of TypeId instances registered.
170 */
171 static uint16_t GetRegisteredN();
172 /**
173 * Get a TypeId by index.
174 *
175 * @param [in] i Index of the TypeId.
176 * @returns The TypeId instance whose index is \c i.
177 */
178 static TypeId GetRegistered(uint16_t i);
179
180 /**
181 * Constructor.
182 *
183 * @param [in] name The name of the interface to construct.
184 *
185 * No two instances can share the same name. The name is expected to be
186 * the full c++ typename of associated c++ object.
187 */
188 explicit TypeId(const std::string& name);
189
190 /**
191 * Add an deprecated name for a TypeId.
192 *
193 * @param [in] name The deprecated name.
194 * @return This TypeId instance.
195 *
196 * To allow for deprecations (such as moving a TypeId into a namespace
197 * but wishing to preserve the original string from namespace ns3),
198 * one additional deprecated name can be registered for a TypeId. This
199 * deprecated name is not retrievable by GetName(). A runtime warning is
200 * generated if the name is used, and only one deprecated name is supported.
201 */
202 TypeId AddDeprecatedName(const std::string& name);
203
204 /**
205 * Get the parent of this TypeId.
206 *
207 * @returns The parent of this TypeId
208 *
209 * This method cannot fail. It will return itself
210 * if this TypeId has no parent. i.e., it is at the top
211 * of the TypeId hierarchy. Currently, this is the
212 * case for the TypeId associated to the ns3::ObjectBase class
213 * only.
214 */
215 TypeId GetParent() const;
216
217 /**
218 * Check if this TypeId has a parent.
219 *
220 * @return \c true if this TypeId has a parent.
221 */
222 bool HasParent() const;
223
224 /**
225 * Check if this TypeId is a child of another.
226 *
227 * @param [in] other A parent TypeId
228 * @returns \c true if the input TypeId is really a parent of this TypeId.
229 *
230 * Calling this method is roughly similar to calling dynamic_cast
231 * except that you do not need object instances: you can do the check
232 * with TypeId instances instead.
233 */
234 bool IsChildOf(TypeId other) const;
235
236 /**
237 * Get the group name.
238 *
239 * @returns The name of the group associated to this TypeId.
240 */
241 std::string GetGroupName() const;
242
243 /**
244 * Get the name.
245 *
246 * @returns The name of this interface.
247 */
248 std::string GetName() const;
249
250 /**
251 * Get the hash.
252 *
253 * @returns The hash of this interface.
254 */
255 hash_t GetHash() const;
256
257 /**
258 * Get the size of this object.
259 *
260 * @returns The size of this interface.
261 */
262 std::size_t GetSize() const;
263
264 /**
265 * Check if this TypeId has a constructor.
266 *
267 * @returns \c true if this TypeId has a constructor
268 */
269 bool HasConstructor() const;
270
271 /**
272 * Get the number of attributes.
273 *
274 * @returns The number of attributes associated to this TypeId
275 */
276 std::size_t GetAttributeN() const;
277 /**
278 * Get Attribute information by index.
279 *
280 * @param [in] i Index into attribute array
281 * @returns The information associated to attribute whose index is \pname{i}.
282 */
283 TypeId::AttributeInformation GetAttribute(std::size_t i) const;
284 /**
285 * Get the Attribute name by index.
286 *
287 * @param [in] i Index into attribute array
288 * @returns The full name associated to the attribute whose index is \pname{i}.
289 */
290 std::string GetAttributeFullName(std::size_t i) const;
291
292 /**
293 * Get the constructor callback.
294 *
295 * @returns A callback which can be used to instantiate an object
296 * of this type.
297 */
299
300 /**
301 * Check if this TypeId should not be listed in documentation.
302 *
303 * @returns \c true if this TypeId should be hidden from the user.
304 */
305 bool MustHideFromDocumentation() const;
306
307 /**
308 * Get the number of Trace sources.
309 *
310 * @returns The number of trace sources defined in this TypeId.
311 */
312 std::size_t GetTraceSourceN() const;
313 /**
314 * Get the trace source by index.
315 *
316 * @param [in] i Index into trace source array.
317 * @returns Detailed information about the requested trace source.
318 */
320
321 /**
322 * Set the parent TypeId.
323 *
324 * @param [in] tid The TypeId of the base class.
325 * @return This TypeId instance.
326 *
327 * Record in this TypeId which TypeId is the TypeId
328 * of the base class of the subclass.
329 */
331 /**
332 * Set the parent TypeId.
333 *
334 * @tparam T \explicit The parent TypeID type.
335 * @return This TypeId instance.
336 *
337 * Record in this TypeId which TypeId is the TypeId
338 * of the base class of the subclass.
339 */
340 template <typename T>
342
343 /**
344 * Set the group name.
345 *
346 * @param [in] groupName The name of the group this TypeId belongs to.
347 * @returns This TypeId instance.
348 *
349 * The group name is purely an advisory information used to
350 * group together types according to a user-specific grouping
351 * scheme.
352 */
353 TypeId SetGroupName(std::string groupName);
354
355 /**
356 * Set the size of this type.
357 *
358 * Call this way:
359 * @code
360 * SetSize (sizeof (<typename>));
361 * @endcode
362 * This is done automatically by NS_LOG_ENSURE_REGISTERED()
363 * A ridiculously large reported size is a symptom that the
364 * type hasn't been registered.
365 *
366 * @param [in] size The size of the object, in bytes.
367 * @returns This TypeId instance.
368 */
369 TypeId SetSize(std::size_t size);
370
371 /**
372 * Record in this TypeId the fact that the default constructor
373 * is accessible.
374 *
375 * @tparam T \explicit The class name represented by this TypeId.
376 * @returns This TypeId instance
377 */
378 template <typename T>
380
381 /**
382 * Record in this TypeId the fact that a new attribute exists.
383 *
384 * @param [in] name The name of the new attribute
385 * @param [in] help Some help text which describes the purpose of this
386 * attribute.
387 * @param [in] initialValue The initial value for this attribute.
388 * @param [in] accessor An instance of the associated AttributeAccessor
389 * subclass.
390 * @param [in] checker An instance of the associated AttributeChecker
391 * subclass.
392 * @param [in] supportLevel Support/deprecation status of the attribute.
393 * @param [in] supportMsg Upgrade hint if this attribute is no longer
394 * supported. If the attribute is \c DEPRECATED the attribute
395 * behavior still exists, but user code should be updated
396 * following guidance in the hint.
397 * If the attribute is \c OBSOLETE, the hint should indicate
398 * which class the attribute functional has been moved to,
399 * or that the functionality is no longer supported.
400 * See test file type-id-test-suite.cc for examples.
401 * @returns This TypeId instance
402 */
403 TypeId AddAttribute(std::string name,
404 std::string help,
405 const AttributeValue& initialValue,
409 const std::string& supportMsg = "");
410
411 /**
412 * Set the initial value of an Attribute.
413 *
414 * @param [in] i The attribute to manipulate
415 * @param [in] initialValue The new initial value to use for this attribute.
416 * @returns \c true if the call was successfully.
417 */
418 bool SetAttributeInitialValue(std::size_t i, Ptr<const AttributeValue> initialValue);
419
420 /**
421 * Record in this TypeId the fact that a new attribute exists.
422 *
423 * @param [in] name The name of the new attribute
424 * @param [in] help Some help text which describes the purpose of this
425 * attribute
426 * @param [in] flags Flags which describe how this attribute can be read and/or written.
427 * @param [in] initialValue The initial value for this attribute.
428 * @param [in] accessor An instance of the associated AttributeAccessor
429 * subclass.
430 * @param [in] checker An instance of the associated AttributeChecker
431 * subclass.
432 * @param [in] supportLevel Support/deprecation status of the attribute.
433 * @param [in] supportMsg Upgrade hint if this attribute is no longer
434 * supported. If the attribute is \c DEPRECATED the attribute
435 * behavior still exists, but user code should be updated
436 * following guidance in the hint..
437 * If the attribute is \c OBSOLETE, the hint should indicate
438 * which class the attribute functional has been moved to,
439 * or that the functionality is no longer supported.
440 * @returns This TypeId instance
441 */
442 TypeId AddAttribute(std::string name,
443 std::string help,
444 uint32_t flags,
445 const AttributeValue& initialValue,
449 const std::string& supportMsg = "");
450
451 /**
452 * Record a new TraceSource.
453 *
454 * @param [in] name The name of the new trace source
455 * @param [in] help Some help text which describes the purpose of this
456 * trace source.
457 * @param [in] accessor A pointer to a TraceSourceAccessor which can be
458 * used to connect/disconnect sinks to this trace source.
459 * @param [in] callback Fully qualified typedef name for the callback
460 * signature. Generally this should begin with the
461 * "ns3::" namespace qualifier.
462 * @param [in] supportLevel Support/deprecation status of the attribute.
463 * @param [in] supportMsg Upgrade hint if this attribute is no longer
464 * supported. If the attribute is \c DEPRECATED the attribute
465 * behavior still exists, but user code should be updated
466 * following guidance in the hint..
467 * If the attribute is \c OBSOLETE, the hint should indicate
468 * which class the attribute functional has been moved to,
469 * or that the functionality is no longer supported.
470 * See test file type-id-test-suite.cc for examples.
471 * @returns This TypeId instance.
472 */
473 TypeId AddTraceSource(std::string name,
474 std::string help,
476 std::string callback,
478 const std::string& supportMsg = "");
479
480 /**
481 * Hide this TypeId from documentation.
482 * @returns This TypeId instance.
483 */
485
486 /**
487 * Find an attribute by name in the inheritance tree for a given TypeId.
488 *
489 * @param [in] tid The TypeId to start the search from.
490 * @param [in] name The name of the attribute to search for.
491 * @return A tuple containing a boolean that indicates whether the attribute was found, the
492 * TypeId where the attribute was found, and the AttributeInformation of the found attribute.
493 */
494 static std::tuple<bool, TypeId, AttributeInformation> FindAttribute(const TypeId& tid,
495 const std::string& name);
496
497 /**
498 * Find an Attribute by name, retrieving the associated AttributeInformation.
499 *
500 * @param [in] name The name of the requested attribute
501 * @param [in,out] info A pointer to the TypeId::AttributeInformation
502 * data structure where the result value of this method
503 * will be stored.
504 * @param [in] permissive If false (by default), will generate warnings and errors for
505 * deprecated and obsolete attributes, respectively. If set to true, warnings for deprecated
506 * attributes will be suppressed.
507 * @returns \c true if the requested attribute could be found.
508 */
509 bool LookupAttributeByName(std::string name,
511 bool permissive = false) const;
512 /**
513 * Find a TraceSource by name.
514 *
515 * If no matching trace source is found, this method returns zero.
516 *
517 * @param [in] name The name of the requested trace source
518 * @return The trace source accessor which can be used to connect
519 * and disconnect trace sinks with the requested trace source on
520 * an object instance.
521 */
523 /**
524 * Find a TraceSource by name, retrieving the associated TraceSourceInformation.
525 *
526 * @param [in] name The name of the requested trace source.
527 * @param [out] info A pointer to the TypeId::TraceSourceInformation
528 * data structure where the result value of this method
529 * will be stored.
530 * @return The trace source accessor which can be used to connect
531 * and disconnect trace sinks with the requested trace source on
532 * an object instance.
533 */
535 TraceSourceInformation* info) const;
536
537 /**
538 * Get the internal id of this TypeId.
539 *
540 * @returns The internal integer which uniquely identifies this TypeId.
541 *
542 * This is really an internal method which users are not expected
543 * to use.
544 */
545 uint16_t GetUid() const;
546 /**
547 * Set the internal id of this TypeId.
548 *
549 * @param [in] uid The internal integer which uniquely identifies
550 * this TypeId. This TypeId should already have been registered.
551 *
552 * Typically this is used in serialization/deserialization.
553 *
554 * This method is even more internal than GetUid(). Use
555 * at your own risk and don't be surprised that it eats raw
556 * babies on full-moon nights.
557 */
558 void SetUid(uint16_t uid);
559
560 /** Default constructor. This produces an invalid TypeId. */
561 inline TypeId();
562 /**
563 * Copy constructor.
564 * @param [in] o The other TypeId.
565 */
566 inline TypeId(const TypeId& o);
567 /**
568 * Assignment.
569 * @param [in] o The other TypeId.
570 * @returns The copied TypeId.
571 */
572 inline TypeId& operator=(const TypeId& o);
573 /** Destructor. */
574 inline ~TypeId();
575
576 private:
577 /**
578 * @name Comparison operators.
579 * Standard comparison operators.
580 * @{
581 */
582 friend inline bool operator==(TypeId a, TypeId b);
583 friend inline bool operator!=(TypeId a, TypeId b);
584 friend bool operator<(TypeId a, TypeId b);
585 /**@}*/
586
587 /**
588 * Construct from an integer value.
589 * @param [in] tid The TypeId value as an integer.
590 */
591 explicit TypeId(uint16_t tid);
592 /**
593 * Implementation for AddConstructor().
594 *
595 * @param [in] callback Callback which constructs an instance of this TypeId.
596 */
598
599 /** The TypeId value. */
600 uint16_t m_tid;
601};
602
603/**
604 * @relates TypeId
605 * Output streamer.
606 *
607 * @param [in,out] os The output stream.
608 * @param [in] tid The TypeId.
609 * @returns The output stream.
610 */
611std::ostream& operator<<(std::ostream& os, TypeId tid);
612/**
613 * @relates TypeId
614 * Input Streamer.
615 * @param [in,out] is The input stream.
616 * @param [out] tid The TypeId to set from the stream.
617 * @returns The input stream.
618 */
619std::istream& operator>>(std::istream& is, TypeId& tid);
620
621/**
622 * @brief Stream insertion operator.
623 * @param [in] os The reference to the output stream.
624 * @param [in] level The TypeId::SupportLevel.
625 * @return The reference to the output stream.
626 */
627std::ostream& operator<<(std::ostream& os, TypeId::SupportLevel level);
628
629/**
630 * Comparison operator.
631 * @param [in] a One value.
632 * @param [in] b The other value.
633 * @returns The result of the comparison.
634 * @{
635 */
636inline bool operator==(TypeId a, TypeId b);
637inline bool operator!=(TypeId a, TypeId b);
638bool operator<(TypeId a, TypeId b);
639/** @} */
640
642
643} // namespace ns3
644
645namespace ns3
646{
647
649 : m_tid(0)
650{
651}
652
654 : m_tid(o.m_tid)
655{
656}
657
658TypeId&
660{
661 m_tid = o.m_tid;
662 return *this;
663}
664
666{
667}
668
669inline bool
671{
672 return a.m_tid == b.m_tid;
673}
674
675inline bool
677{
678 return a.m_tid != b.m_tid;
679}
680
681/*************************************************************************
682 * The TypeId implementation which depends on templates
683 *************************************************************************/
684
685template <typename T>
686TypeId
688{
689 return SetParent(T::GetTypeId());
690}
691
692template <typename T>
693TypeId
695{
696 struct Maker
697 {
698 static ObjectBase* Create()
699 {
700 ObjectBase* base = new T();
701 return base;
702 }
703 };
704
705 Callback<ObjectBase*> cb = MakeCallback(&Maker::Create);
707 return *this;
708}
709
710} // namespace ns3
711
712#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:422
Anchor the ns-3 type and attribute system.
Smart pointer class similar to boost::intrusive_ptr.
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:676
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
Deprecated support level simple enums.
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
Deprecated support level simple enums.
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:694
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:600
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:670
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:659
~TypeId()
Destructor.
Definition type-id.h:665
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:648
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
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.
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:687
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
#define NS_DEPRECATED_3_44(msg)
Tag for things deprecated in version ns-3.44.
Definition deprecated.h:91
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.
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:658
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:684
bool operator==(const EventId &a, const EventId &b)
Definition event-id.h:155
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
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.