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

a base class which provides memory management and object aggregation More...

#include <object.h>

+ Inheritance diagram for ns3::Object:

Classes

class  AggregateIterator
 Iterate over the objects aggregated to an ns3::Object. More...
 
struct  Aggregates
 

Public Member Functions

void AggregateObject (Ptr< Object > other)
 
void Dispose (void)
 
AggregateIterator GetAggregateIterator (void) const
 
virtual TypeId GetInstanceTypeId (void) const
 
template<typename T >
Ptr< T > GetObject (void) const
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 
void Initialize (void)
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount (const SimpleRefCount &o)
 
uint32_t GetReferenceCount (void) const
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 
void Ref (void) const
 
void Unref (void) const
 
- Public Member Functions inherited from ns3::ObjectBase
void GetAttribute (std::string name, AttributeValue &value) const
 
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
 
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)
 
- Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 

Protected Member Functions

 Object (const Object &o)
 
virtual void DoDispose (void)
 
virtual void DoInitialize (void)
 
virtual void NotifyNewAggregate (void)
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 
virtual void NotifyConstructionCompleted (void)
 

Private Member Functions

bool Check (void) const
 
bool CheckLoose (void) const
 
void Construct (const AttributeConstructionList &attributes)
 
void DoDelete (void)
 
Ptr< ObjectDoGetObject (TypeId tid) const
 
void SetTypeId (TypeId tid)
 
void UpdateSortedArray (struct Aggregates *aggregates, uint32_t i) const
 

Private Attributes

struct Aggregatesm_aggregates
 
bool m_disposed
 
uint32_t m_getObjectCount
 
bool m_initialized
 
TypeId m_tid
 

Friends

class AggregateIterator
 
template<typename T >
Ptr< T > CompleteConstruct (T *object)
 
template<typename T >
Ptr< T > CopyObject (Ptr< T > object)
 
template<typename T >
Ptr< T > CopyObject (Ptr< const T > object)
 
struct ObjectDeleter
 
class ObjectFactory
 

Detailed Description

a base class which provides memory management and object aggregation

The memory management scheme is based on reference-counting with dispose-like functionality to break the reference cycles. The reference count is increamented and decremented with the methods Object::Ref and Object::Unref. If a reference cycle is present, the user is responsible for breaking it by calling Object::Dispose in a single location. This will eventually trigger the invocation of Object::DoDispose on itself and all its aggregates. The Object::DoDispose method is always automatically invoked from the Object::Unref method before destroying the object, even if the user did not call Object::Dispose directly.

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 63 of file object.h.

Constructor & Destructor Documentation

ns3::Object::Object ( const Object o)
protected
Parameters
othe object to copy.

Allow subclasses to implement a copy constructor. While it is technically possible to implement a copy constructor in a subclass, we strongly discourage you to do so. If you really want to do it anyway, you have to understand that this copy constructor will not copy aggregated objects. i.e., if your object instance is already aggregated to another object and if you invoke this copy constructor, the new object instance will be a pristine standalone object instance not aggregated to any other object. It is thus your responsability as a caller of this method to do what needs to be done (if it is needed) to ensure that the object stays in a valid state.

Definition at line 127 of file object.cc.

References m_aggregates.

Member Function Documentation

void ns3::Object::AggregateObject ( Ptr< Object other)
Parameters
otheranother object pointer

This method aggregates the two objects together: after this method returns, it becomes possible to call GetObject on one to get the other, and vice-versa.

This method calls the virtual method NotifyNewAggregates to notify all aggregated objects that they have been aggregated together.

See Also
NotifyNewAggregate

Definition at line 242 of file object.cc.

References GetInstanceTypeId(), ns3::TypeId::GetName(), m_aggregates, m_disposed, NotifyNewAggregate(), NS_ASSERT, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by ns3::EpcHelper::AddEnb(), ns3::PointToPointStarHelper::BoundingBox(), ns3::PointToPointGridHelper::BoundingBox(), ns3::PointToPointDumbbellHelper::BoundingBox(), ns3::AodvHelper::Create(), ns3::Ipv4GlobalRoutingHelper::Create(), ns3::Ipv4NixVectorHelper::Create(), ns3::DsdvHelper::Create(), ns3::DsrHelper::Create(), ns3::OlsrHelper::Create(), ns3::InternetStackHelper::CreateAndAggregateObjectFromTypeId(), ns3::LiIonEnergyTestCase::DoRun(), ns3::aodv::LoopbackTestCase::DoRun(), WaypointLazyNotifyFalse::DoRun(), ns3::AcousticModemEnergyTestCase::DoRun(), ns3::Ipv6L3ProtocolTestCase::DoRun(), WaypointLazyNotifyTrue::DoRun(), ns3::AcousticModemEnergyDepletionTestCase::DoRun(), ns3::Bug555TestCase::DoRun(), ns3::PacketSocketHelper::Install(), ns3::InternetStackHelper::Install(), ns3::MobilityHelper::Install(), ns3::NscTcpL4Protocol::NotifyNewAggregate(), ns3::UdpL4Protocol::NotifyNewAggregate(), ns3::TcpL4Protocol::NotifyNewAggregate(), ns3::Ipv6L3Protocol::RegisterExtensions(), ns3::Ipv6L3Protocol::RegisterOptions(), ns3::AnimationInterface::SetConstantPosition(), and BasicEnergyUpdateTest::StateSwitchTest().

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

Invoked from ns3::ObjectFactory::Create and ns3::CreateObject only. Initialize all the member variables which were registered with the associated TypeId.

Definition at line 138 of file object.cc.

References ns3::ObjectBase::ConstructSelf(), and NS_LOG_FUNCTION.

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

void ns3::Object::Dispose ( void  )

Run the DoDispose methods of this object and all the objects aggregated to it. After calling this method, the object is expected to be totally unusable except for the Ref and Unref methods.

Note that you can call Dispose many times on the same object or different objects aggregated together, and DoDispose will be called only once for each aggregated object.

This method is typically used to break reference cycles.

Note: the code here is a bit tricky because we need to protect ourselves from modifications in the aggregate array while DoDispose is called. The user's DoDispose implementation could call GetObject (which could reorder the array) and it could call AggregateObject which would add an object at the end of the array. So, to be safe, we restart the iteration over the array whenever we call some user code.

Definition at line 204 of file object.cc.

References DoDispose(), m_aggregates, m_disposed, and NS_LOG_FUNCTION.

Referenced by ns3::NodeListPriv::DoDispose(), ns3::EpcHelper::DoDispose(), ns3::ArpL3Protocol::DoDispose(), ns3::Icmpv6L4Protocol::DoDispose(), SequenceNumberTestCase::DoRun(), Ipv6RawSocketImplTest::DoRun(), Ipv4RawSocketImplTest::DoRun(), UdpSocketImplTest::DoRun(), and Udp6SocketImplTest::DoRun().

void ns3::Object::DoDelete ( void  )
private

Attempt to delete this object. This method iterates over all aggregated objects to check if they all have a zero refcount. If yes, the object and all its aggregates are deleted. If not, nothing is done.

Definition at line 376 of file object.cc.

References DoDispose(), ns3::SimpleRefCount< T, PARENT, DELETER >::GetReferenceCount(), m_aggregates, m_disposed, and NS_LOG_FUNCTION.

void ns3::Object::DoDispose ( void  )
protectedvirtual

This method is called by Object::Dispose or by the object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.

It is safe to call GetObject from within this method.

