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

implement the ns-3 type and attribute system More...

#include <object-base.h>

+ Inheritance diagram for ns3::ObjectBase:

Public Member Functions

void GetAttribute (std::string name, AttributeValue &value) const
 
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
 
virtual TypeId GetInstanceTypeId (void) const =0
 
void SetAttribute (std::string name, const AttributeValue &value)
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 

Static Public Member Functions

static TypeId GetTypeId (void)
 

Protected Member Functions

void ConstructSelf (const AttributeConstructionList &attributes)
 
virtual void NotifyConstructionCompleted (void)
 

Private Member Functions

bool DoSet (Ptr< const AttributeAccessor > spec, Ptr< const AttributeChecker > checker, const AttributeValue &value)
 

Detailed Description

implement the ns-3 type and attribute system

Every class which wants to integrate in the ns-3 type and attribute system should derive from this base class. This base class provides:

  • a way to associate an ns3::TypeId to each object instance
  • a way to set and get the attributes registered in the ns3::TypeId.

Doxygen introspection did not find any typical Config paths.
No Attributes are defined for this type.
No TraceSources are defined for this type.

Definition at line 55 of file object-base.h.

Member Function Documentation

void ns3::ObjectBase::ConstructSelf ( const AttributeConstructionList attributes)
protected
Parameters
attributesthe attribute values used to initialize the member variables of this object's instance.

Invoked from subclasses to initialize all of their attribute members. This method will typically be invoked automatically from ns3::CreateObject if your class derives from ns3::Object. If you derive from ns3::ObjectBase directly, you should make sure that you invoke this method from your most-derived constructor.

Definition at line 65 of file object-base.cc.

