NS-3
ns3::TypeId Class Reference

a unique identifier for an interface. More...

#include <type-id.h>

List of all members.

Classes

struct  AttributeInformation
struct  TraceSourceInformation

Public Types

enum  AttributeFlag { ATTR_GET = 1<<0, ATTR_SET = 1<<1, ATTR_CONSTRUCT = 1<<2, ATTR_SGC = ATTR_GET | ATTR_SET | ATTR_CONSTRUCT }

Public Member Functions

 TypeId (const char *name)
TypeId GetParent (void) const
bool HasParent (void) const
bool IsChildOf (TypeId other) const
std::string GetGroupName (void) const
std::string GetName (void) const
bool HasConstructor (void) const
uint32_t GetAttributeN (void) const
struct TypeId::AttributeInformation GetAttribute (uint32_t i) const
std::string GetAttributeFullName (uint32_t i) const
Callback< ObjectBase * > GetConstructor (void) const
bool MustHideFromDocumentation (void) const
uint32_t GetTraceSourceN (void) const
struct
TypeId::TraceSourceInformation 
GetTraceSource (uint32_t i) const
TypeId SetParent (TypeId tid)
template<typename T >
TypeId SetParent (void)
TypeId SetGroupName (std::string groupName)
template<typename T >
TypeId AddConstructor (void)
TypeId AddAttribute (std::string name, std::string help, const AttributeValue &initialValue, Ptr< const AttributeAccessor > accessor, Ptr< const AttributeChecker > checker)
bool SetAttributeInitialValue (uint32_t i, Ptr< const AttributeValue > initialValue)
TypeId AddAttribute (std::string name, std::string help, uint32_t flags, const AttributeValue &initialValue, Ptr< const AttributeAccessor > accessor, Ptr< const AttributeChecker > checker)
TypeId AddTraceSource (std::string name, std::string help, Ptr< const TraceSourceAccessor > accessor)
TypeId HideFromDocumentation (void)
bool LookupAttributeByName (std::string name, struct AttributeInformation *info) const
Ptr< const TraceSourceAccessorLookupTraceSourceByName (std::string name) const
uint16_t GetUid (void) const
void SetUid (uint16_t tid)
 TypeId (const TypeId &o)
TypeIdoperator= (const TypeId &o)

Static Public Member Functions

static TypeId LookupByName (std::string name)
static bool LookupByNameFailSafe (std::string name, TypeId *tid)
static uint32_t GetRegisteredN (void)
static TypeId GetRegistered (uint32_t i)

Friends

class AttributeList
bool operator== (TypeId a, TypeId b)
bool operator!= (TypeId a, TypeId b)
bool operator< (TypeId a, TypeId b)

Detailed Description

a unique identifier for an interface.

This class records a lot of meta-information about a subclass of the Object base class:

  • the base class of the subclass
  • the set of accessible constructors in the subclass
  • the set of 'attributes' accessible in the subclass

Member Enumeration Documentation

Flags describing when a given attribute can be read or written

Enumerator:
ATTR_GET 

The attribute can be read

ATTR_SET 

The attribute can be written

ATTR_CONSTRUCT 

The attribute can be written at construction-time

ATTR_SGC 

The attribute can be read, and written at any time


Constructor & Destructor Documentation

ns3::TypeId::TypeId ( const char *  name) [explicit]
Parameters:
namethe name of the interface to construct.

No two instances can share the same name. The name is expected to be the full c++ typename of associated c++ object.


Member Function Documentation

TypeId ns3::TypeId::AddAttribute ( std::string  name,
std::string  help,
const AttributeValue initialValue,
Ptr< const AttributeAccessor accessor,
Ptr< const AttributeChecker checker 
)
Parameters:
namethe name of the new attribute
helpsome help text which describes the purpose of this attribute.
initialValuethe initial value for this attribute.
accessoran instance of the associated AttributeAccessor subclass.
checkeran instance of the associated AttributeChecker subclass.
Returns:
this TypeId instance

Record in this TypeId the fact that a new attribute exists.

TypeId ns3::TypeId::AddAttribute ( std::string  name,
std::string  help,
uint32_t  flags,
const AttributeValue initialValue,
Ptr< const AttributeAccessor accessor,
Ptr< const AttributeChecker checker 
)
Parameters:
namethe name of the new attribute
helpsome help text which describes the purpose of this attribute
flagsflags which describe how this attribute can be read and/or written.
initialValuethe initial value for this attribute.
accessoran instance of the associated AttributeAccessor subclass.
checkeran instance of the associated AttributeChecker subclass.
Returns:
this TypeId instance

Record in this TypeId the fact that a new attribute exists.

template<typename T >
TypeId ns3::TypeId::AddConstructor ( void  )
Returns:
this TypeId instance

Record in this TypeId the fact that the default constructor is accessible.