Reimplemented in ns3::Socket, ns3::GlobalRouter, ns3::MacLow, ns3::dsr::DsrRouting, ns3::Ipv6ExtensionRoutingDemux, ns3::NdiscCache, ns3::LteEnbRrc, ns3::Icmpv6L4Protocol, ns3::Ipv4StaticRouting, ns3::Ipv6L3Protocol, ns3::CsmaNetDevice, ns3::WimaxPhy, ns3::Ipv6ExtensionFragment, ns3::WifiRemoteStationManager, ns3::SubscriberStationNetDevice, ns3::UanPhyDual, ns3::Ipv6RawSocketImpl, ns3::EpcTestRrc, ns3::UanPhyGen, ns3::UanPropModel, ns3::Ipv6StaticRouting, ns3::Ipv6Interface, ns3::OpenFlowSwitchNetDevice, ns3::BaseStationNetDevice, ns3::UanMacRc, ns3::Ipv4GlobalRouting, ns3::WimaxNetDevice, ns3::EmuNetDevice, ns3::WifiRadioEnergyModel, ns3::TapBridge, ns3::RegularWifiMac, ns3::CounterCalculator< T >, ns3::CounterCalculator< uint32_t >, ns3::ArpCache, ns3::Ipv4L3Protocol, ns3::FlowMonitor, ns3::Node, ns3::olsr::RoutingProtocol, ns3::SimpleOfdmWimaxPhy, ns3::PointToPointNetDevice, ns3::HalfDuplexIdealPhy, ns3::AlohaNoackNetDevice, ns3::RvBatteryModel, ns3::AcousticModemEnergyModel, ns3::FdNetDevice, ns3::DcaTxop, ns3::EnergySource, ns3::EnergySourceContainer, ns3::LteTestMac, ns3::YansWifiPhy, ns3::UanMacRcGw, ns3::LteSpectrumPhy, ns3::MeshWifiInterfaceMac, ns3::Ipv4Interface, ns3::LiIonEnergySource, ns3::UanNetDevice, ns3::LteRlcSm, ns3::VirtualNetDevice, ns3::TcpL4Protocol, ns3::UdpL4Protocol, ns3::Ipv4NixVectorRouting, ns3::UanMacCw, ns3::WaypointMobilityModel, ns3::WaveformGenerator, ns3::UdpEchoClient, ns3::NonCommunicatingNetDevice, ns3::Application, ns3::ApWifiMac, ns3::LtePhy, ns3::OnOffApplication, ns3::LteTestPdcp, ns3::DistributedSimulatorImpl, ns3::BridgeNetDevice, ns3::Ipv6ListRouting, ns3::UanPhyPer, ns3::WifiNetDevice, ns3::LteEnbRrcProtocolReal, ns3::MeshPointDevice, ns3::PacketSocket, ns3::DataCalculator, ns3::WimaxConnection, ns3::BasicEnergySource, ns3::MultiModelSpectrumChannel, ns3::UanChannel, ns3::BuildingsMobilityModel, ns3::UdpTraceClient, ns3::SpectrumInterference, ns3::SimpleDeviceEnergyModel, ns3::LteEnbRrcProtocolIdeal, ns3::UeManager, ns3::PssFfMacScheduler, ns3::FdTbfqFfMacScheduler, ns3::TdTbfqFfMacScheduler, ns3::NscTcpL4Protocol, ns3::SpectrumAnalyzer, ns3::LteUeRrc, ns3::Ping6, ns3::ErrorNetDevice, ns3::SimpleNetDevice, ns3::PacketSink, ns3::Ipv4ListRouting, ns3::FdBetFfMacScheduler, ns3::TdBetFfMacScheduler, ns3::Radvd, ns3::RealtimeSimulatorImpl, ns3::PfFfMacScheduler, ns3::UanMacAloha, ns3::GaussMarkovMobilityModel, ns3::Ipv6ExtensionDemux, ns3::Ipv6OptionDemux, ns3::RadioBearerStatsCalculator, ns3::EpcX2, ns3::flame::FlameProtocol, ns3::EdcaTxopN, ns3::EpsBearerTagUdpClient, ns3::FdMtFfMacScheduler, ns3::TdMtFfMacScheduler, ns3::TtaFfMacScheduler, ns3::ArpL3Protocol, ns3::BulkSendApplication, ns3::SpectrumPropagationLossModel, ns3::RrFfMacScheduler, ns3::UdpServer, ns3::VisualSimulatorImpl, ns3::DataCollector, ns3::Ipv4FlowProbe, ns3::LoopbackNetDevice, ns3::UdpSocketFactoryImpl, ns3::LteUePhy, ns3::Icmpv4L4Protocol, ns3::LteUeNetDevice, ns3::UanPhyCalcSinr, ns3::FfMacScheduler, ns3::LteEnbPhy, ns3::flame::FlameRtable, ns3::dot11s::HwmpRtable, ns3::SingleModelSpectrumChannel, ns3::UanTransducerHd, ns3::PacketBurst, ns3::PacketSizeMinMaxAvgTotalCalculator, ns3::dsdv::RoutingProtocol, ns3::EpcHelper, ns3::DefaultSimulatorImpl, ns3::aodv::RoutingProtocol, ns3::UdpClient, ns3::LteEnbMac, ns3::LteHelper, ns3::LteUeRrcProtocolReal, ns3::SSScheduler, ns3::EpcMme, ns3::JakesProcess, ns3::EpcEnbApplication, ns3::RandomWalk2dMobilityModel, ns3::ShannonSpectrumErrorModel, ns3::BandwidthManager, ns3::RemSpectrumPhy, ns3::LteEnbNetDevice, ns3::LteRlc, ns3::MinMaxAvgTotalCalculator< T >, ns3::MinMaxAvgTotalCalculator< uint32_t >, ns3::MinMaxAvgTotalCalculator< double >, ns3::MinMaxAvgTotalCalculator< uint64_t >, ns3::FlameStack, ns3::EpcSgwPgwApplication, ns3::LteNetDevice, ns3::LteUeRrcProtocolIdeal, ns3::RandomDirection2dMobilityModel, ns3::SsServiceFlowManager, ns3::NscTcpSocketFactoryImpl, ns3::dot11s::PeerManagementProtocol, ns3::V4Ping, ns3::BuildingListPriv, ns3::TcpSocketFactoryImpl, ns3::LteInterference, ns3::LteUeMac, ns3::ChannelListPriv, ns3::ServiceFlowManager, ns3::LteTestRrc, ns3::Dot11sStack, ns3::dot11s::HwmpProtocol, ns3::NodeListPriv, ns3::BsServiceFlowManager, ns3::Ipv4RawSocketImpl, ns3::dot11s::PeerLink, ns3::TimeMinMaxAvgTotalCalculator, ns3::UdpEchoServer, ns3::RadioEnvironmentMapHelper, ns3::EpcUeNas, ns3::LteSimpleHelper, ns3::ConnectionManager, ns3::DataOutputInterface, ns3::FlowProbe, ns3::LteSimpleNetDevice, ns3::SqliteDataOutput, ns3::SSLinkManager, ns3::LteTestUePhy, ns3::LtePdcp, ns3::OmnetDataOutput, ns3::PacketCounterCalculator, ns3::UanNoiseModel, ns3::Building, ns3::LteHexGridEnbTopologyHelper, ns3::BurstProfileManager, ns3::LteRlcAm, ns3::LteRlcTm, and ns3::LteRlcUm.

