A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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

virtual ~ObjectBase ()
 Virtual destructor. More...
 
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)
 Get the type ID. More...
 

Protected Member Functions

void ConstructSelf (const AttributeConstructionList &attributes)
 
virtual void NotifyConstructionCompleted (void)
 This method is invoked once all member attributes have been initialized. More...
 

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

Doxygen introspection did not find any typical Config paths.

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.


No Attributes are defined for this type.
No TraceSources are defined for this type.

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

Constructor & Destructor Documentation

ns3::ObjectBase::~ObjectBase ( )
virtual

Virtual destructor.

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

References NS_LOG_FUNCTION.

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 66 of file object-base.cc.

References ns3::TypeId::AttributeInformation::accessor, ns3::TypeId::ATTR_CONSTRUCT, ns3::TypeId::AttributeInformation::checker, DoSet(), ns3::AttributeConstructionList::Find(), ns3::TypeId::AttributeInformation::flags, ns3::TypeId::GetAttribute(), ns3::TypeId::GetAttributeFullName(), ns3::TypeId::GetAttributeN(), GetInstanceTypeId(), ns3::TypeId::GetName(), ns3::TypeId::GetParent(), GetTypeId(), ns3::TypeId::AttributeInformation::initialValue, ns3::TypeId::AttributeInformation::name, NotifyConstructionCompleted(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::ConfigStore::ConfigStore(), ns3::Object::Construct(), and ns3::RttEstimator::RttEstimator().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::ObjectBase::DoSet ( Ptr< const AttributeAccessor spec,
Ptr< const AttributeChecker checker,
const AttributeValue value 
)
private

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

References NS_LOG_FUNCTION.

Referenced by ConstructSelf(), SetAttribute(), and SetAttributeFailSafe().

+ Here is the caller graph for this function:

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 234 of file object-base.cc.

References ns3::TypeId::AttributeInformation::accessor, ns3::TypeId::ATTR_GET, ns3::TypeId::AttributeInformation::checker, ns3::TypeId::AttributeInformation::flags, GetInstanceTypeId(), NS_LOG_FUNCTION, ns3::PeekPointer(), and ns3::StringValue::Set().

Referenced by AttributeTestCase< T >::CheckGetCodePaths().

+ Here is the call graph for this function:

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

Referenced by ns3::PacketTagList::Add(), ns3::Packet::AddByteTag(), ns3::PacketMetadata::AddHeader(), ns3::Packet::AddHeader(), ns3::Packet::AddPacketTag(), ns3::PacketMetadata::AddTrailer(), ns3::Packet::AddTrailer(), ConstructSelf(), ns3::PacketTagList::COWTraverse(), ns3::Packet::FindFirstMatchingByteTag(), GetAttribute(), GetAttributeFailSafe(), ns3::ByteTagIterator::Item::GetTag(), ns3::PacketTagIterator::Item::GetTag(), ns3::PacketTagList::Peek(), ns3::Packet::PeekHeader(), ns3::Packet::PeekTrailer(), ns3::PacketMetadata::RemoveHeader(), ns3::Packet::RemoveHeader(), ns3::Packet::RemovePacketTag(), ns3::PacketMetadata::RemoveTrailer(), ns3::Packet::RemoveTrailer(), ns3::Packet::ReplacePacketTag(), ns3::PacketTagList::ReplaceWriter(), SetAttribute(), SetAttributeFailSafe(), TraceConnect(), TraceConnectWithoutContext(), TraceDisconnect(), and TraceDisconnectWithoutContext().

+ Here is the caller graph for this function:

TypeId ns3::ObjectBase::GetTypeId ( void  )
static

Get the type ID.

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

References ns3::GetObjectIid(), and NS_LOG_FUNCTION_NOARGS.

Referenced by ConstructSelf().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 60 of file object-base.cc.

References NS_LOG_FUNCTION.

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

+ Here is the caller graph for this function:

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 161 of file object-base.cc.

References ns3::TypeId::AttributeInformation::accessor, ns3::TypeId::ATTR_SET, ns3::TypeId::AttributeInformation::checker, DoSet(), ns3::TypeId::AttributeInformation::flags, GetInstanceTypeId(), NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by ns3::UanMacRc::Associate(), ns3::UanMacRc::AssociateTimeout(), ns3::cell_edited_callback(), FemtocellBlockAllocator::Create(), ns3::TraceFadingLossModel::DoCalcRxPowerSpectralDensity(), ns3::dot11s::HwmpProtocol::DoInitialize(), ns3::dot11s::PeerManagementProtocol::DoInitialize(), ns3::MeshWifiInterfaceMac::DoInitialize(), ns3::SteadyStateRandomWaypointMobilityModel::DoInitializePrivate(), UanTest::DoOnePhyTest(), BufferTest::DoRun(), LenaTtaFfMacSchedulerTestCase::DoRun(), LenaFdMtFfMacSchedulerTestCase::DoRun(), LenaTdMtFfMacSchedulerTestCase::DoRun(), ns3::LteX2HandoverTestCase::DoRun(), ProbeTestCase1::DoRun(), ErrorModelSimple::DoRun(), Ipv4ForwardingTest::DoRun(), Ipv6ForwardingTest::DoRun(), RandomVariableStreamUniformTestCase::DoRun(), SixlowpanIphcImplTest::DoRun(), SixlowpanHc1ImplTest::DoRun(), Ipv6RawSocketImplTest::DoRun(), ns3::LteX2HandoverMeasuresTestCase::DoRun(), SixlowpanFragmentationTest::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(), Ipv4RawSocketImplTest::DoSendData_IpHdr(), Ipv4HeaderTest::DoSendData_IpHdr_Dscp(), FemtocellBlockAllocator::FemtocellBlockAllocator(), GetRandomStream(), ns3::JakesPropagationLossModel::JakesPropagationLossModel(), ns3::LteSpectrumPhy::LteSpectrumPhy(), main(), ns3::aodv::RoutingProtocol::NotifyInterfaceUp(), ns3::dsdv::RoutingProtocol::NotifyInterfaceUp(), ns3::PointToPointEpcHelper::PointToPointEpcHelper(), ns3::UanMacRc::RtsTimeout(), NetAnimExperiment::Run(), ns3::UanMacRc::ScheduleData(), Experiment::SelectSrcDest(), ns3::Ping6::Send(), Experiment::SendMultiDestinations(), ns3::UanMacRc::SendRts(), ns3::Config::MatchContainer::Set(), ns3::V4Ping::StartApplication(), ns3::Ping6::StartApplication(), ns3::Radvd::StartApplication(), Ipv4FragmentationTest::StartClient(), SixlowpanFragmentationTest::StartClient(), Ipv6FragmentationTest::StartClient(), and NetAnimExperiment::UpdatePositions().

+ Here is the call graph for this function:

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 282 of file object-base.cc.

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

Referenced by ProbeTestCase1::DoRun(), and main().

+ Here is the call graph for this function:

+ Here is the caller graph for this 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 308 of file object-base.cc.

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

+ Here is the call graph for this 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 295 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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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