88    void SetParent(uint16_t uid, uint16_t parent);
 
  100    void SetSize(uint16_t uid, std::size_t size);
 
  117    uint16_t 
GetUid(std::string name) 
const;
 
  129    std::string 
GetName(uint16_t uid) 
const;
 
  159    std::size_t 
GetSize(uint16_t uid) 
const;
 
  211                      const std::string& supportMsg = 
"");
 
  252                        std::string callback,
 
  254                        const std::string& supportMsg = 
"");
 
  329    typedef std::vector<IidInformation>::const_iterator 
Iterator;
 
 
  377#define IID "IidManager" 
  383#define IIDL IID << ": " 
  391                        "Trying to allocate twice the same uid: " << name);
 
  398                     << 
"This is not a bug, but is extremely unlikely.  " 
  399                     << 
"Please contact the ns3 developers.");
 
  413                      "Triplicate hash detected while chaining TypeId for '" 
  414                          << name << 
"'. Please contact the ns3 developers for assistance.");
 
  423        if (name > hinfo->
name)
 
  440    information.
name = name;
 
  441    information.
hash = hash;
 
  444    information.
size = (std::size_t)(-1);
 
  451    auto uid = 
static_cast<uint16_t
>(tuid);
 
 
  465                  "The uid " << uid << 
" for this TypeId is invalid");
 
 
  477    const auto [it, success] = 
m_namemap.insert({name, uid});
 
  479                  "Deprecated name " << name << 
" insertion failed (possibly a duplicate?)");
 
 
  489    information->
parent = parent;
 
 
  505    information->
size = size;
 
 
  563    return information->
name;
 
 
  590    uint16_t pid = information->
parent;
 
 
  609    std::size_t size = information->
size;
 
 
  622                                                    << 
" but it does not have one.");
 
 
  667        if (parent == information)
 
  674        information = parent;
 
 
  689                         const std::string& supportMsg)
 
  691    NS_LOG_FUNCTION(
IID << uid << name << help << flags << initialValue << accessor << checker
 
  692                        << supportLevel << supportMsg);
 
  694    if (name.find(
' ') != std::string::npos)
 
  696        NS_FATAL_ERROR(
"Attribute name \"" << name << 
"\" may not contain spaces ' ', " 
  697                                           << 
"encountered when registering TypeId \"" 
  698                                           << information->
name << 
"\"");
 
  702        NS_FATAL_ERROR(
"Attribute \"" << name << 
"\" already registered on tid=\"" 
  703                                      << information->
name << 
"\"");
 
 
  726    NS_ASSERT(i < information->attributes.size());
 
  727    information->
attributes[i].initialValue = initialValue;
 
 
  735    std::size_t size = information->
attributes.size();
 
 
  745    NS_ASSERT(i < information->attributes.size());
 
 
  766        if (parent == information)
 
  773        information = parent;
 
 
  784                           std::string callback,
 
  786                           const std::string& supportMsg)
 
  793        NS_FATAL_ERROR(
"Trace source \"" << name << 
"\" already registered on tid=\"" 
  794                                         << information->
name << 
"\"");
 
 
  822    NS_ASSERT(i < information->traceSources.size());
 
 
  866    NS_LOG_INFO(
"Set deprecated name " << name << 
" for TypeId " 
 
  876    NS_ASSERT_MSG(uid, 
"Assert in TypeId::LookupByName: " << name << 
" not found");
 
  879        std::cerr << 
"Deprecation warning for name " << name << 
"; use " 
 
  897        std::cerr << 
"Deprecation warning for name " << name << 
"; use " 
 
  908                  "Assert in TypeId::LookupByHash: 0x" << std::hex << hash << std::dec
 
 
  939std::tuple<bool, TypeId, TypeId::AttributeInformation>
 
  949            if (attributeInfo.
name == name)
 
  951                return {
true, currentTid, attributeInfo};
 
  957        if (parentTid == currentTid)
 
  962        currentTid = parentTid;
 
 
  970                              bool permissive)
 const 
  985                std::cerr << 
"Attribute '" << name << 
"' is deprecated: " << attribute.supportMsg
 
  994                           << name << 
"' is obsolete, with no fallback: " << attribute.supportMsg);
 
 
 1037    return parent != 
m_tid;
 
 
 1045    while (tmp != other && tmp != tmp.
GetParent())
 
 1049    return tmp == other && *
