75 void SetParent (uint16_t uid, uint16_t parent);
77 void SetSize (uint16_t uid, std::size_t size);
80 uint16_t
GetUid (std::string name)
const;
82 std::string
GetName (uint16_t uid)
const;
86 std::size_t
GetSize (uint16_t uid)
const;
107 std::string callback);
129 typedef std::vector<struct IidInformation>::const_iterator
Iterator;
156 static ns3::Hasher hasher ( Create<Hash::Function::Murmur3> () );
166 "Trying to allocate twice the same uid: " << name);
170 NS_LOG_ERROR (
"Hash chaining TypeId for '" << name <<
"'. "
171 <<
"This is not a bug, but is extremely unlikely. "
172 <<
"Please contact the ns3 developers.");
186 "Triplicate hash detected while chaining TypeId for '"
188 <<
"'. Please contact the ns3 developers for assistance.");
197 if (name > hinfo->
name)
199 NS_LOG_LOGIC (
"New TypeId '" << name <<
"' getting chained.");
214 information.
name = name;
215 information.
hash = hash;
218 information.
size = (std::size_t)(-1);
226 m_namemap.insert (std::make_pair (name, uid));
227 m_hashmap.insert (std::make_pair (hash, uid));
245 information->
parent = parent;
259 information->
size = size;
286 namemap_t::const_iterator it =
m_namemap.find (name);
299 hashmap_t::const_iterator it =
m_hashmap.find (hash);
314 return information->
name;
321 return information->
hash;
328 return information->
parent;
342 return information->
size;
352 NS_FATAL_ERROR (
"Requested constructor for "<<information->
name<<
" but it does not have one.");
386 for (std::vector<struct TypeId::AttributeInformation>::const_iterator i = information->
attributes.begin ();
395 if (parent == information)
401 information = parent;
415 NS_LOG_FUNCTION (
this << uid << name << help << flags << initialValue << accessor << checker);
419 NS_FATAL_ERROR (
"Attribute \"" << name <<
"\" already registered on tid=\"" <<
420 information->
name <<
"\"");
439 NS_ASSERT (i < information->attributes.size ());
440 information->
attributes[i].initialValue = initialValue;
457 NS_ASSERT (i < information->attributes.size ());
469 for (std::vector<struct TypeId::TraceSourceInformation>::const_iterator i = information->
traceSources.begin ();
478 if (parent == information)
484 information = parent;
494 std::string callback)
500 NS_FATAL_ERROR (
"Trace source \"" << name <<
"\" already registered on tid=\"" <<
501 information->
name <<
"\"");
522 NS_ASSERT (i < information->traceSources.size ());
560 NS_ASSERT_MSG (uid != 0,
"Assert in TypeId::LookupByName: " << name <<
" not found");
579 NS_ASSERT_MSG (uid != 0,
"Assert in TypeId::LookupByHash: 0x"
580 << std::hex << hash << std::dec <<
" not found");
619 if (tmp.
name == name)
626 }
while (nextTid != tid);
663 return parent !=
m_tid;
670 while (tmp != other && tmp != tmp.
GetParent ())
674 return tmp == other && *
this != other;
711 return hasConstructor;
728 NS_LOG_FUNCTION (
this << name << help << &initialValue << accessor << checker);
741 NS_LOG_FUNCTION (
this << name << help << flags << &initialValue << accessor << checker);
811 return AddTraceSource (name, help, accessor,
"(not yet documented)");
818 std::string callback)
845 if (info.
name == name)
851 }
while (nextTid != tid);
875 std::string tidString;
880 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.
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