Definition at line 335 of file object.cc.

References m_disposed, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by Dispose(), DoDelete(), ns3::LteHexGridEnbTopologyHelper::DoDispose(), ns3::UanNoiseModel::DoDispose(), ns3::FlowProbe::DoDispose(), ns3::DataOutputInterface::DoDispose(), ns3::LteSimpleHelper::DoDispose(), ns3::NodeListPriv::DoDispose(), ns3::TcpSocketFactoryImpl::DoDispose(), ns3::LteInterference::DoDispose(), ns3::LteUeMac::DoDispose(), ns3::ChannelListPriv::DoDispose(), ns3::BuildingListPriv::DoDispose(), ns3::NscTcpSocketFactoryImpl::DoDispose(), ns3::LteNetDevice::DoDispose(), ns3::RandomDirection2dMobilityModel::DoDispose(), ns3::RemSpectrumPhy::DoDispose(), ns3::ShannonSpectrumErrorModel::DoDispose(), ns3::RandomWalk2dMobilityModel::DoDispose(), ns3::LteHelper::DoDispose(), ns3::aodv::RoutingProtocol::DoDispose(), ns3::DefaultSimulatorImpl::DoDispose(), ns3::dsdv::RoutingProtocol::DoDispose(), ns3::SingleModelSpectrumChannel::DoDispose(), ns3::UanTransducerHd::DoDispose(), ns3::Icmpv4L4Protocol::DoDispose(), ns3::UanPhyCalcSinr::DoDispose(), ns3::UdpSocketFactoryImpl::DoDispose(), ns3::LoopbackNetDevice::DoDispose(), ns3::DataCollector::DoDispose(), ns3::VisualSimulatorImpl::DoDispose(), ns3::ArpL3Protocol::DoDispose(), ns3::Ipv6ExtensionDemux::DoDispose(), ns3::Ipv6OptionDemux::DoDispose(), ns3::GaussMarkovMobilityModel::DoDispose(), ns3::UanMacAloha::DoDispose(), ns3::RealtimeSimulatorImpl::DoDispose(), ns3::ErrorNetDevice::DoDispose(), ns3::SimpleNetDevice::DoDispose(), ns3::SpectrumAnalyzer::DoDispose(), ns3::NscTcpL4Protocol::DoDispose(), ns3::SpectrumInterference::DoDispose(), ns3::BuildingsMobilityModel::DoDispose(), ns3::MultiModelSpectrumChannel::DoDispose(), ns3::UanChannel::DoDispose(), ns3::DataCalculator::DoDispose(), ns3::MeshPointDevice::DoDispose(), ns3::WifiNetDevice::DoDispose(), ns3::UanPhyPer::DoDispose(), ns3::BridgeNetDevice::DoDispose(), ns3::DistributedSimulatorImpl::DoDispose(), ns3::LtePhy::DoDispose(), ns3::Application::DoDispose(), ns3::NonCommunicatingNetDevice::DoDispose(), ns3::WaypointMobilityModel::DoDispose(), ns3::UanMacCw::DoDispose(), ns3::Ipv4NixVectorRouting::DoDispose(), ns3::UdpL4Protocol::DoDispose(), ns3::TcpL4Protocol::DoDispose(), ns3::VirtualNetDevice::DoDispose(), ns3::UanNetDevice::DoDispose(), ns3::Ipv4Interface::DoDispose(), ns3::LteSpectrumPhy::DoDispose(), ns3::FdNetDevice::DoDispose(), ns3::AlohaNoackNetDevice::DoDispose(), ns3::HalfDuplexIdealPhy::DoDispose(), ns3::PointToPointNetDevice::DoDispose(), ns3::olsr::RoutingProtocol::DoDispose(), ns3::Node::DoDispose(), ns3::FlowMonitor::DoDispose(), ns3::Ipv4L3Protocol::DoDispose(), ns3::ArpCache::DoDispose(), ns3::TapBridge::DoDispose(), ns3::EmuNetDevice::DoDispose(), ns3::WimaxNetDevice::DoDispose(), ns3::Ipv4GlobalRouting::DoDispose(), ns3::UanMacRc::DoDispose(), ns3::Ipv6Interface::DoDispose(), ns3::Ipv6StaticRouting::DoDispose(), ns3::UanPropModel::DoDispose(), ns3::UanPhyGen::DoDispose(), ns3::UanPhyDual::DoDispose(), ns3::Ipv6ExtensionFragment::DoDispose(), ns3::CsmaNetDevice::DoDispose(), ns3::Ipv6L3Protocol::DoDispose(), ns3::Ipv4StaticRouting::DoDispose(), ns3::Icmpv6L4Protocol::DoDispose(), ns3::NdiscCache::DoDispose(), ns3::Ipv6ExtensionRoutingDemux::DoDispose(), ns3::dsr::DsrRouting::DoDispose(), and ns3::GlobalRouter::DoDispose().

