82 void SetParent (uint16_t uid, uint16_t parent);
84 void SetSize (uint16_t uid, std::size_t size);
87 uint16_t
GetUid (std::string name)
const;
89 std::string
GetName (uint16_t uid)
const;
93 std::size_t
GetSize (uint16_t uid)
const;
114 std::string callback);
136 typedef std::vector<struct IidInformation>::const_iterator
Iterator;
163 static ns3::Hasher hasher ( Create<Hash::Function::Murmur3> () );
173 "Trying to allocate twice the same uid: " << name);
177 NS_LOG_ERROR (
"Hash chaining TypeId for '" << name <<
"'. "
178 <<
"This is not a bug, but is extremely unlikely. "
179 <<
"Please contact the ns3 developers.");
193 "Triplicate hash detected while chaining TypeId for '"
195 <<
"'. Please contact the ns3 developers for assistance.");
204 if (name > hinfo->
name)
206 NS_LOG_LOGIC (
"New TypeId '" << name <<
"' getting chained.");
221 information.
name = name;
222 information.
hash = hash;
225 information.
size = (std::size_t)(-1);
233 m_namemap.insert (std::make_pair (name, uid));
234 m_hashmap.insert (std::make_pair (hash, uid));
252 information->
parent = parent;
266 information->
size = size;
293 namemap_t::const_iterator it =
m_namemap.find (name);
306 hashmap_t::const_iterator it =
m_hashmap.find (hash);
321 return information->
name;
328 return information->
hash;
335 return information->
parent;
349 return information->
size;
359 NS_FATAL_ERROR (
"Requested constructor for "<<information->
name<<
" but it does not have one.");
393 for (std::vector<struct TypeId::AttributeInformation>::const_iterator i = information->
attributes.begin ();
402 if (parent == information)
408 information = parent;
422 NS_LOG_FUNCTION (
this << uid << name << help << flags << initialValue << accessor << checker);
426 NS_FATAL_ERROR (
"Attribute \"" << name <<
"\" already registered on tid=\"" <<
427 information->
name <<
"\"");
446 NS_ASSERT (i < information->attributes.size ());
447 information->
attributes[i].initialValue = initialValue;
464 NS_ASSERT (i < information->attributes.size ());
476 for (std::vector<struct TypeId::TraceSourceInformation>::const_iterator i = information->
traceSources.begin ();
485 if (parent == information)
491 information = parent;
501 std::string callback)
507 NS_FATAL_ERROR (
"Trace source \"" << name <<
"\" already registered on tid=\"" <<
508 information->
name <<
"\"");
529 NS_ASSERT (i < information->traceSources.size ());
567 NS_ASSERT_MSG (uid != 0,
"Assert in TypeId::LookupByName: " << name <<
" not found");
586 NS_ASSERT_MSG (uid != 0,
"Assert in TypeId::LookupByHash: 0x"
587 << std::hex << hash << std::dec <<
" not found");
626 if (tmp.
name == name)
633 }
while (nextTid != tid);
670 return parent !=
m_tid;
677 while (tmp != other && tmp != tmp.
GetParent ())
681 return tmp == other && *
this != other;
718 return hasConstructor;
735 NS_LOG_FUNCTION (
this << name << help << &initialValue << accessor << checker);
748 NS_LOG_FUNCTION (
this << name << help << flags << &initialValue << accessor << checker);
818 return AddTraceSource (name, help, accessor,
"(not yet documented)");
825 std::string callback)
852 if (info.
name == name)
858 }
while (nextTid != tid);
882 std::string tidString;
887 is.setstate (std::ios_base::badbit);
uint32_t GetAttributeN(void) const
static TypeId::hash_t Hasher(const std::string name)
uint32_t hash_t
Type of hash values.
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
TypeId AddTraceSource(std::string name, std::string help, Ptr< const TraceSourceAccessor > accessor) NS_DEPRECATED
bool HasAttribute(uint16_t uid, std::string name)
Callback< ObjectBase * > GetConstructor(uint16_t uid) const
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
ns3::Singleton declaration and template implementation.
bool HasTraceSource(uint16_t uid, std::string name)
std::vector< struct IidInformation > m_information
std::string GetGroupName(uint16_t uid) const
static TypeId LookupByHash(hash_t hash)
std::map< TypeId::hash_t, uint16_t > hashmap_t
Hold a value for an Attribute.
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type.
void SetGroupName(uint16_t uid, std::string groupName)
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
TypeId GetParent(void) const
#define NS_FATAL_ERROR(msg)
Fatal error handling.
static bool LookupByNameFailSafe(std::string name, TypeId *tid)
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
void AddTraceSource(uint16_t uid, std::string name, std::string help, Ptr< const TraceSourceAccessor > accessor, std::string callback)
uint32_t GetRegisteredN(void) const
ns3::Hasher, ns3::Hash32() and ns3::Hash64() function declarations.
The attribute can be read, and written at any time.
static T * Get(void)
Get a pointer to the singleton instance.
Callback< ObjectBase * > GetConstructor(void) const
static bool LookupByHashFailSafe(hash_t hash, TypeId *tid)
bool HasConstructor(void) const
bool MustHideFromDocumentation(void) const
TypeId information manager.
static uint32_t GetRegisteredN(void)
Ptr< const TraceSourceAccessor > LookupTraceSourceByName(std::string name) const
uint32_t GetAttributeN(uint16_t uid) const
bool HasParent(void) const
uint32_t GetHash32(const char *buffer, const size_t size)
Compute 32-bit hash of a byte buffer.
uint32_t GetTraceSourceN(void) const
static TypeId GetRegistered(uint32_t i)
uint32_t GetTraceSourceN(uint16_t uid) const
void AddAttribute(uint16_t uid, std::string name, std::string help, uint32_t flags, Ptr< const AttributeValue > initialValue, Ptr< const AttributeAccessor > spec, Ptr< const AttributeChecker > checker)
void SetAttributeInitialValue(uint16_t uid, uint32_t i, Ptr< const AttributeValue > initialValue)
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
void HideFromDocumentation(uint16_t uid)
bool MustHideFromDocumentation(uint16_t uid) const
bool operator<(const int64x64_t &lhs, const int64x64_t &rhs)
Less than operator.
TypeId SetGroupName(std::string groupName)
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
TypeId AddAttribute(std::string name, std::string help, const AttributeValue &initialValue, Ptr< const AttributeAccessor > accessor, Ptr< const AttributeChecker > checker)
virtual Ptr< AttributeValue > Copy(void) const =0
Hasher & clear(void)
Restore initial state.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetUid(uint16_t tid)
bool LookupAttributeByName(std::string name, struct AttributeInformation *info) const
ns3::TraceSourceAccessor and ns3::MakeTraceSourceAccessor declarations.
ns3::TypeId declaration; inline and template implementations.
std::map< std::string, uint16_t > namemap_t
uint16_t GetRegistered(uint32_t i) const
std::string GetName(void) const
uint16_t GetUid(void) const
void DoAddConstructor(Callback< ObjectBase * > callback)
hash_t GetHash(void) const
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
bool SetAttributeInitialValue(uint32_t i, Ptr< const AttributeValue > initialValue)
uint16_t AllocateUid(std::string name)
void SetParent(uint16_t uid, uint16_t parent)
std::size_t GetSize(void) const
uint16_t GetParent(uint16_t uid) const
void SetSize(uint16_t uid, std::size_t size)
TypeId SetSize(std::size_t size)
Set the size of this type, based on the sizeof operator.
std::string GetName(uint16_t uid) const
TypeId::hash_t GetHash(uint16_t uid) const
std::string GetAttributeFullName(uint32_t i) const
bool HasConstructor(uint16_t uid) const
bool IsChildOf(TypeId other) const
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
struct TypeId::TraceSourceInformation GetTraceSource(uint32_t i) const
std::string GetGroupName(void) const
struct IidManager::IidInformation * LookupInformation(uint16_t uid) const
struct TypeId::AttributeInformation GetAttribute(uint32_t i) const
void AddConstructor(uint16_t uid, Callback< ObjectBase * > callback)
a unique identifier for an interface.
std::vector< struct IidInformation >::const_iterator Iterator
std::size_t GetSize(uint16_t uid) const
Generic Hash function interface.
TypeId HideFromDocumentation(void)
static TypeId LookupByName(std::string name)
uint16_t GetUid(std::string name) const