a base class which provides memory management and object aggregation More...
#include <object.h>
Inherits SimpleRefCount< Object, ObjectBase, ObjectDeleter >.
Inherited by ns3::Application, ns3::ArpCache, ns3::ArpL3Protocol, ns3::AthstatsWifiTraceSink, ns3::BandwidthManager, ns3::BSLinkManager, ns3::BSScheduler, ns3::BurstProfileManager, ns3::CanvasLocation, ns3::Channel, ns3::ConnectionManager, ns3::DataCalculator, ns3::DataCollector, ns3::DataOutputInterface, ns3::Dcf, ns3::dot11s::AirtimeLinkMetricCalculator, ns3::dot11s::HwmpRtable, ns3::dot11s::PeerLink, ns3::dot11s::PeerManagementProtocol, ns3::ErrorModel, ns3::ErrorRateModel, ns3::flame::FlameRtable, ns3::FlowMonitor, ns3::GlobalRouter, ns3::IpcsClassifier, ns3::Ipv4, ns3::Ipv4Interface, ns3::Ipv4L4Protocol, ns3::Ipv4RoutingProtocol, ns3::Ipv6, ns3::Ipv6AutoconfiguredPrefix, ns3::Ipv6Extension, ns3::Ipv6ExtensionDemux, ns3::Ipv6ExtensionRoutingDemux, ns3::Ipv6Interface, ns3::Ipv6L4Protocol, ns3::Ipv6Option, ns3::Ipv6OptionDemux, ns3::Ipv6RoutingProtocol, ns3::MacLow, ns3::MeshL2RoutingProtocol, ns3::MeshStack, ns3::MobilityModel, ns3::MsduAggregator, ns3::NdiscCache, ns3::NetDevice, ns3::NixVector, ns3::Node, ns3::NodeListPriv, ns3::Ns3NscStack, ns3::PacketBurst, ns3::PcapFileWrapper, ns3::PositionAllocator, ns3::PriorityUlJob, ns3::PropagationDelayModel, ns3::PropagationLossModel, ns3::Queue, ns3::RttEstimator, ns3::Scheduler, ns3::ServiceFlowManager, ns3::SimulatorImpl, ns3::Socket, ns3::SocketFactory, ns3::SSLinkManager, ns3::SSManager, ns3::SSScheduler, ns3::Synchronizer, ns3::TopologyReader, ns3::UlJob, ns3::UplinkScheduler, ns3::WifiMac, ns3::WifiMacQueue, ns3::WifiPhy, ns3::WifiPhyStateHelper, ns3::WifiRemoteStationManager, ns3::WimaxConnection, ns3::WimaxMacQueue, and ns3::WimaxPhy.
Classes | |
class | AggregateIterator |
Iterate over the objects aggregated to an ns3::Object. More... | |
struct | Aggregates |
Public Member Functions | |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Dispose (void) |
void | AggregateObject (Ptr< Object > other) |
AggregateIterator | GetAggregateIterator (void) const |
void | Start (void) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::Object. | |
Protected Member Functions | |
virtual void | NotifyNewAggregate (void) |
virtual void | DoStart (void) |
virtual void | DoDispose (void) |
Object (const Object &o) | |
Friends | |
class | ObjectFactory |
class | AggregateIterator |
class | ObjectDeleter |
template<typename T > | |
Ptr< T > | CreateObjectWithAttributes (const AttributeList &attributes) |
template<typename T > | |
Ptr< T > | CopyObject (Ptr< T > object) |
template<typename T > | |
Ptr< T > | CopyObject (Ptr< const T > object) |
void | PythonCompleteConstruct (Ptr< Object > object, TypeId typeId, const AttributeList &attributes) |
template<typename T > | |
Ptr< T > | CompleteConstruct (T *object) |
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.
ns3::Object::Object | ( | const Object & | o | ) | [protected] |
o | the 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.
other | another 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.
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. It is an error to call Dispose twice on the same object instance.
This method is typically used to break reference cycles.
virtual void ns3::Object::DoDispose | ( | void | ) | [protected, virtual] |
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::OnOffApplication, ns3::PacketSink, ns3::Ping6, ns3::Radvd, ns3::UdpClient, ns3::UdpServer, ns3::UdpTraceClient, ns3::UdpEchoClient, ns3::UdpEchoServer, ns3::CounterCalculator< T >, ns3::DataCalculator, ns3::DataCollector, ns3::DataOutputInterface, ns3::OmnetDataOutput, ns3::PacketCounterCalculator, ns3::SqliteDataOutput, ns3::TimeMinMaxAvgTotalCalculator, ns3::BridgeNetDevice, ns3::CsmaNetDevice, ns3::dot11s::HwmpProtocol, ns3::dot11s::HwmpRtable, ns3::dot11s::PeerLink, ns3::dot11s::PeerManagementProtocol, ns3::flame::FlameProtocol, ns3::flame::FlameRtable, ns3::MeshPointDevice, ns3::TapBridge, ns3::VirtualNetDevice, ns3::EdcaTxopN, ns3::WifiRemoteStationManager, ns3::BandwidthManager, ns3::BsServiceFlowManager, ns3::BurstProfileManager, ns3::ConnectionManager, ns3::ServiceFlowManager, ns3::SSLinkManager, ns3::SSScheduler, ns3::SsServiceFlowManager, ns3::WimaxNetDevice, ns3::WimaxPhy, ns3::Dot11sStack, ns3::FlameStack, ns3::ArpL3Protocol, ns3::Icmpv6L4Protocol, ns3::Ipv4Interface, ns3::Ipv4L3Protocol, ns3::Ipv6ExtensionDemux, ns3::Ipv6ExtensionFragment, ns3::Ipv6ExtensionRoutingDemux, ns3::Ipv6Interface, ns3::Ipv6L3Protocol, ns3::Ipv6OptionDemux, ns3::LoopbackNetDevice, ns3::NscTcpL4Protocol, ns3::NscTcpSocketFactoryImpl, ns3::TcpL4Protocol, ns3::TcpSocketFactoryImpl, ns3::UdpL4Protocol, ns3::UdpSocketFactoryImpl, ns3::Application, ns3::Node, ns3::SimpleNetDevice, ns3::Socket, ns3::aodv::RoutingProtocol, ns3::Ipv4GlobalRouting, ns3::Ipv4ListRouting, ns3::Ipv6ListRouting, ns3::Ipv4StaticRouting, ns3::Ipv6StaticRouting, and ns3::CounterCalculator< uint32_t >.
virtual void ns3::Object::DoStart | ( | void | ) | [protected, virtual] |
This method is called only once by Object::Start. If the user calls Object::Start multiple times, DoStart 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::RandomWaypointMobilityModel, ns3::SteadyStateRandomWaypointMobilityModel, ns3::Application, ns3::Node, ns3::Ipv4ListRouting, and ns3::olsr::RoutingProtocol.
AggregateIterator ns3::Object::GetAggregateIterator | ( | void | ) | const |
If no objects are aggregated to this object, then, the returned iterator will be empty and AggregateIterator::HasNext will always return false.
virtual TypeId ns3::Object::GetInstanceTypeId | ( | void | ) | const [virtual] |
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::FlowMonitor, and ns3::Ns3NscStack.
tid | the interface id of the requested interface |
Ptr< T > ns3::Object::GetObject | ( | void | ) | const [inline] |
static TypeId ns3::Object::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::Object.
This object is accessible through the following paths with Config::Set and Config::Connect:
No Attributes defined for this type.
No TraceSources defined for this type.
Reimplemented from ns3::ObjectBase.
Reimplemented in ns3::OnOffApplication, ns3::PacketSink, ns3::Ping6, ns3::Radvd, ns3::UdpClient, ns3::UdpServer, ns3::UdpTraceClient, ns3::UdpEchoClient, ns3::UdpEchoServer, ns3::V4Ping, ns3::Cost231PropagationLossModel, ns3::ErrorModel, ns3::RateErrorModel, ns3::ListErrorModel, ns3::JakesPropagationLossModel, ns3::NixVector, ns3::PcapFileWrapper, ns3::PropagationDelayModel, ns3::RandomPropagationDelayModel, ns3::ConstantSpeedPropagationDelayModel, ns3::PropagationLossModel, ns3::RandomPropagationLossModel, ns3::FriisPropagationLossModel, ns3::TwoRayGroundPropagationLossModel, ns3::LogDistancePropagationLossModel, ns3::ThreeLogDistancePropagationLossModel, ns3::NakagamiPropagationLossModel, ns3::FixedRssLossModel, ns3::MatrixPropagationLossModel, ns3::FlowMonitor, ns3::InetTopologyReader, ns3::OrbisTopologyReader, ns3::TopologyReader, ns3::BridgeChannel, ns3::BridgeNetDevice, ns3::CsmaChannel, ns3::CsmaNetDevice, ns3::EmuNetDevice, ns3::dot11s::AirtimeLinkMetricCalculator, ns3::dot11s::HwmpProtocol, ns3::dot11s::HwmpRtable, ns3::dot11s::PeerLink, ns3::dot11s::PeerManagementProtocol, ns3::flame::FlameProtocol, ns3::flame::FlameRtable, ns3::MeshL2RoutingProtocol, ns3::MeshPointDevice, ns3::MeshWifiInterfaceMac, ns3::PointToPointChannel, ns3::PointToPointNetDevice, ns3::PointToPointRemoteChannel, ns3::TapBridge, ns3::VirtualNetDevice, ns3::AarfWifiManager, ns3::AarfcdWifiManager, ns3::AdhocWifiMac, ns3::AmrrWifiManager, ns3::ArfWifiManager, ns3::CaraWifiManager, ns3::ConstantRateWifiManager, ns3::DcaTxop, ns3::Dcf, ns3::EdcaTxopN, ns3::ErrorRateModel, ns3::IdealWifiManager, ns3::MinstrelWifiManager, ns3::MsduAggregator, ns3::MsduStandardAggregator, ns3::NqapWifiMac, ns3::NqstaWifiMac, ns3::OnoeWifiManager, ns3::QadhocWifiMac, ns3::QapWifiMac, ns3::QstaWifiMac, ns3::RraaWifiManager, ns3::WifiChannel, ns3::WifiMacQueue, ns3::WifiMac, ns3::WifiNetDevice, ns3::WifiPhyStateHelper, ns3::WifiPhy, ns3::WifiRemoteStationManager, ns3::YansErrorRateModel, ns3::YansWifiChannel, ns3::YansWifiPhy, ns3::BaseStationNetDevice, ns3::BSSchedulerRtps, ns3::BSSchedulerSimple, ns3::BSScheduler, ns3::UplinkSchedulerMBQoS, ns3::UplinkSchedulerRtps, ns3::UplinkSchedulerSimple, ns3::UplinkScheduler, ns3::PacketBurst, ns3::SimpleOfdmWimaxPhy, ns3::SubscriberStationNetDevice, ns3::WimaxConnection, ns3::WimaxMacQueue, ns3::WimaxNetDevice, ns3::WimaxPhy, ns3::AthstatsWifiTraceSink, ns3::CanvasLocation, ns3::Dot11sStack, ns3::FlameStack, ns3::ArpCache, ns3::ArpL3Protocol, ns3::Icmpv4L4Protocol, ns3::Icmpv6L4Protocol, ns3::Ipv4Interface, ns3::Ipv4L3Protocol, ns3::Ipv4L4Protocol, ns3::Ipv4RawSocketImpl, ns3::Ipv6ExtensionDemux, ns3::Ipv6Extension, ns3::Ipv6ExtensionHopByHop, ns3::Ipv6ExtensionDestination, ns3::Ipv6ExtensionFragment, ns3::Ipv6ExtensionRouting, ns3::Ipv6ExtensionRoutingDemux, ns3::Ipv6ExtensionLooseRouting, ns3::Ipv6ExtensionESP, ns3::Ipv6ExtensionAH, ns3::Ipv6Interface, ns3::Ipv6L3Protocol, ns3::Ipv6L4Protocol, ns3::Ipv6OptionDemux, ns3::Ipv6Option, ns3::Ipv6OptionPad1, ns3::Ipv6OptionPadn, ns3::Ipv6OptionJumbogram, ns3::Ipv6OptionRouterAlert, ns3::Ipv6RawSocketImpl, ns3::LoopbackNetDevice, ns3::NdiscCache, ns3::Ns3NscStack, ns3::NscTcpL4Protocol, ns3::NscTcpSocketImpl, ns3::RttEstimator, ns3::RttMeanDeviation, ns3::TcpL4Protocol, ns3::TcpSocketImpl, ns3::UdpL4Protocol, ns3::UdpSocketImpl, ns3::ConstantAccelerationMobilityModel, ns3::ConstantPositionMobilityModel, ns3::ConstantVelocityMobilityModel, ns3::GaussMarkovMobilityModel, ns3::HierarchicalMobilityModel, ns3::MobilityModel, ns3::PositionAllocator, ns3::ListPositionAllocator, ns3::GridPositionAllocator, ns3::RandomRectanglePositionAllocator, ns3::RandomBoxPositionAllocator, ns3::RandomDiscPositionAllocator, ns3::UniformDiscPositionAllocator, ns3::RandomDirection2dMobilityModel, ns3::RandomWalk2dMobilityModel, ns3::RandomWaypointMobilityModel, ns3::SteadyStateRandomWaypointMobilityModel, ns3::WaypointMobilityModel, ns3::DistributedSimulatorImpl, ns3::Application, ns3::Channel, ns3::DropTailQueue, ns3::Ipv4RawSocketFactory, ns3::Ipv4RoutingProtocol, ns3::Ipv4, ns3::Ipv6RawSocketFactory, ns3::Ipv6RoutingProtocol, ns3::Ipv6, ns3::NetDevice, ns3::Node, ns3::PacketSocketFactory, ns3::PacketSocket, ns3::Queue, ns3::SimpleChannel, ns3::SimpleNetDevice, ns3::SocketFactory, ns3::TcpSocketFactory, ns3::TcpSocket, ns3::UdpSocketFactory, ns3::UdpSocket, ns3::aodv::RoutingProtocol, ns3::GlobalRouter, ns3::Ipv4GlobalRouting, ns3::Ipv4ListRouting, ns3::Ipv6ListRouting, ns3::Ipv4NixVectorRouting, ns3::olsr::RoutingProtocol, ns3::Ipv4StaticRouting, ns3::Ipv6StaticRouting, ns3::CalendarScheduler, ns3::DefaultSimulatorImpl, ns3::HeapScheduler, ns3::ListScheduler, ns3::MapScheduler, ns3::Ns2CalendarScheduler, ns3::RealtimeSimulatorImpl, ns3::Scheduler, and ns3::Synchronizer.
virtual void ns3::Object::NotifyNewAggregate | ( | void | ) | [protected, virtual] |
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.
Reimplemented in ns3::ArpL3Protocol, ns3::Icmpv4L4Protocol, ns3::Icmpv6L4Protocol, ns3::Ipv4L3Protocol, ns3::Ipv6L3Protocol, ns3::NscTcpL4Protocol, ns3::TcpL4Protocol, and ns3::UdpL4Protocol.
void ns3::Object::Start | ( | void | ) |
This method calls the virtual DoStart method on all the objects aggregated to this object. DoStart will be called only once over the lifetime of an object, just like DoDispose is called only once.
Reimplemented in ns3::BaseStationNetDevice, ns3::SubscriberStationNetDevice, and ns3::WimaxNetDevice.
object | a pointer to the object to copy. |
This method invoke the copy constructor of the input object and returns the new instance.
object | a pointer to the object to copy. |
This method invoke the copy constructor of the input object and returns the new instance.
Ptr<T> CreateObjectWithAttributes | ( | const AttributeList & | attributes | ) | [friend] |
attributes | a list of attributes to set on the object during construction. |
This allocates an object on the heap and initializes it with a set of attributes.