void ns3::Object::DoInitialize ( void  )
protectedvirtual

This method is called only once by Object::Initialize. If the user calls Object::Initialize multiple times, DoInitialize is called only the first time.

Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject and AggregateObject from within this method.

Reimplemented in ns3::LteHelper, ns3::RegularWifiMac, ns3::Node, ns3::RvBatteryModel, ns3::EnergySourceContainer, ns3::EdcaTxopN, ns3::dot11s::PeerManagementProtocol, ns3::MeshWifiInterfaceMac, ns3::LiIonEnergySource, ns3::LteRlcSm, ns3::DcaTxop, ns3::olsr::RoutingProtocol, ns3::LteEnbNetDevice, ns3::Application, ns3::ApWifiMac, ns3::LteSimpleHelper, ns3::WifiNetDevice, ns3::BasicEnergySource, ns3::LteUeNetDevice, ns3::dot11s::HwmpProtocol, ns3::UeManager, ns3::LteUeRrc, ns3::Ipv4ListRouting, ns3::LteUePhy, ns3::LteEnbPhy, ns3::RandomWalk2dMobilityModel, ns3::SteadyStateRandomWaypointMobilityModel, ns3::LteSimpleNetDevice, ns3::RandomDirection2dMobilityModel, ns3::RandomWaypointMobilityModel, and ns3::TraceFadingLossModel.

Definition at line 342 of file object.cc.

References m_initialized, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ns3::RandomDirection2dMobilityModel::DoInitialize(), ns3::RandomWaypointMobilityModel::DoInitialize(), ns3::SteadyStateRandomWaypointMobilityModel::DoInitialize(), ns3::RandomWalk2dMobilityModel::DoInitialize(), ns3::LteEnbPhy::DoInitialize(), ns3::LteUePhy::DoInitialize(), ns3::Ipv4ListRouting::DoInitialize(), ns3::WifiNetDevice::DoInitialize(), ns3::LteSimpleHelper::DoInitialize(), ns3::Application::DoInitialize(), ns3::DcaTxop::DoInitialize(), ns3::EdcaTxopN::DoInitialize(), ns3::Node::DoInitialize(), ns3::LteHelper::DoInitialize(), and Initialize().

Object::AggregateIterator ns3::Object::GetAggregateIterator ( void  ) const
Returns
an iterator to the first object aggregated to this object.

If no objects are aggregated to this object, then, the returned iterator will be empty and AggregateIterator::HasNext will always return false.

Definition at line 320 of file object.cc.

References NS_LOG_FUNCTION.

TypeId ns3::Object::GetInstanceTypeId ( void  ) const
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.

Implements ns3::ObjectBase.

Reimplemented in ns3::dsr::DsrOptionAck, ns3::dsr::DsrOptionAckReq, ns3::dsr::DsrOptionRerr, ns3::dsr::DsrOptionSR, ns3::dsr::DsrOptionRrep, ns3::dsr::DsrOptionRreq, ns3::RttMeanDeviation, ns3::FlowMonitor, ns3::RttEstimator, SequenceNumberTestObj, and ns3::Ns3NscStack.

Definition at line 76 of file object.cc.

References m_tid, and NS_LOG_FUNCTION.

Referenced by AggregateObject(), ns3::cell_data_function_col_0(), and ns3::cell_tooltip_callback().

template<typename T >
Ptr< T > ns3::Object::GetObject ( void  ) const
inline
Returns
a pointer to the requested interface or zero if it could not be found.

Definition at line 332 of file object.h.

References m_aggregates.