TypeId ns3::TypeId::AddTraceSource ( std::string  name,
std::string  help,
Ptr< const TraceSourceAccessor accessor 
)
Parameters:
namethe name of the new trace source
helpsome help text which describes the purpose of this trace source.
accessora pointer to a TraceSourceAccessor which can be used to connect/disconnect sinks to this trace source.
Returns:
this TypeId instance.
struct TypeId::AttributeInformation ns3::TypeId::GetAttribute ( uint32_t  i) const [read]
Parameters:
iindex into attribute array
Returns:
the information associated to attribute whose index is i.
std::string ns3::TypeId::GetAttributeFullName ( uint32_t  i) const
Parameters:
iindex into attribute array
Returns:
the full name associated to the attribute whose index is i.
uint32_t ns3::TypeId::GetAttributeN ( void  ) const
Returns:
the number of attributes associated to this TypeId
Callback<ObjectBase *> ns3::TypeId::GetConstructor ( void  ) const
Returns:
a callback which can be used to instanciate an object of this type.
std::string ns3::TypeId::GetGroupName ( void  ) const
Returns:
the name of the group associated to this TypeId.
std::string ns3::TypeId::GetName ( void  ) const
Returns:
the name of this interface.
TypeId ns3::TypeId::GetParent ( void  ) const
Returns:
the parent of this TypeId

This method cannot fail. It will return itself if this TypeId has no parent. i.e., it is at the top of the TypeId hierarchy. Currently, this is the case for the TypeId associated to the Object class only.

static TypeId ns3::TypeId::GetRegistered ( uint32_t  i) [static]
Parameters:
iindex
Returns:
the TypeId instance whose index is i.
static uint32_t ns3::TypeId::GetRegisteredN ( void  ) [static]
Returns:
the number of TypeId instances registered.
struct TypeId::TraceSourceInformation ns3::TypeId::GetTraceSource ( uint32_t  i) const [read]
Parameters:
iindex into trace source array.
Returns:
detailed information about the requested trace source.
uint32_t ns3::TypeId::GetTraceSourceN ( void  ) const
Returns:
the number of trace sources defined in this TypeId.
uint16_t ns3::TypeId::GetUid ( void  ) const
Returns:
the internal integer which uniquely identifies this TypeId.

This is really an internal method which users are not expected to use.

bool ns3::TypeId::HasConstructor ( void  ) const
Returns:
true if this TypeId has a constructor
bool ns3::TypeId::IsChildOf ( TypeId  other) const
Parameters:
othera parent TypeId
Returns:
true if the input TypeId is really a parent of this TypeId, false otherwise.

Calling this method is roughly similar to calling dynamic_cast except that you do not need object instances: you can do the check with TypeId instances instead.

bool ns3::TypeId::LookupAttributeByName ( std::string  name,
struct AttributeInformation info 
) const
Parameters:
namethe name of the requested attribute
infoa pointer to the TypeId::AttributeInformation data structure where the result value of this method will be stored.
Returns:
true if the requested attribute could be found, false otherwise.
static TypeId ns3::TypeId::LookupByName ( std::string  name) [static]
Parameters:
namethe name of the requested TypeId
Returns:
the unique id associated with the requested name.

This method cannot fail: it will crash if the input name is not a valid TypeId name.

static bool ns3::TypeId::LookupByNameFailSafe ( std::string  name,
TypeId tid 
) [static]
Parameters:
namethe name of the requested TypeId
tida pointer to the TypeId instance where the result of this function should be stored.
Returns:
true if the requested name was found, false otherwise.
Ptr<const TraceSourceAccessor> ns3::TypeId::LookupTraceSourceByName ( std::string  name) const
Parameters:
namethe name of the requested trace source
Returns:
the trace source accessor which can be used to connect and disconnect trace sinks with the requested trace source on an object instance.

If no matching trace source is found, this method returns zero.

bool ns3::TypeId::MustHideFromDocumentation ( void  ) const
Returns:
true if this TypeId should be hidden from the user, false otherwise.
bool ns3::TypeId::SetAttributeInitialValue ( uint32_t  i,
Ptr< const AttributeValue initialValue 
)
Parameters:
ithe attribute to manipulate
initialValuethe new initial value to use for this attribute.
Returns:
true if the call was successfuly, false otherwise.
TypeId ns3::TypeId::SetGroupName ( std::string  groupName)
Parameters:
groupNamethe name of the group this TypeId belongs to.
Returns:
this TypeId instance.

The group name is purely an advisory information used to group together types according to a user-specific grouping scheme.

template<typename T >
TypeId ns3::TypeId::SetParent ( void  )
Returns:
this TypeId instance.

Record in this TypeId which TypeId is the TypeId of the base class of the subclass.

TypeId ns3::TypeId::SetParent ( TypeId  tid)
Parameters:
tidthe TypeId of the base class.
Returns:
this TypeId instance.

Record in this TypeId which TypeId is the TypeId of the base class of the subclass.

void ns3::TypeId::SetUid ( uint16_t  tid)
Parameters:
tidthe internal integer which uniquely identifies this TypeId.

This method is even more internal than TypeId::GetUid. Use at your own risk and don't be surprised that it eats raw babies on full-moon nights.


The documentation for this class was generated from the following file: