75 void SetParent (uint16_t uid, uint16_t parent);
79 uint16_t
GetUid (std::string name)
const;
81 std::string
GetName (uint16_t uid)
const;
125 typedef std::vector<struct IidInformation>::const_iterator
Iterator;
152 static ns3::Hasher hasher ( Create<Hash::Function::Murmur3> () );
162 "Trying to allocate twice the same uid: " << name);
166 NS_LOG_ERROR (
"Hash chaining TypeId for '" << name <<
"'. "
167 <<
"This is not a bug, but is extremely unlikely. "
168 <<
"Please contact the ns3 developers.");
182 "Triplicate hash detected while chaining TypeId for '"
184 <<
"'. Please contact the ns3 developers for assistance.");
193 if (name > hinfo->
name)
195 NS_LOG_LOGIC (
"New TypeId '" << name <<
"' getting chained.");
210 information.
name = name;
211 information.
hash = hash;
221 m_namemap.insert (std::make_pair (name, uid));
222 m_hashmap.insert (std::make_pair (hash, uid));
240 information->
parent = parent;
274 namemap_t::const_iterator it =
m_namemap.find (name);
287 hashmap_t::const_iterator it =
m_hashmap.find (hash);
302 return information->
name;
309 return information->
hash;
316 return information->
parent;
333 NS_FATAL_ERROR (
"Requested constructor for "<<information->
name<<
" but it does not have one.");
367 for (std::vector<struct TypeId::AttributeInformation>::const_iterator i = information->
attributes.begin ();
376 if (parent == information)
382 information = parent;
396 NS_LOG_FUNCTION (
this << uid << name << help << flags << initialValue << accessor << checker);
400 NS_FATAL_ERROR (
"Attribute \"" << name <<
"\" already registered on tid=\"" <<
401 information->
name <<
"\"");
420 NS_ASSERT (i < information->attributes.size ());
421 information->
attributes[i].initialValue = initialValue;
438 NS_ASSERT (i < information->attributes.size ());
439 return information->attributes[i];
450 for (std::vector<struct TypeId::TraceSourceInformation>::const_iterator i = information->
traceSources.begin ();
459 if (parent == information)
465 information = parent;
480 NS_FATAL_ERROR (
"Trace source \"" << name <<
"\" already registered on tid=\"" <<
481 information->
name <<
"\"");
501 NS_ASSERT (i < information->traceSources.size ());
502 return information->traceSources[i];
539 NS_ASSERT_MSG (uid != 0,
"Assert in TypeId::LookupByName: " << name <<
" not found");
558 NS_ASSERT_MSG (uid != 0,
"Assert in TypeId::LookupByHash: 0x"
559 << std::hex << hash << std::dec <<
" not found");
598 if (tmp.
name == name)
605 }
while (nextTid != tid);
635 return parent !=
m_tid;
642 while (tmp != other && tmp != tmp.
GetParent ())
646 return tmp == other && *
this != other;
676 return hasConstructor;
693 NS_LOG_FUNCTION (
this << name << help << &initialValue << accessor << checker);
706 NS_LOG_FUNCTION (
this << name << help << flags << &initialValue << accessor << checker);
801 if (info.
name == name)
807 }
while (nextTid != tid);
831 std::string tidString;
836 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
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 "...
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.
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.
uint32_t GetRegisteredN(void) const
The attribute can be read, and written at any time.
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.
void SetUid(uint16_t tid)
bool LookupAttributeByName(std::string name, struct AttributeInformation *info) const
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)
TypeId AddTraceSource(std::string name, std::string help, Ptr< const TraceSourceAccessor > accessor)
uint16_t AllocateUid(std::string name)
void SetParent(uint16_t uid, uint16_t parent)
uint16_t GetParent(uint16_t uid) const
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.
void AddTraceSource(uint16_t uid, std::string name, std::string help, Ptr< const TraceSourceAccessor > accessor)
struct TypeId::TraceSourceInformation GetTraceSource(uint32_t i) const
std::string GetGroupName(void) const
ATTRIBUTE_HELPER_CPP(ObjectFactory)
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
Generic Hash function interface.
TypeId HideFromDocumentation(void)
static TypeId LookupByName(std::string name)
uint16_t GetUid(std::string name) const