Referenced by ns3::EpcHelper::ActivateEpsBearer(), ns3::Ipv6Interface::AddAddress(), ns3::EpcHelper::AddEnb(), ns3::Ipv6StaticRoutingHelper::AddMulticastRoute(), ns3::Ipv4StaticRoutingHelper::AddMulticastRoute(), ns3::EpcHelper::AddX2Interface(), ns3::Ipv6AddressHelper::Assign(), ns3::Ipv4AddressHelper::Assign(), ns3::AodvHelper::AssignStreams(), ns3::OlsrHelper::AssignStreams(), ns3::InternetStackHelper::AssignStreams(), ns3::MobilityHelper::AssignStreams(), ns3::PointToPointStarHelper::BoundingBox(), ns3::PointToPointGridHelper::BoundingBox(), ns3::PointToPointDumbbellHelper::BoundingBox(), ns3::GlobalRouteManagerImpl::BuildGlobalRoutingDatabase(), ns3::Ns2MobilityHelperTest::CheckInitialPositions(), ns3::Ipv4RawSocketImpl::Close(), ns3::Ipv6RawSocketImpl::Close(), ns3::DsrHelper::Create(), ns3::SpectrumPhyHelper::Create(), ns3::Socket::CreateSocket(), ns3::TapBridge::CreateTap(), ns3::GlobalRouteManagerImpl::DeleteGlobalRoutes(), ns3::GlobalRouter::DiscoverLSAs(), ns3::Icmpv6L4Protocol::DoDAD(), ns3::LteHelper::DoInitialize(), ns3::BasicEnergySourceHelper::DoInstall(), ns3::RvBatteryModelHelper::DoInstall(), ns3::WifiRadioEnergyModelHelper::DoInstall(), IpAddressHelperTestCasev6::DoRun(), ns3::LenaMimoTestCase::DoRun(), ns3::SteadyStateRandomWaypointTest::DoRun(), ns3::LenaHarqTestCase::DoRun(), ns3::LenaDataPhyErrorModelTestCase::DoRun(), ns3::LenaRrFfMacSchedulerTestCase::DoRun(), ns3::WaypointMobilityModelNotifyTest::DoRun(), ns3::LenaPfFfMacSchedulerTestCase1::DoRun(), ns3::LenaTdBetFfMacSchedulerTestCase1::DoRun(), LenaTdMtFfMacSchedulerTestCase::DoRun(), ns3::LenaTdTbfqFfMacSchedulerTestCase1::DoRun(), LenaTtaFfMacSchedulerTestCase::DoRun(), LenaFdMtFfMacSchedulerTestCase::DoRun(), ns3::LenaFdTbfqFfMacSchedulerTestCase1::DoRun(), ns3::LenaFdBetFfMacSchedulerTestCase1::DoRun(), ns3::LenaPssFfMacSchedulerTestCase1::DoRun(), StaticRoutingSlash32TestCase::DoRun(), ns3::LteLinkAdaptationTestCase::DoRun(), ns3::AcousticModemEnergyTestCase::DoRun(), ns3::LteInterferenceTestCase::DoRun(), ns3::LtePathlossModelSystemTestCase::DoRun(), ns3::LteEnbAntennaTestCase::DoRun(), DynamicGlobalRoutingTestCase::DoRun(), ns3::LteX2HandoverTestCase::DoRun(), ns3::LenaDlCtrlPhyErrorModelTestCase::DoRun(), ns3::LenaPfFfMacSchedulerTestCase2::DoRun(), ns3::LenaTdBetFfMacSchedulerTestCase2::DoRun(), ns3::LenaFdBetFfMacSchedulerTestCase2::DoRun(), ns3::LenaTdTbfqFfMacSchedulerTestCase2::DoRun(), ns3::LenaFdTbfqFfMacSchedulerTestCase2::DoRun(), ns3::RandomRoomPositionAllocatorTestCase::DoRun(), ns3::LenaPssFfMacSchedulerTestCase2::DoRun(), ns3::LteHandoverDelayTestCase::DoRun(), Ipv6PacketInfoTagTest::DoRun(), ns3::SpectrumIdealPhyTestCase::DoRun(), Ipv6RawSocketImplTest::DoRun(), Ipv4HeaderTest::DoRun(), ns3::EpcS1uDlTestCase::DoRun(), Ipv4PacketInfoTagTest::DoRun(), Ipv4RawSocketImplTest::DoRun(), ns3::LteEpcE2eDataTestCase::DoRun(), Ipv4FragmentationTest::DoRun(), ns3::BuildingsHelperOneTestCase::DoRun(), Ipv6FragmentationTest::DoRun(), UdpSocketLoopbackTest::DoRun(), ns3::SameRoomPositionAllocatorTestCase::DoRun(), Udp6SocketLoopbackTest::DoRun(), ns3::InterferenceHelperSequenceTest::DoRun(), ns3::aodv::ChainRegressionTest::DoRun(), UdpSocketImplTest::DoRun(), ns3::AcousticModemEnergyDepletionTestCase::DoRun(), ns3::EpcS1uUlTestCase::DoRun(), GlobalRoutingSlash32TestCase::DoRun(), WaypointMobilityModelViaHelper::DoRun(), ns3::ObjectFactoryTestCase::DoRun(), Udp6SocketImplTest::DoRun(), CsmaStarTestCase::DoRun(), PointerAttributeTestCase::DoRun(), ns3::Ipv6Interface::DoSetup(), ns3::AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl(), ns3::AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl(), ns3::PcapHelperForIpv4::EnablePcapIpv4(), ns3::PcapHelperForIpv6::EnablePcapIpv6(), ns3::Names::Find(), ns3::Ipv4NixVectorRouting::FlushGlobalNixRoutingCache(), ns3::Icmpv6L4Protocol::Forward(), ns3::PcapHelper::GetFilenameFromInterfacePair(), ns3::AsciiTraceHelper::GetFilenameFromInterfacePair(), ns3::Ipv6ExtensionFragment::GetFragments(), ns3::MeshWifiInterfaceMac::GetFrequencyChannel(), ns3::Ipv4L3Protocol::GetIcmp(), ns3::Ipv6L3Protocol::GetIcmpv6(), ns3::dsr::DsrOptions::GetIDfromIP(), ns3::dsr::DsrRouting::GetIDfromIP(), ns3::dsr::DsrRouting::GetIPfromID(), ns3::dsr::DsrRouting::GetIPfromMAC(), ns3::SameRoomPositionAllocator::GetNext(), ns3::dsr::DsrOptions::GetNodeWithAddress(), ns3::dsr::DsrRouting::GetNodeWithAddress(), ns3::EpcHelper::GetUeDefaultGatewayAddress(), ns3::Ipv4L3Protocol::HandleFragmentsTimeout(), ns3::Ipv6ExtensionFragment::HandleFragmentsTimeout(), ns3::Icmpv6L4Protocol::HandleNS(), ns3::Icmpv6L4Protocol::HandleRA(), ns3::Icmpv6L4Protocol::HandleRedirection(), ns3::Icmpv6L4Protocol::HandleRS(), ns3::GlobalRouteManagerImpl::InitializeRoutes(), ns3::FlowMonitorHelper::Install(), ns3::RadioEnvironmentMapHelper::Install(), ns3::CsmaHelper::Install(), ns3::WaveformGeneratorHelper::Install(), ns3::InternetStackHelper::Install(), ns3::AdhocAlohaNoackIdealPhyHelper::Install(), ns3::SpectrumAnalyzerHelper::Install(), ns3::WifiHelper::Install(), ns3::MobilityHelper::Install(), ns3::UanHelper::Install(), ns3::FlowMonitorHelper::InstallAll(), ns3::InternetStackHelper::InstallCR(), ns3::WifiHelper::InstallCR(), ns3::Ipv6L3Protocol::IpForward(), ns3::Ipv6L3Protocol::IpMulticastForward(), ns3::Ipv6L3Protocol::LocalDeliver(), ns3::LteFadingTestSuite::LteFadingTestSuite(), ns3::dsr::DsrRouting::NotifyDataReceipt(), ns3::UdpL4Protocol::NotifyNewAggregate(), ns3::TcpL4Protocol::NotifyNewAggregate(), ns3::dsr::DsrRouting::NotifyNewAggregate(), ns3::dsr::DsrOptionRreq::Process(), ns3::dsr::DsrOptionRrep::Process(), ns3::Ipv6ExtensionRouting::Process(), ns3::dsr::DsrOptionSR::Process(), ns3::dsr::DsrOptionRerr::Process(), ns3::Ipv6ExtensionLooseRouting::Process(), ns3::dsr::DsrOptionAckReq::Process(), ns3::dsr::DsrOptionAck::Process(), ns3::Ipv6Extension::ProcessOptions(), ns3::MobilityHelper::PushReferenceMobilityModel(), ns3::Ipv6L3Protocol::Receive(), ns3::Ipv4L3Protocol::Receive(), ns3::Icmpv6L4Protocol::Receive(), ns3::dsr::DsrRouting::Receive(), ns3::Ipv6AutoconfiguredPrefix::RemoveMe(), ns3::MeshHelper::Report(), ns3::MeshHelper::ResetStats(), ns3::Ipv6L3Protocol::RouteInputError(), ns3::SimpleOfdmWimaxChannel::Send(), ns3::YansWifiChannel::Send(), ns3::TcpL4Protocol::Send(), ns3::Ping6::Send(), ns3::Radvd::Send(), ns3::Ipv4Interface::Send(), ns3::Ipv6L3Protocol::Send(), ns3::Ipv4L3Protocol::Send(), ns3::Ipv6Interface::Send(), ns3::Icmpv6L4Protocol::SendMessage(), ns3::Ipv6L3Protocol::SendRealOut(), ns3::Ipv4RawSocketImpl::SendTo(), ns3::Ipv6RawSocketImpl::SendTo(), ns3::SpectrumManager::SenseEnded(), ns3::AnimationInterface::SetConstantPosition(), ns3::Ipv4StaticRoutingHelper::SetDefaultMulticastRoute(), ns3::MobilityHelper::SetPositionAllocator(), ns3::LteHexGridEnbTopologyHelper::SetPositionAndInstallEnbDevice(), ns3::UeManager::SetupDataRadioBearer(), ns3::TcpSocketBase::SetupEndpoint(), ns3::MeshWifiInterfaceMac::SwitchFrequencyChannel(), ns3::UanChannel::TxPacket(), and GlobalPathlossDatabase::UpdatePathloss().

