A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ns3::TypeId Class Reference

a unique identifier for an interface. More...

#include <type-id.h>

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

Static Public Member Functions

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

Private Member Functions

 TypeId (uint16_t tid)
 
void DoAddConstructor (Callback< ObjectBase * > callback)
 

Private Attributes

uint16_t m_tid
 

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

Definition at line 44 of file type-id.h.

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

Definition at line 50 of file type-id.h.

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.

Definition at line 400 of file type-id.cc.

References NS_ASSERT, and NS_LOG_FUNCTION.

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.

Definition at line 541 of file type-id.cc.

References ATTR_SGC, ns3::AttributeValue::Copy(), and NS_LOG_FUNCTION.

Referenced by ns3::Ns3NscStack::GetInstanceTypeId().

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.

Definition at line 553 of file type-id.cc.

References ns3::AttributeValue::Copy(), and NS_LOG_FUNCTION.

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.

Definition at line 626 of file type-id.cc.

References NS_LOG_FUNCTION.

struct TypeId::AttributeInformation ns3::TypeId::GetAttribute ( uint32_t  i) const
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.

Definition at line 605 of file type-id.cc.

References GetAttribute(), GetName(), and NS_LOG_FUNCTION.

Referenced by ns3::cell_edited_callback_config_default(), and ns3::ObjectBase::ConstructSelf().

uint32_t ns3::TypeId::GetAttributeN ( void  ) const
Callback< ObjectBase * > ns3::TypeId::GetConstructor ( void  ) const
Returns
a callback which can be used to instanciate an object of this type.

Definition at line 576 of file type-id.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::ObjectFactory::Create(), ns3::Packet::Print(), ns3::Packet::PrintByteTags(), and ns3::Packet::PrintPacketTags().

std::string ns3::TypeId::GetGroupName ( void  ) const
Returns
the name of the group associated to this TypeId.

Definition at line 510 of file type-id.cc.

References NS_LOG_FUNCTION.

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.

Definition at line 485 of file type-id.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::cell_tooltip_callback(), ns3::ObjectBase::ConstructSelf(), IsChildOf(), LookupAttributeByName(), and LookupTraceSourceByName().

TypeId ns3::TypeId::GetRegistered ( uint32_t  i)
static
Parameters
iindex
Returns
the TypeId instance whose index is i.

Definition at line 442 of file type-id.cc.

References NS_LOG_FUNCTION.

Referenced by StaticInformation::DoGather(), ns3::AttributeDefaultIterator::Iterate(), and ns3::Config::Reset().

uint32_t ns3::TypeId::GetRegisteredN ( void  )
static
Returns
the number of TypeId instances registered.

Definition at line 436 of file type-id.cc.

References NS_LOG_FUNCTION_NOARGS.

Referenced by StaticInformation::DoGather(), ns3::AttributeDefaultIterator::Iterate(), and ns3::Config::Reset().

struct TypeId::TraceSourceInformation ns3::TypeId::GetTraceSource ( uint32_t  i) const
Parameters
iindex into trace source array.
Returns
detailed information about the requested trace source.

Definition at line 619 of file type-id.cc.

References NS_LOG_FUNCTION.

Referenced by LookupTraceSourceByName().

uint32_t ns3::TypeId::GetTraceSourceN ( void  ) const
Returns
the number of trace sources defined in this TypeId.

Definition at line 613 of file type-id.cc.

References NS_LOG_FUNCTION.

Referenced by LookupTraceSourceByName().

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.

Definition at line 666 of file type-id.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::ByteTagList::Add().

bool ns3::TypeId::HasConstructor ( void  ) const
Returns
true if this TypeId has a constructor

Definition at line 526 of file type-id.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::Packet::Print(), and ns3::Packet::PrintPacketTags().

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.

Definition at line 499 of file type-id.cc.

References GetParent(), and NS_LOG_FUNCTION.

Referenced by StaticInformation::DoGather().

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.

Definition at line 449 of file type-id.cc.

References GetAttribute(), GetAttributeN(), GetParent(), and NS_LOG_FUNCTION.

Referenced by ns3::ObjectFactory::Set().

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.

Definition at line 423 of file type-id.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::Ns3NscStack::GetInstanceTypeId(), and ns3::Config::SetDefaultFailSafe().

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.

Definition at line 645 of file type-id.cc.

References GetParent(), GetTraceSource(), GetTraceSourceN(), and NS_LOG_FUNCTION.

Referenced by ns3::ObjectBase::TraceConnect(), ns3::ObjectBase::TraceConnectWithoutContext(), ns3::ObjectBase::TraceDisconnect(), and ns3::ObjectBase::TraceDisconnectWithoutContext().

bool ns3::TypeId::MustHideFromDocumentation ( void  ) const
Returns
true if this TypeId should be hidden from the user, false otherwise.