this != other;
 
 
 1088    return hasConstructor;
 
 
 1105                     const std::string& supportMsg)
 
 1107    NS_LOG_FUNCTION(
this << name << help << &initialValue << accessor << checker << supportLevel
 
 1113                                    initialValue.
Copy(),
 
 
 1129                     const std::string& supportMsg)
 
 1131    NS_LOG_FUNCTION(
this << name << help << flags << &initialValue << accessor << checker
 
 1132                         << supportLevel << supportMsg);
 
 1137                                    initialValue.
Copy(),
 
 
 1210                       std::string callback,
 
 1212                       const std::string& supportMsg)
 
 1214    NS_LOG_FUNCTION(
this << name << help << accessor << callback << supportLevel << supportMsg);
 
 
 1241            if (tmp.
name == name)
 
 1250                    std::cerr << 
"TraceSource '" << name << 
"' is deprecated: " << tmp.
supportMsg 
 1257                    NS_FATAL_ERROR(
"TraceSource '" << name << 
"' is obsolete, with no fallback: " 
 1263    } 
while (nextTid != tid);
 
 
 1310    std::string tidString;
 
 1315        is.setstate(std::ios_base::badbit);
 
 
 1326        return os << 
"SUPPORTED";
 
 1328        return os << 
"DEPRECATED";
 
 1330        return os << 
"OBSOLETE";
 
 1332    return os << 
"UNKNOWN(" << 
static_cast<uint32_t>(level) << 
")";
 
 
Hold a value for an Attribute.
virtual Ptr< AttributeValue > Copy() const =0
Generic Hash function interface.
uint32_t GetHash32(const char *buffer, const std::size_t size)
Compute 32-bit hash of a byte buffer.
Hasher & clear()
Restore initial state.
TypeId information manager.
TypeId::hash_t GetHash(uint16_t uid) const
Get the hash of a type id.
std::map< TypeId::hash_t, uint16_t > hashmap_t
Type of the by-hash index.
std::vector< IidInformation >::const_iterator Iterator
Iterator type.
uint16_t GetRegisteredN() const
Get the total number of type ids.
uint16_t GetParent(uint16_t uid) const
Get the parent of a type id.
void AddAttribute(uint16_t uid, std::string name, std::string help, uint32_t flags, Ptr< const AttributeValue > initialValue, Ptr< const AttributeAccessor > accessor, Ptr< const AttributeChecker > checker, TypeId::SupportLevel supportLevel=TypeId::SupportLevel::SUPPORTED, const std::string &supportMsg="")
Record a new attribute in a type id.
std::map< std::string, uint16_t > namemap_t
Type of the by-name index.
void SetAttributeInitialValue(uint16_t uid, std::size_t i, Ptr< const AttributeValue > initialValue)
Set the initial value of an Attribute.
void SetGroupName(uint16_t uid, std::string groupName)
Set the group name of a type id.
void SetParent(uint16_t uid, uint16_t parent)
Set the parent of a type id.
std::vector< IidInformation > m_information
The container of all type id records.
void SetSize(uint16_t uid, std::size_t size)
Set the size of the object class referred to by this id.
std::string GetGroupName(uint16_t uid) const
Get the group name of a type id.
bool HasTraceSource(uint16_t uid, std::string name)
Check if a type id has a given TraceSource.
uint16_t GetRegistered(uint16_t i) const
Get a type id by index.
@ HashChainFlag
Hash chaining flag.
Callback< ObjectBase * > GetConstructor(uint16_t uid) const
Get the constructor Callback of a type id.
void AddTraceSource(uint16_t uid, std::string name, std::string help, Ptr< const TraceSourceAccessor > accessor, std::string callback, TypeId::SupportLevel supportLevel=TypeId::SupportLevel::SUPPORTED, const std::string &supportMsg="")
Record a new TraceSource.
std::size_t GetAttributeN(uint16_t uid) const
Get the number of attributes.
uint16_t GetUid(std::string name) const
Get a type id by name.
void AddConstructor(uint16_t uid, Callback< ObjectBase * > callback)
Add a constructor Callback to this type id.
void HideFromDocumentation(uint16_t uid)
Mark this type id to be excluded from documentation.
std::string GetName(uint16_t uid) const
Get the name of a type id.
std::size_t GetTraceSourceN(uint16_t uid) const
Get the number of Trace sources.
std::size_t GetSize(uint16_t uid) const
Get the size of a type id.
TypeId::TraceSourceInformation GetTraceSource(uint16_t uid, std::size_t i) const
Get the trace source by index.
std::string GetDeprecatedName(uint16_t uid) const
Get the deprecated name of a type id.
bool MustHideFromDocumentation(uint16_t uid) const
Check if this TypeId should not be listed in documentation.
IidManager::IidInformation * LookupInformation(uint16_t uid) const
Retrieve the information record for a type.
bool HasConstructor(uint16_t uid) const
Check if a type id has a constructor Callback.
bool HasAttribute(uint16_t uid, std::string name)
Check if a type id has a given Attribute.
static TypeId::hash_t Hasher(const std::string name)
Hashing function.
void AddDeprecatedName(uint16_t uid, const std::string &name)
Add a deprecated name for the type id.
hashmap_t m_hashmap
The by-hash index.
uint16_t AllocateUid(std::string name)
Create a new unique type id.
TypeId::AttributeInformation GetAttribute(uint16_t uid, std::size_t i) const
Get Attribute information by index.
namemap_t m_namemap
The by-name index.
Smart pointer class similar to boost::intrusive_ptr.
Singleton(const Singleton< IidManager > &)=delete
static IidManager * Get()
a unique identifier for an interface.
bool IsChildOf(TypeId other) const
Check if this TypeId is a child of another.
std::size_t GetTraceSourceN() const
Get the number of Trace sources.
bool SetAttributeInitialValue(std::size_t i, Ptr< const AttributeValue > initialValue)
Set the initial value of an Attribute.
static TypeId LookupByName(std::string name)
Get a TypeId by name.
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.
bool HasParent() const
Check if this TypeId has a parent.
TypeId SetSize(std::size_t size)
Set the size of this type.
hash_t GetHash() const
Get the hash.
bool MustHideFromDocumentation() const
Check if this TypeId should not be listed in documentation.
TypeId AddDeprecatedName(const std::string &name)
Add an deprecated name for a TypeId.
@ ATTR_SGC
The attribute can be read, and written at any time.
static bool LookupByHashFailSafe(hash_t hash, TypeId *tid)
Get a TypeId by hash.
TypeId::TraceSourceInformation GetTraceSource(std::size_t i) const
Get the trace source by index.
std::string GetGroupName() const
Get the group name.
TypeId HideFromDocumentation()
Hide this TypeId from documentation.
Callback< ObjectBase * > GetConstructor() const
Get the constructor callback.
static uint16_t GetRegisteredN()
Get the number of registered TypeIds.
std::string GetAttributeFullName(std::size_t i) const
Get the Attribute name by index.
bool HasConstructor() const
Check if this TypeId has a constructor.
std::size_t GetAttributeN() const
Get the number of attributes.
TypeId GetParent() const
Get the parent of this TypeId.
void SetUid(uint16_t uid)
Set the internal id of this TypeId.
uint16_t m_tid
The TypeId value.
TypeId SetGroupName(std::string groupName)
Set the group name.
static TypeId LookupByHash(hash_t hash)
Get a TypeId by hash.
static TypeId GetRegistered(uint16_t i)
Get a TypeId by index.
std::size_t GetSize() const
Get the size of this object.
Ptr< const TraceSourceAccessor > LookupTraceSourceByName(std::string name) const
Find a TraceSource by name.
uint32_t hash_t
Type of hash values.
TypeId()
Default constructor.
TypeId::AttributeInformation GetAttribute(std::size_t i) const
Get Attribute information by index.
uint16_t GetUid() const
Get the internal id of this TypeId.
TypeId(const std::string &name)
Constructor.
static bool LookupByNameFailSafe(std::string name, TypeId *tid)
Get a TypeId by name.
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.
bool LookupAttributeByName(std::string name, AttributeInformation *info, bool permissive=false) const
Find an Attribute by name, retrieving the associated AttributeInformation.
SupportLevel
The level of support or deprecation for attributes or trace sources.
@ SUPPORTED
Attribute or trace source is currently used.
@ OBSOLETE
Attribute or trace source is not used anymore; simulation fails.
@ DEPRECATED
Attribute or trace source is deprecated; user is warned.
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.
std::string GetName() const
Get the name.
TypeId SetParent()
Set the parent TypeId.
void DoAddConstructor(Callback< ObjectBase * > callback)
Implementation for AddConstructor().
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type.
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
ns3::Hasher, ns3::Hash32() and ns3::Hash64() function declarations.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
std::istream & operator>>(std::istream &is, Angles &a)
bool operator<(const EventId &a, const EventId &b)
ns3::Singleton declaration and template implementation.
ns3::TraceSourceAccessor and ns3::MakeTraceSourceAccessor declarations.
ns3::TypeId declaration; inline and template implementations.