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 * Record in this TypeId the fact that a new attribute exists.
430 *
431 * @param [in] name The name of the new attribute
432 * @param [in] help Some help text which describes the purpose of this
433 * attribute
434 * @param [in] flags Flags which describe how this attribute can be read and/or written.
435 * @param [in] initialValue The initial value for this attribute.
436 * @param [in] accessor An instance of the associated AttributeAccessor
437 * subclass.
438 * @param [in] checker An instance of the associated AttributeChecker
439 * subclass.
440 * @param [in] supportLevel Support/deprecation status of the attribute.
441 * @param [in] supportMsg Upgrade hint if this attribute is no longer
442 * supported. If the attribute is \c DEPRECATED the attribute
443 * behavior still exists, but user code should be updated
444 * following guidance in the hint..
445 * If the attribute is \c OBSOLETE, the hint should indicate
446 * which class the attribute functional has been moved to,
447 * or that the functionality is no longer supported.
448 * @returns This TypeId instance
449 */
450 TypeId AddAttribute(std::string name,
451 std::string help,
452 uint32_t flags,
453 const AttributeValue& initialValue,
457 const std::string& supportMsg = "");
458
459 /**
460 * Record a new TraceSource.
461 *
462 * @param [in] name The name of the new trace source
463 * @param [in] help Some help text which describes the purpose of this
464 * trace source.
465 * @param [in] accessor A pointer to a TraceSourceAccessor which can be
466 * used to connect/disconnect sinks to this trace source.
467 * @param [in] callback Fully qualified typedef name for the callback
468 * signature. Generally this should begin with the
469 * "ns3::" namespace qualifier.
470 * @param [in] supportLevel Support/deprecation status of the attribute.
471 * @param [in] supportMsg Upgrade hint if this attribute is no longer
472 * supported. If the attribute is \c DEPRECATED the attribute
473 * behavior still exists, but user code should be updated
474 * following guidance in the hint..
475 * If the attribute is \c OBSOLETE, the hint should indicate
476 * which class the attribute functional has been moved to,
477 * or that the functionality is no longer supported.
478 * See test file type-id-test-suite.cc for examples.
479 * @returns This TypeId instance.
480 */
481 TypeId AddTraceSource(std::string name,
482 std::string help,
484 std::string callback,
486 const std::string& supportMsg = "");
487
488 /**
489 * Hide this TypeId from documentation.
490 * @returns This TypeId instance.
491 */
493
494 /**
495 * Find an attribute by name in the inheritance tree for a given TypeId.
496 *
497 * @param [in] tid The TypeId to start the search from.
498 * @param [in] name The name of the attribute to search for.
499 * @return A tuple containing a boolean that indicates whether the attribute was found, the
500 * TypeId where the attribute was found, and the AttributeInformation of the found attribute.
501 */
502 static std::tuple<bool, TypeId, AttributeInformation> FindAttribute(const TypeId& tid,
503 const std::string& name);
504
505 /**
506 * Find an Attribute by name, retrieving the associated AttributeInformation.
507 *
508 * @param [in] name The name of the requested attribute
509 * @param [in,out] info A pointer to the TypeId::AttributeInformation
510 * data structure where the result value of this method
511 * will be stored.
512 * @param [in] permissive If false (by default), will generate warnings and errors for
513 * deprecated and obsolete attributes, respectively. If set to true, warnings for deprecated
514 * attributes will be suppressed.
515 * @returns \c true if the requested attribute could be found.
516 */
517 bool LookupAttributeByName(std::string name,
519 bool permissive = false) const;
520 /**
521 * Find a TraceSource by name.
522 *
523 * If no matching trace source is found, this method returns zero.
524 *
525 * @param [in] name The name of the requested trace source
526 * @return The trace source accessor which can be used to connect
527 * and disconnect trace sinks with the requested trace source on
528 * an object instance.
529 */
531 /**
532 * Find a TraceSource by name, retrieving the associated TraceSourceInformation.
533 *
534 * @param [in] name The name of the requested trace source.
535 * @param [out] info A pointer to the TypeId::TraceSourceInformation
536 * data structure where the result value of this method
537 * will be stored.
538 * @return The trace source accessor which can be used to connect
539 * and disconnect trace sinks with the requested trace source on
540 * an object instance.
541 */
543 TraceSourceInformation* info) const;
544
545 /**
546 * Get the internal id of this TypeId.
547 *
548 * @returns The internal integer which uniquely identifies this TypeId.
549 *
550 * This is really an internal method which users are not expected
551 * to use.
552 */
553 uint16_t GetUid() const;
554 /**
555 * Set the internal id of this TypeId.
556 *
557 * @param [in] uid The internal integer which uniquely identifies
558 * this TypeId. This TypeId should already have been registered.
559 *
560 * Typically this is used in serialization/deserialization.
561 *
562 * This method is even more internal than GetUid(). Use
563 * at your own risk and don't be surprised that it eats raw
564 * babies on full-moon nights.
565 */
566 void SetUid(uint16_t uid);
567
568 /** Default constructor. This produces an invalid TypeId. */
569 inline TypeId();
570 /**
571 * Copy constructor.
572 * @param [in] o The other TypeId.
573 */
574 inline TypeId(const TypeId& o);
575 /**
576 * Assignment.
577 * @param [in] o The other TypeId.
578 * @returns The copied TypeId.
579 */
580 inline TypeId& operator=(const TypeId& o);
581 /** Destructor. */
582 inline ~TypeId();
583
584 private:
585 /**
586 * @name Comparison operators.
587 * Standard comparison operators.
588 * @{
589 */
590 friend inline bool operator==(TypeId a, TypeId b);
591 friend inline bool operator!=(TypeId a, TypeId b);
592 friend bool operator<(TypeId a, TypeId b);
593 /**@}*/
594
595 /**
596 * Construct from an integer value.
597 * @param [in] tid The TypeId value as an integer.
598 */
599 explicit TypeId(uint16_t tid);
600 /**
601 * Implementation for AddConstructor().
602 *
603 * @param [in] callback Callback which constructs an instance of this TypeId.
604 */
606
607 /** The TypeId value. */
608 uint16_t m_tid;
609};
610
611/**
612 * @relates TypeId
613 * Output streamer.
614 *
615 * @param [in,out] os The output stream.
616 * @param [in] tid The TypeId.
617 * @returns The output stream.
618 */
619std::ostream& operator<<(std::ostream& os, TypeId tid);
620/**
621 * @relates TypeId
622 * Input Streamer.
623 * @param [in,out] is The input stream.
624 * @param [out] tid The TypeId to set from the stream.
625 * @returns The input stream.
626 */
627std::istream& operator>>(std::istream& is, TypeId& tid);
628
629/**
630 * @brief Stream insertion operator.
631 * @param [in] os The reference to the output stream.
632 * @param [in] level The TypeId::SupportLevel.
633 * @return The reference to the output stream.
634 */
635std::ostream& operator<<(std::ostream& os, TypeId::SupportLevel level);
636
637/**
638 * Comparison operator.
639 * @param [in] a One value.
640 * @param [in] b The other value.
641 * @returns The result of the comparison.
642 * @{
643 */
644inline bool operator==(TypeId a, TypeId b);
645inline bool operator!=(TypeId a, TypeId b);
646bool operator<(TypeId a, TypeId b);
647/** @} */
648
650
651} // namespace ns3
652
653namespace ns3
654{
655
657 : m_tid(0)
658{
659}
660
662 : m_tid(o.m_tid)
663{
664}
665
666TypeId&
668{
669 m_tid = o.m_tid;
670 return *this;
671}
672
674{
675}
676
677inline bool
679{
680 return a.m_tid == b.m_tid;
681}
682
683inline bool
685{
686 return a.m_tid != b.m_tid;
687}
688
689/*************************************************************************
690 * The TypeId implementation which depends on templates
691 *************************************************************************/
692
693template <typename T>
694TypeId
696{
697 return SetParent(T::GetTypeId());
698}
699
700template <typename T>
701TypeId
703{
704 struct Maker
705 {
706 static ObjectBase* Create()
707 {
708 ObjectBase* base = new T();
709 return base;
710 }
711 };
712
713 Callback<ObjectBase*> cb = MakeCallback(&Maker::Create);
715 return *this;
716}
717
718} // namespace ns3
719
720#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:1039
friend bool operator!=(TypeId a, TypeId b)
Comparison operator.
Definition type-id.h:684
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:1191
bool SetAttributeInitialValue(std::size_t i, Ptr< const AttributeValue > initialValue)
Set the initial value of an Attribute.
Definition type-id.cc:1144
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition type-id.cc:870
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:1097
bool HasParent() const
Check if this TypeId has a parent.
Definition type-id.cc:1031
TypeId SetSize(std::size_t size)
Set the size of this type.
Definition type-id.cc:1015
hash_t GetHash() const
Get the hash.
Definition type-id.cc:1067
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:1160
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:860
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:912
TypeId::TraceSourceInformation GetTraceSource(std::size_t i) const
Get the trace source by index.
Definition type-id.cc:1198
std::string GetGroupName() const
Get the group name.
Definition type-id.cc:1051
TypeId HideFromDocumentation()
Hide this TypeId from documentation.
Definition type-id.cc:1219
Callback< ObjectBase * > GetConstructor() const
Get the constructor callback.
Definition type-id.cc:1152
static uint16_t GetRegisteredN()
Get the number of registered TypeIds.
Definition type-id.cc:924
std::string GetAttributeFullName(std::size_t i) const
Get the Attribute name by index.
Definition type-id.cc:1183
bool HasConstructor() const
Check if this TypeId has a constructor.
Definition type-id.cc:1082
std::size_t GetAttributeN() const
Get the number of attributes.
Definition type-id.cc:1168
TypeId GetParent() const
Get the parent of this TypeId.
Definition type-id.cc:1023
TypeId AddConstructor()
Record in this TypeId the fact that the default constructor is accessible.
Definition type-id.h:702
void SetUid(uint16_t uid)
Set the internal id of this TypeId.
Definition type-id.cc:1280
uint16_t m_tid
The TypeId value.
Definition type-id.h:608
TypeId SetGroupName(std::string groupName)
Set the group name.
Definition type-id.cc:1007
static TypeId LookupByHash(hash_t hash)
Get a TypeId by hash.
Definition type-id.cc:902
static TypeId GetRegistered(uint16_t i)
Get a TypeId by index.
Definition type-id.cc:931
friend bool operator==(TypeId a, TypeId b)
Comparison operator.
Definition type-id.h:678
std::size_t GetSize() const
Get the size of this object.
Definition type-id.cc:1074
Ptr< const TraceSourceAccessor > LookupTraceSourceByName(std::string name) const
Find a TraceSource by name.
Definition type-id.cc:1266
TypeId & operator=(const TypeId &o)
Assignment.
Definition type-id.h:667
~TypeId()
Destructor.
Definition type-id.h:673
friend bool operator<(TypeId a, TypeId b)
Comparison operator.
Definition type-id.cc:1336
uint32_t hash_t
Type of hash values.
Definition type-id.h:126
TypeId()
Default constructor.
Definition type-id.h:656
TypeId::AttributeInformation GetAttribute(std::size_t i) const
Get Attribute information by index.
Definition type-id.cc:1176
uint16_t GetUid() const
Get the internal id of this TypeId.
Definition type-id.cc:1273
TypeId(const std::string &name)
Constructor.
Definition type-id.cc:844
static bool LookupByNameFailSafe(std::string name, TypeId *tid)
Get a TypeId by name.
Definition type-id.cc:884
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:1205
bool LookupAttributeByName(std::string name, AttributeInformation *info, bool permissive=false) const
Find an Attribute by name, retrieving the associated AttributeInformation.
Definition type-id.cc:966
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:938
std::string GetName() const
Get the name.
Definition type-id.cc:1059
TypeId SetParent()
Set the parent TypeId.
Definition type-id.h:695
void DoAddConstructor(Callback< ObjectBase * > callback)
Implementation for AddConstructor().
Definition type-id.cc:1090
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: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: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.