template<typename T >
Ptr< T > ns3::Object::GetObject ( TypeId  tid) const
Parameters
tidthe interface id of the requested interface
Returns
a pointer to the requested interface or zero if it could not be found.

Definition at line 352 of file object.h.

void ns3::Object::Initialize ( void  )

This method calls the virtual DoInitialize method on all the objects aggregated to this object. DoInitialize will be called only once over the lifetime of an object, just like DoDispose is called only once.

See Also
DoInitialize

Note: the code here is a bit tricky because we need to protect ourselves from modifications in the aggregate array while DoInitialize is called. The user's implementation of the DoInitialize method could call GetObject (which could reorder the array) and it could call AggregateObject which would add an object at the end of the array. To be safe, we restart iteration over the array whenever we call some user code, just in case.

Definition at line 179 of file object.cc.

References DoInitialize(), m_aggregates, m_initialized, and NS_LOG_FUNCTION.

Referenced by ns3::Node::AddApplication(), ns3::Node::AddDevice(), ns3::SteadyStateRandomWaypointTest::DoRun(), ns3::WaypointMobilityModelNotifyTest::DoRun(), ns3::LteSimpleHelper::InstallEnbDevice(), and ns3::LteHelper::InstallEnbDevice().

void ns3::Object::NotifyNewAggregate ( void  )
protectedvirtual