References ns3::TypeId::ATTR_CONSTRUCT, ns3::TypeId::GetAttribute(), ns3::TypeId::GetAttributeFullName(), ns3::TypeId::GetAttributeN(), GetInstanceTypeId(), ns3::TypeId::GetName(), ns3::TypeId::GetParent(), NotifyConstructionCompleted(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::Object::Construct().

void ns3::ObjectBase::GetAttribute ( std::string  name,
AttributeValue value 
) const
bool ns3::ObjectBase::GetAttributeFailSafe ( std::string  name,
AttributeValue attribute 
) const
Parameters
namethe name of the attribute to read
attributethe attribute where the result value should be stored
Returns
true if the requested attribute was found, false otherwise.

Definition at line 233 of file object-base.cc.

References ns3::TypeId::ATTR_GET, ns3::AttributeChecker::Create(), GetInstanceTypeId(), and NS_LOG_FUNCTION.

virtual TypeId ns3::ObjectBase::GetInstanceTypeId ( void  ) const
pure virtual
Returns
the TypeId associated to the most-derived type of this instance.

This method is typically implemented by ns3::Object::GetInstanceTypeId but some classes which derive from ns3::ObjectBase directly have to implement it themselves.

Implemented in ns3::Icmpv6OptionRedirected, ns3::Icmpv6OptionLinkLayerAddress, ns3::Icmpv6OptionPrefixInformation, ns3::Icmpv6OptionMtu, ns3::dsr::DsrOptionAckHeader, ns3::Icmpv6ParameterError, ns3::Icmpv6TimeExceeded, ns3::dsr::DsrOptionAckReqHeader, ns3::Icmpv6TooBig, ns3::dsr::DsrOptionRerrUnsupportHeader, ns3::Icmpv6DestinationUnreachable, ns3::SocketIpv6TclassTag, ns3::Icmpv6Echo, ns3::SocketIpTosTag, ns3::SocketSetDontFragmentTag, ns3::dsr::DsrOptionRerrUnreachHeader, ns3::SocketIpv6HopLimitTag, ns3::SocketIpTtlTag, ns3::Icmpv6Redirection, ns3::SocketAddressTag, ns3::Icmpv6RS, ns3::dsr::DsrOptionRerrHeader, ns3::Ipv6ExtensionAHHeader, ns3::AnimByteTag, ns3::dsr::DsrOptionAck, ns3::Ipv6ExtensionESPHeader, ns3::dsr::DsrOptionSRHeader, ns3::PbbPacket, ns3::dsr::DsrOptionAckReq, ns3::Icmpv6RA, ns3::IdealHandoverCommandHeader, ns3::Ipv6ExtensionLooseRoutingHeader, ns3::dsr::DsrOptionRerr, ns3::IdealHandoverPreparationInfoHeader, ns3::RngReq, ns3::dsr::DsrOptionRrepHeader, ns3::dsr::DsrOptionSR, ns3::Icmpv6NA, ns3::Ipv6ExtensionRoutingHeader, ns3::DsaAck, ns3::dsr::DsrOptionRrep, ns3::DsaRsp, ns3::UanHeaderRcAck, ns3::MgtDelBaHeader, ns3::Icmpv6NS, ns3::Ipv6OptionRouterAlertHeader, ns3::dsr::DsrOptionRreq, ns3::Ipv6ExtensionFragmentHeader, ns3::UlMap, ns3::DlMap, ns3::UanHeaderRcCts, ns3::MgtAddBaResponseHeader, ns3::EpcX2ResourceStatusUpdateHeader, ns3::DsaReq, ns3::aodv::RerrHeader, ns3::dsr::DsrRoutingHeader, ns3::Ipv6ExtensionDestinationHeader, ns3::EpcX2LoadInformationHeader, ns3::dsr::DsrOptionRreqHeader, ns3::Ipv6OptionJumbogramHeader, ns3::FragmentationSubheader, ns3::MgtAddBaRequestHeader, ns3::aodv::RrepAckHeader, ns3::Icmpv6OptionHeader, ns3::EpcX2UeContextReleaseHeader, ns3::WifiActionHeader, ns3::UanHeaderRcCtsGlobal, ns3::Dcd, ns3::Ipv6ExtensionHopByHopHeader, ns3::GrantManagementSubheader, ns3::Ipv6OptionPadnHeader, ns3::Ipv4Header, ns3::Ucd, ns3::EpcX2SnStatusTransferHeader, ns3::dsr::DsrOptionPadnHeader, ns3::DeviceNameTag, ns3::olsr::MessageHeader, ns3::aodv::RrepHeader, ns3::RngRsp, anonymous_namespace{packet-metadata-test.cc}::HistoryTrailer< N >, ns3::EpcX2HandoverPreparationFailureHeader, ns3::PacketSocketTag, ns3::BandwidthRequestHeader, ns3::RttMeanDeviation, ns3::Ipv6OptionPad1Header, ns3::dsr::DsrOptionPad1Header, ns3::UanHeaderRcRts, anonymous_namespace{packet-test-suite.cc}::ATestTrailer< N >, ns3::TcpHeader, ns3::Icmpv4TimeExceeded, ns3::MgtProbeResponseHeader, ns3::EpcX2HandoverRequestAckHeader, BenchTag< N >, ns3::LteRlcAmHeader, ns3::FlowMonitor, ns3::Icmpv6Header, ns3::UdpHeader, ns3::Icmpv4DestinationUnreachable, ns3::aodv::RreqHeader, ns3::MgtProbeRequestHeader, ns3::GenericMacHeader, ns3::CtrlBAckResponseHeader, ns3::EthernetHeader, ns3::Object, anonymous_namespace{packet-test-suite.cc}::ATestHeader< N >, ns3::olsr::PacketHeader, ns3::WifiMacHeader, ns3::EthernetTrailer, ns3::dsr::DsrFsHeader, ns3::EpcX2HandoverRequestHeader, ns3::UanHeaderCommon, ns3::MgtAssocResponseHeader, ns3::Icmpv4Echo, ns3::LteRlcHeader, ns3::Tlv, ns3::UanHeaderRcData, anonymous_namespace{packet-metadata-test.cc}::HistoryHeader< N >, ns3::aodv::DeferredRouteOutputTag, ns3::dsdv::DeferredRouteOutputTag, ns3::dsr::DsrOptionHeader, ns3::PyVizPacketTag, ns3::dot11s::PeerLinkFrameStart, ns3::ManagementMessageType, ns3::Ipv6Header, ns3::flame::FlameTag, ns3::RttEstimator, ns3::Ipv6PacketInfoTag, ns3::QosTag, ns3::dsdv::DsdvHeader, ns3::Ipv4PacketInfoTag, ns3::dot11s::HwmpTag, ns3::PppHeader, ns3::aodv::TypeHeader, ns3::Ipv6OptionHeader, ns3::LtePdcpHeader, ns3::PacketChannelPacketTag, ns3::SeqTsHeader, ns3::MacHeaderType, ns3::MgtAssocRequestHeader, ns3::ArpHeader, ns3::Icmpv4Header, anonymous_namespace{packet-test-suite.cc}::ATestTag< N >, SequenceNumberTestObj, ns3::RadiotapHeader, ns3::Ipv6ExtensionHeader, ns3::CtrlBAckRequestHeader, ns3::TxModeTag, ns3::WifiInformationElementVector, ns3::LlcSnapHeader, ns3::flame::FlameHeader, ns3::ConfigStore, ns3::RrcAsn1Header, ns3::WifiMacTrailer, ns3::Asn1Header, ns3::GtpuHeader, ns3::Ipv4FlowProbeTag, ns3::LteRlcSduStatusTag, ns3::dot11s::MeshHeader, ns3::WimaxMacToMacHeader, ns3::PacketTypePacketTag, ns3::PdcpTag, ns3::EpcX2Header, ns3::EpsBearerTag, ns3::RlcTag, ns3::AmsduSubframeHeader, ns3::AlohaNoackMacHeader, BenchHeader< N >, ns3::LteRadioBearerTag, ns3::SnrTag, ns3::Ns3NscStack, ns3::LtePhyTag, MyTag, ns3::FlowIdTag, MyHeader, and ns3::DelayJitterEstimationTimestampTag.

Referenced by ns3::Packet::AddByteTag(), ConstructSelf(), ns3::Packet::FindFirstMatchingByteTag(), GetAttribute(), GetAttributeFailSafe(), ns3::ByteTagIterator::Item::GetTag(), ns3::PacketTagIterator::Item::GetTag(), ns3::PacketTagList::Remove(), SetAttribute(), SetAttributeFailSafe(), TraceConnect(), TraceConnectWithoutContext(), TraceDisconnect(), and TraceDisconnectWithoutContext().

void ns3::ObjectBase::NotifyConstructionCompleted ( void  )
protectedvirtual

This method is invoked once all member attributes have been initialized. Subclasses can override this method to be notified of this event but if they do this, they must chain up to their parent's NotifyConstructionCompleted method.

Reimplemented in ns3::FlowMonitor, and ns3::VisualSimulatorImpl.

Definition at line 59 of file object-base.cc.

References NS_LOG_FUNCTION.

Referenced by ConstructSelf(), and ns3::FlowMonitor::NotifyConstructionCompleted().

void ns3::ObjectBase::SetAttribute ( std::string  name,
const AttributeValue value 
)
Parameters
namethe name of the attribute to set
valuethe name of the attribute to set

Set a single attribute. This cannot fail: if the input is invalid, it will crash immediately.

Definition at line 160 of file object-base.cc.

References ns3::TypeId::ATTR_SET, GetInstanceTypeId(), NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by ns3::cell_edited_callback(), ns3::TraceFadingLossModel::DoCalcRxPowerSpectralDensity(), ns3::dot11s::PeerManagementProtocol::DoInitialize(), ns3::MeshWifiInterfaceMac::DoInitialize(), BufferTest::DoRun(), LenaFdMtFfMacSchedulerTestCase::DoRun(), LenaTdMtFfMacSchedulerTestCase::DoRun(), LenaTtaFfMacSchedulerTestCase::DoRun(), ns3::LteX2HandoverTestCase::DoRun(), ErrorModelSimple::DoRun(), RandomVariableStreamUniformTestCase::DoRun(), Ipv6RawSocketImplTest::DoRun(), BurstErrorModelSimple::DoRun(), RandomVariableStreamUniformAntitheticTestCase::DoRun(), RandomVariableStreamConstantTestCase::DoRun(), RandomVariableStreamSequentialTestCase::DoRun(), RandomVariableStreamNormalTestCase::DoRun(), ObjectVectorTraceConfigTestCase::DoRun(), RandomVariableStreamNormalAntitheticTestCase::DoRun(), RandomVariableStreamExponentialTestCase::DoRun(), RandomVariableStreamExponentialAntitheticTestCase::DoRun(), RandomVariableStreamParetoTestCase::DoRun(), RandomVariableStreamParetoAntitheticTestCase::DoRun(), RandomVariableStreamWeibullTestCase::DoRun(), RandomVariableStreamWeibullAntitheticTestCase::DoRun(), RandomVariableStreamLogNormalTestCase::DoRun(), RandomVariableStreamLogNormalAntitheticTestCase::DoRun(), RandomVariableStreamGammaTestCase::DoRun(), RandomVariableStreamGammaAntitheticTestCase::DoRun(), RandomVariableStreamErlangTestCase::DoRun(), RandomVariableStreamErlangAntitheticTestCase::DoRun(), RandomVariableStreamZipfTestCase::DoRun(), RandomVariableStreamZipfAntitheticTestCase::DoRun(), RandomVariableStreamZetaTestCase::DoRun(), RandomVariableStreamZetaAntitheticTestCase::DoRun(), RandomVariableStreamEmpiricalAntitheticTestCase::DoRun(), ns3::EpcHelper::EpcHelper(), ns3::aodv::RoutingProtocol::NotifyInterfaceUp(), ns3::dsdv::RoutingProtocol::NotifyInterfaceUp(), ns3::Ping6::Send(), ns3::Config::MatchContainer::Set(), ns3::V4Ping::StartApplication(), ns3::Ping6::StartApplication(), and ns3::Radvd::StartApplication().

bool ns3::ObjectBase::SetAttributeFailSafe ( std::string  name,
const AttributeValue value 
)
bool ns3::ObjectBase::TraceConnect ( std::string  name,
std::string  context,
const CallbackBase cb 
)
Parameters
namethe name of the targetted trace source
contextthe trace context associated to the callback
cbthe callback to connect to the trace source.

The targetted trace source should be registered with TypeId::AddTraceSource.

Definition at line 281 of file object-base.cc.

References GetInstanceTypeId(), ns3::TypeId::LookupTraceSourceByName(), and NS_LOG_FUNCTION.

bool ns3::ObjectBase::TraceDisconnect ( std::string  name,
std::string  context,
const CallbackBase cb 
)
Parameters
namethe name of the targetted trace source
contextthe trace context associated to the callback
cbthe callback to disconnect from the trace source.

The targetted trace source should be registered with TypeId::AddTraceSource.

Definition at line 307 of file object-base.cc.

References GetInstanceTypeId(), ns3::TypeId::LookupTraceSourceByName(), and NS_LOG_FUNCTION.

bool ns3::ObjectBase::TraceDisconnectWithoutContext ( std::string  name,
const CallbackBase cb 
)
Parameters
namethe name of the targetted trace source
cbthe callback to disconnect from the trace source.

The targetted trace source should be registered with TypeId::AddTraceSource.

Definition at line 294 of file object-base.cc.

References GetInstanceTypeId(), ns3::TypeId::LookupTraceSourceByName(), and NS_LOG_FUNCTION.

Referenced by ns3::Config::MatchContainer::DisconnectWithoutContext(), IntegerTraceSourceTestCase::DoRun(), TracedCallbackTestCase::DoRun(), ns3::HierarchicalMobilityModel::SetChild(), and ns3::HierarchicalMobilityModel::SetParent().


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