Definition at line 584 of file type-id.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::AttributeDefaultIterator::Iterate().

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.

Definition at line 566 of file type-id.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::Config::Reset(), and ns3::Config::SetDefaultFailSafe().

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.

Definition at line 478 of file type-id.cc.

References NS_LOG_FUNCTION.

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.

Definition at line 471 of file type-id.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::Ns3NscStack::GetInstanceTypeId(), ns3::Dot11sStack::GetTypeId(), ns3::PacketBurst::GetTypeId(), ns3::Ipv6ExtensionDemux::GetTypeId(), ns3::Ipv6OptionDemux::GetTypeId(), ns3::dot11s::PeerLink::GetTypeId(), ns3::MeshL2RoutingProtocol::GetTypeId(), ns3::Icmpv6L4Protocol::GetTypeId(), ns3::Ping6::GetTypeId(), ns3::Ipv6Option::GetTypeId(), ns3::MeshPointDevice::GetTypeId(), ns3::Radvd::GetTypeId(), ns3::Ipv6Extension::GetTypeId(), ns3::Ipv6ListRouting::GetTypeId(), ns3::NdiscCache::GetTypeId(), ns3::Ipv6Interface::GetTypeId(), ns3::MeshWifiInterfaceMac::GetTypeId(), ns3::Ipv4NixVectorRouting::GetTypeId(), ns3::MacStatsCalculator::GetTypeId(), ns3::Ipv6StaticRouting::GetTypeId(), ns3::Ipv6Header::GetTypeId(), ns3::PhyRxStatsCalculator::GetTypeId(), ns3::Ipv6L3Protocol::GetTypeId(), ns3::PhyTxStatsCalculator::GetTypeId(), ns3::PhyStatsCalculator::GetTypeId(), ns3::Ipv6RawSocketFactory::GetTypeId(), ns3::Ipv6RawSocketImpl::GetTypeId(), ns3::dsr::GraReply::GetTypeId(), ns3::dsr::DsrOptions::GetTypeId(), ns3::RadioBearerStatsCalculator::GetTypeId(), ns3::dsr::DsrRouting::GetTypeId(), ns3::Ipv6OptionPad1::GetTypeId(), ns3::Icmpv6Header::GetTypeId(), ns3::dsr::RreqTable::GetTypeId(), ns3::Ipv6OptionPadn::GetTypeId(), ns3::Ipv6ExtensionHopByHop::GetTypeId(), ns3::dsr::PassiveBuffer::GetTypeId(), ns3::Ipv6OptionJumbogram::GetTypeId(), ns3::Ipv6ExtensionDestination::GetTypeId(), ns3::Icmpv6OptionHeader::GetTypeId(), ns3::dsr::DsrOptionPad1::GetTypeId(), ns3::Ipv6OptionRouterAlert::GetTypeId(), ns3::Ipv6ExtensionFragment::GetTypeId(), ns3::dsr::DsrOptionPadn::GetTypeId(), ns3::dsr::RouteCache::GetTypeId(), ns3::dsr::DsrOptionRreq::GetTypeId(), ns3::Icmpv6NS::GetTypeId(), ns3::dsr::DsrOptionRrep::GetTypeId(), ns3::Ipv6ExtensionRouting::GetTypeId(), ns3::Icmpv6NA::GetTypeId(), ns3::dsr::DsrOptionSR::GetTypeId(), ns3::Ipv6ExtensionRoutingDemux::GetTypeId(), ns3::dsr::DsrOptionRerr::GetTypeId(), ns3::Ipv6ExtensionLooseRouting::GetTypeId(), ns3::GlobalRouter::GetTypeId(), ns3::Icmpv6RA::GetTypeId(), ns3::dsr::DsrOptionAckReq::GetTypeId(), ns3::Ipv6ExtensionESP::GetTypeId(), ns3::dsr::DsrOptionAck::GetTypeId(), ns3::Ipv6ExtensionAH::GetTypeId(), ns3::AnimByteTag::GetTypeId(), ns3::Icmpv6RS::GetTypeId(), ns3::Icmpv6Redirection::GetTypeId(), ns3::Icmpv6Echo::GetTypeId(), ns3::Icmpv6DestinationUnreachable::GetTypeId(), ns3::Icmpv6TooBig::GetTypeId(), ns3::Icmpv6TimeExceeded::GetTypeId(), ns3::Icmpv6ParameterError::GetTypeId(), ns3::Icmpv6OptionMtu::GetTypeId(), ns3::Icmpv6OptionPrefixInformation::GetTypeId(), ns3::Icmpv6OptionLinkLayerAddress::GetTypeId(), and ns3::Icmpv6OptionRedirected::GetTypeId().

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.

Definition at line 381 of file type-id.h.

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.

Definition at line 672 of file type-id.cc.

References NS_LOG_FUNCTION.


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