This method is invoked whenever two sets of objects are aggregated together. It is invoked exactly once for each object in both sets. This method can be overriden by subclasses who wish to be notified of aggregation events. These subclasses must chain up to their base class NotifyNewAggregate method. It is safe to call GetObject and AggregateObject from within this method.

This function must be implemented in the stack that needs to notify other stacks connected to the node of their presence in the node.

Reimplemented in ns3::dsr::DsrRouting, ns3::Ipv6L3Protocol, ns3::Ipv4L3Protocol, ns3::Icmpv6L4Protocol, ns3::TcpL4Protocol, ns3::UdpL4Protocol, ns3::NscTcpL4Protocol, ns3::ArpL3Protocol, and ns3::Icmpv4L4Protocol.

Definition at line 314 of file object.cc.

References NS_LOG_FUNCTION.

Referenced by AggregateObject(), ns3::Icmpv4L4Protocol::NotifyNewAggregate(), ns3::ArpL3Protocol::NotifyNewAggregate(), ns3::NscTcpL4Protocol::NotifyNewAggregate(), ns3::UdpL4Protocol::NotifyNewAggregate(), ns3::TcpL4Protocol::NotifyNewAggregate(), ns3::Icmpv6L4Protocol::NotifyNewAggregate(), ns3::Ipv4L3Protocol::NotifyNewAggregate(), ns3::Ipv6L3Protocol::NotifyNewAggregate(), and ns3::dsr::DsrRouting::NotifyNewAggregate().

void ns3::Object::SetTypeId ( TypeId  tid)
private
Parameters
tidan TypeId

Invoked from ns3::CreateObject only. Initialize the m_tid member variable to keep track of the type of this object instance.

Definition at line 327 of file object.cc.

References m_tid, NS_ASSERT, and NS_LOG_FUNCTION.

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

Friends And Related Function Documentation

template<typename T >
Ptr<T> CopyObject ( Ptr< T >  object)
friend
Parameters
objecta pointer to the object to copy.
Returns
a copy of the input object.

This method invoke the copy constructor of the input object and returns the new instance.

Definition at line 367 of file object.h.

template<typename T >
Ptr<T> CopyObject ( Ptr< const T >  object)
friend
Parameters
objecta pointer to the object to copy.
Returns
a copy of the input object.

This method invoke the copy constructor of the input object and returns the new instance.

Definition at line 367 of file object.h.

Member Data Documentation

struct Aggregates* ns3::Object::m_aggregates
private

a pointer to an array of 'aggregates'. i.e., a pointer to each object aggregated to this object is stored in this array. The array is shared by all aggregated objects so the size of the array is indirectly a reference count.

Definition at line 294 of file object.h.

Referenced by AggregateObject(), Dispose(), DoDelete(), GetObject(), Initialize(), ns3::Object::AggregateIterator::Next(), and Object().

bool ns3::Object::m_disposed
private

Set to true when the DoDispose method of the object has run, false otherwise.

Definition at line 282 of file object.h.

Referenced by AggregateObject(), Dispose(), DoDelete(), and DoDispose().

uint32_t ns3::Object::m_getObjectCount
private

Indicates the number of times the object was accessed with a call to GetObject. This integer is used to implement a heuristic to sort the array of aggregates to put at the start of the array the most-frequently accessed elements.

Definition at line 301 of file object.h.

bool ns3::Object::m_initialized
private

Set to true once the DoInitialize method has run, false otherwise

Definition at line 287 of file object.h.

Referenced by DoInitialize(), and Initialize().

TypeId ns3::Object::m_tid
private

Identifies the type of this object instance.

Definition at line 277 of file object.h.

Referenced by GetInstanceTypeId(), and SetTypeId().


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