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

instantiate subclasses of ns3::Object. More...

#include <object-factory.h>

+ Collaboration diagram for ns3::ObjectFactory:

Public Member Functions

 ObjectFactory ()
 
 ObjectFactory (std::string typeId)
 
Ptr< ObjectCreate (void) const
 
template<typename T >
Ptr< T > Create (void) const
 
TypeId GetTypeId (void) const
 
void Set (std::string name, const AttributeValue &value)
 
void SetTypeId (TypeId tid)
 
void SetTypeId (const char *tid)
 
void SetTypeId (std::string tid)
 

Private Attributes

AttributeConstructionList m_parameters
 
TypeId m_tid
 

Friends

std::ostream & operator<< (std::ostream &os, const ObjectFactory &factory)
 
std::istream & operator>> (std::istream &is, ObjectFactory &factory)
 

Detailed Description

instantiate subclasses of ns3::Object.

This class can also hold a set of attributes to set automatically during the object construction.

Definition at line 39 of file object-factory.h.

Constructor & Destructor Documentation

ns3::ObjectFactory::ObjectFactory ( )

Definition at line 29 of file object-factory.cc.

References NS_LOG_FUNCTION.

ns3::ObjectFactory::ObjectFactory ( std::string  typeId)

Definition at line 34 of file object-factory.cc.

References NS_LOG_FUNCTION, and SetTypeId().

+ Here is the call graph for this function:

Member Function Documentation

Ptr< Object > ns3::ObjectFactory::Create ( void  ) const
Returns
a new object instance.

Definition at line 90 of file object-factory.cc.

References ns3::Object::Construct(), ns3::TypeId::GetConstructor(), m_parameters, m_tid, NS_ASSERT, NS_LOG_FUNCTION, and ns3::Object::SetTypeId().

Referenced by ns3::FileHelper::AddProbe(), ns3::GnuplotHelper::AddProbe(), ns3::SpectrumChannelHelper::AddPropagationLoss(), ns3::SpectrumChannelHelper::AddSpectrumPropagationLoss(), ns3::LteUeRrc::ApplyRadioResourceConfigDedicated(), ns3::AodvHelper::Create(), ns3::Ipv4NixVectorHelper::Create(), ns3::DsdvHelper::Create(), ns3::GridBuildingAllocator::Create(), ns3::DsrHelper::Create(), ns3::OlsrHelper::Create(), Create(), ns3::NqosWifiMacHelper::Create(), ns3::YansWifiChannelHelper::Create(), ns3::QosWifiMacHelper::Create(), ns3::SpectrumChannelHelper::Create(), ns3::YansWifiPhyHelper::Create(), ns3::SpectrumPhyHelper::Create(), ns3::InternetStackHelper::CreateAndAggregateObjectFromTypeId(), ns3::MeshHelper::CreateInterface(), UanTest::CreateNode(), ns3::CreateObjectWithAttributes(), ns3::WifiTest::CreateOne(), ns3::InterferenceHelperSequenceTest::CreateOne(), ns3::TcpL4Protocol::CreateSocket(), ns3::LteHelper::DoInitialize(), ns3::RvBatteryModelHelper::DoInstall(), ns3::BasicEnergySourceHelper::DoInstall(), ns3::WifiRadioEnergyModelHelper::DoInstall(), ns3::AcousticModemEnergyModelHelper::DoInstall(), ns3::SteadyStateRandomWaypointTest::DoRun(), ns3::WaypointMobilityModelNotifyTest::DoRun(), ns3::InterferenceHelperSequenceTest::DoRun(), ns3::ObjectFactoryTestCase::DoRun(), ns3::Bug555TestCase::DoRun(), PointerAttributeTestCase::DoRun(), ns3::GetImpl(), ns3::FlowMonitorHelper::GetMonitor(), ns3::BridgeHelper::Install(), ns3::Ping6Helper::Install(), ns3::UdpServerHelper::Install(), ns3::EnergySourceHelper::Install(), ns3::TapBridgeHelper::Install(), ns3::SixLowPanHelper::Install(), ns3::RadvdHelper::Install(), ns3::CsmaHelper::Install(), ns3::WaveformGeneratorHelper::Install(), ns3::PointToPointHelper::Install(), ns3::AdhocAlohaNoackIdealPhyHelper::Install(), ns3::SpectrumAnalyzerHelper::Install(), ns3::InternetStackHelper::Install(), ns3::WifiHelper::Install(), ns3::UdpClientHelper::Install(), ns3::MobilityHelper::Install(), ns3::UdpTraceClientHelper::Install(), ns3::UanHelper::Install(), ns3::V4PingHelper::InstallPriv(), ns3::PacketSinkHelper::InstallPriv(), ns3::FdNetDeviceHelper::InstallPriv(), ns3::UdpEchoServerHelper::InstallPriv(), ns3::BulkSendHelper::InstallPriv(), ns3::EmuHelper::InstallPriv(), ns3::OnOffHelper::InstallPriv(), ns3::CsmaHelper::InstallPriv(), ns3::UdpEchoClientHelper::InstallPriv(), ns3::LteSimpleHelper::InstallSingleEnbDevice(), ns3::LteHelper::InstallSingleEnbDevice(), ns3::LteSimpleHelper::InstallSingleUeDevice(), ns3::LteHelper::InstallSingleUeDevice(), main(), ns3::VisualSimulatorImpl::NotifyConstructionCompleted(), RoutingExperiment::Run(), ns3::WifiTest::RunOne(), ns3::MobilityHelper::SetPositionAllocator(), ns3::DefaultSimulatorImpl::SetScheduler(), ns3::NullMessageSimulatorImpl::SetScheduler(), ns3::RealtimeSimulatorImpl::SetScheduler(), ns3::DistributedSimulatorImpl::SetScheduler(), ns3::MeshHelper::SetStackInstaller(), ns3::QosWifiMacHelper::Setup(), ns3::UeManager::SetupDataRadioBearer(), DsdvManetExample::SetupMobility(), and BasicEnergyUpdateTest::StateSwitchTest().

+ Here is the call graph for this function:

template<typename T >
Ptr< T > ns3::ObjectFactory::Create ( void  ) const
Returns
a new object instance.

This method performs an extra call to ns3::Object::GetObject before returning a pointer of the requested type to the user. This method is really syntactical sugar.

Definition at line 147 of file object-factory.h.

References Create().

+ Here is the call graph for this function:

TypeId ns3::ObjectFactory::GetTypeId ( void  ) const
Returns
the currently-selected TypeId to use to create an object instance.

Definition at line 83 of file object-factory.cc.

References m_tid, and NS_LOG_FUNCTION.

Referenced by ns3::LteHelper::EnableLogComponents(), ns3::LteHelper::GetHandoverAlgorithmType(), ns3::MobilityHelper::GetMobilityModelType(), ns3::LteHelper::GetSchedulerType(), ns3::MobilityHelper::Install(), and main().

+ Here is the caller graph for this function:

void ns3::ObjectFactory::Set ( std::string  name,
const AttributeValue value 
)
Parameters
namethe name of the attribute to set during object construction
valuethe value of the attribute to set during object construction

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

References ns3::AttributeConstructionList::Add(), ns3::TypeId::AttributeInformation::checker, ns3::AttributeValue::Copy(), ns3::TypeId::GetName(), ns3::TypeId::LookupAttributeByName(), m_parameters, m_tid, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by ns3::YansWifiChannelHelper::AddPropagationLoss(), ns3::SpectrumChannelHelper::AddPropagationLoss(), ns3::SpectrumChannelHelper::AddSpectrumPropagationLoss(), ns3::BulkSendHelper::BulkSendHelper(), ns3::GridBuildingAllocator::Create(), ns3::CreateObjectWithAttributes(), UanTest::DoPhyTests(), ns3::SteadyStateRandomWaypointTest::DoRun(), ns3::WaypointMobilityModelNotifyTest::DoRun(), PointerAttributeTestCase::DoRun(), ns3::TapBridgeHelper::Install(), main(), ns3::OnOffHelper::OnOffHelper(), ns3::PacketSinkHelper::PacketSinkHelper(), RoutingExperiment::Run(), ns3::BasicEnergySourceHelper::Set(), ns3::RvBatteryModelHelper::Set(), ns3::WifiRadioEnergyModelHelper::Set(), ns3::AcousticModemEnergyModelHelper::Set(), ns3::AodvHelper::Set(), ns3::DsrHelper::Set(), ns3::DsdvHelper::Set(), ns3::OlsrHelper::Set(), ns3::YansWifiPhyHelper::Set(), ns3::SpectrumAnalyzerHelper::SetAntenna(), ns3::WaveformGeneratorHelper::SetAntenna(), ns3::AdhocAlohaNoackIdealPhyHelper::SetAntenna(), ns3::UdpEchoServerHelper::SetAttribute(), ns3::PacketSinkHelper::SetAttribute(), ns3::UdpServerHelper::SetAttribute(), ns3::TapBridgeHelper::SetAttribute(), ns3::FdNetDeviceHelper::SetAttribute(), ns3::OnOffHelper::SetAttribute(), ns3::BulkSendHelper::SetAttribute(), ns3::Ping6Helper::SetAttribute(), ns3::EmuHelper::SetAttribute(), ns3::V4PingHelper::SetAttribute(), ns3::RadvdHelper::SetAttribute(), ns3::UdpClientHelper::SetAttribute(), ns3::UdpEchoClientHelper::SetAttribute(), ns3::UdpTraceClientHelper::SetAttribute(), ns3::GridBuildingAllocator::SetBuildingAttribute(), ns3::SpectrumChannelHelper::SetChannel(), ns3::CsmaHelper::SetChannelAttribute(), ns3::PointToPointHelper::SetChannelAttribute(), ns3::OnOffHelper::SetConstantRate(), ns3::BridgeHelper::SetDeviceAttribute(), ns3::SixLowPanHelper::SetDeviceAttribute(), ns3::SpectrumAnalyzerHelper::SetDeviceAttribute(), ns3::CsmaHelper::SetDeviceAttribute(), ns3::WaveformGeneratorHelper::SetDeviceAttribute(), ns3::PointToPointHelper::SetDeviceAttribute(), ns3::AdhocAlohaNoackIdealPhyHelper::SetDeviceAttribute(), ns3::LteHelper::SetEnbAntennaModelAttribute(), ns3::LteHelper::SetEnbDeviceAttribute(), ns3::YansWifiPhyHelper::SetErrorRateModel(), ns3::LteHelper::SetFadingModelAttribute(), ns3::LteHelper::SetHandoverAlgorithmAttribute(), ns3::UanHelper::SetMac(), ns3::MeshHelper::SetMacType(), ns3::MobilityHelper::SetMobilityModel(), ns3::FlowMonitorHelper::SetMonitorAttribute(), ns3::QosWifiMacHelper::SetMsduAggregatorForAc(), ns3::LteHelper::SetPathlossModelAttribute(), ns3::UanHelper::SetPhy(), ns3::SpectrumPhyHelper::SetPhy(), ns3::SpectrumAnalyzerHelper::SetPhyAttribute(), ns3::WaveformGeneratorHelper::SetPhyAttribute(), ns3::AdhocAlohaNoackIdealPhyHelper::SetPhyAttribute(), ns3::SpectrumPhyHelper::SetPhyAttribute(), ns3::MobilityHelper::SetPositionAllocator(), ns3::YansWifiChannelHelper::SetPropagationDelay(), ns3::SpectrumChannelHelper::SetPropagationDelay(), ns3::EmuHelper::SetQueue(), ns3::CsmaHelper::SetQueue(), ns3::PointToPointHelper::SetQueue(), ns3::MeshHelper::SetRemoteStationManager(), ns3::WifiHelper::SetRemoteStationManager(), ns3::LteHelper::SetSchedulerAttribute(), ns3::LteHelper::SetSpectrumChannelAttribute(), ns3::MeshHelper::SetStackInstaller(), ns3::InternetStackHelper::SetTcp(), ns3::UanHelper::SetTransducer(), ns3::NqosWifiMacHelper::SetType(), ns3::QosWifiMacHelper::SetType(), ns3::LteHelper::SetUeAntennaModelAttribute(), ns3::LteHelper::SetUeDeviceAttribute(), DsdvManetExample::SetupMobility(), and ns3::V4PingHelper::V4PingHelper().

+ Here is the call graph for this function:

void ns3::ObjectFactory::SetTypeId ( TypeId  tid)
Parameters
tidthe TypeId of the object to instantiate.

Definition at line 41 of file object-factory.cc.

References ns3::TypeId::GetName(), m_tid, and NS_LOG_FUNCTION.

Referenced by ns3::AcousticModemEnergyModelHelper::AcousticModemEnergyModelHelper(), ns3::FileHelper::AddProbe(), ns3::GnuplotHelper::AddProbe(), ns3::YansWifiChannelHelper::AddPropagationLoss(), ns3::SpectrumChannelHelper::AddPropagationLoss(), ns3::SpectrumChannelHelper::AddSpectrumPropagationLoss(), ns3::AdhocAlohaNoackIdealPhyHelper::AdhocAlohaNoackIdealPhyHelper(), ns3::AodvHelper::AodvHelper(), ns3::LteUeRrc::ApplyRadioResourceConfigDedicated(), ns3::BasicEnergySourceHelper::BasicEnergySourceHelper(), ns3::BridgeHelper::BridgeHelper(), ns3::BulkSendHelper::BulkSendHelper(), ns3::InternetStackHelper::CreateAndAggregateObjectFromTypeId(), ns3::CreateObjectWithAttributes(), ns3::TcpL4Protocol::CreateSocket(), ns3::CsmaHelper::CsmaHelper(), UanTest::DoPhyTests(), ns3::SteadyStateRandomWaypointTest::DoRun(), ns3::WaypointMobilityModelNotifyTest::DoRun(), BasicEnergyUpdateTest::DoRun(), ns3::WifiTest::DoRun(), ns3::InterferenceHelperSequenceTest::DoRun(), ns3::ObjectFactoryTestCase::DoRun(), ns3::Bug555TestCase::DoRun(), PointerAttributeTestCase::DoRun(), ns3::DsdvHelper::DsdvHelper(), ns3::DsrHelper::DsrHelper(), ns3::EmuHelper::EmuHelper(), ns3::FdNetDeviceHelper::FdNetDeviceHelper(), ns3::FlowMonitorHelper::FlowMonitorHelper(), ns3::anonymous_namespace{visual-simulator-impl.cc}::GetDefaultSimulatorImplFactory(), ns3::GetImpl(), ns3::GridBuildingAllocator::GridBuildingAllocator(), ns3::EnergySourceHelper::Install(), ns3::Ipv4NixVectorHelper::Ipv4NixVectorHelper(), ns3::LteHelper::LteHelper(), ns3::LteSimpleHelper::LteSimpleHelper(), main(), ns3::MobilityHelper::MobilityHelper(), ObjectFactory(), ns3::OlsrHelper::OlsrHelper(), ns3::OnOffHelper::OnOffHelper(), ns3::operator>>(), ns3::PacketSinkHelper::PacketSinkHelper(), ns3::Ping6Helper::Ping6Helper(), ns3::PointToPointHelper::PointToPointHelper(), ns3::RadvdHelper::RadvdHelper(), RoutingExperiment::Run(), ns3::RvBatteryModelHelper::RvBatteryModelHelper(), ns3::SpectrumAnalyzerHelper::SetAntenna(), ns3::WaveformGeneratorHelper::SetAntenna(), ns3::AdhocAlohaNoackIdealPhyHelper::SetAntenna(), ns3::SpectrumChannelHelper::SetChannel(), ns3::LteHelper::SetEnbAntennaModelType(), ns3::YansWifiPhyHelper::SetErrorRateModel(), ns3::LteHelper::SetFadingModel(), ns3::LteHelper::SetHandoverAlgorithmType(), ns3::Simulator::SetImplementation(), ns3::UanHelper::SetMac(), ns3::MeshHelper::SetMacType(), ns3::MobilityHelper::SetMobilityModel(), ns3::QosWifiMacHelper::SetMsduAggregatorForAc(), ns3::LteHelper::SetPathlossModelType(), ns3::UanHelper::SetPhy(), ns3::SpectrumPhyHelper::SetPhy(), ns3::MobilityHelper::SetPositionAllocator(), ns3::YansWifiChannelHelper::SetPropagationDelay(), ns3::SpectrumChannelHelper::SetPropagationDelay(), ns3::EmuHelper::SetQueue(), ns3::CsmaHelper::SetQueue(), ns3::PointToPointHelper::SetQueue(), ns3::MeshHelper::SetRemoteStationManager(), ns3::WifiHelper::SetRemoteStationManager(), ns3::LteHelper::SetSchedulerType(), ns3::LteHelper::SetSpectrumChannelType(), ns3::MeshHelper::SetStackInstaller(), ns3::InternetStackHelper::SetTcp(), ns3::UanHelper::SetTransducer(), ns3::NqosWifiMacHelper::SetType(), ns3::QosWifiMacHelper::SetType(), ns3::LteHelper::SetUeAntennaModelType(), ns3::UeManager::SetupDataRadioBearer(), DsdvManetExample::SetupMobility(), SimulatorTestSuite::SimulatorTestSuite(), ns3::SixLowPanHelper::SixLowPanHelper(), ns3::SpectrumAnalyzerHelper::SpectrumAnalyzerHelper(), ns3::TapBridgeHelper::TapBridgeHelper(), ThreadedSimulatorTestSuite::ThreadedSimulatorTestSuite(), ns3::UanHelper::UanHelper(), ns3::UdpClientHelper::UdpClientHelper(), ns3::UdpEchoClientHelper::UdpEchoClientHelper(), ns3::UdpEchoServerHelper::UdpEchoServerHelper(), ns3::UdpServerHelper::UdpServerHelper(), ns3::UdpTraceClientHelper::UdpTraceClientHelper(), ns3::V4PingHelper::V4PingHelper(), ns3::WaveformGeneratorHelper::WaveformGeneratorHelper(), ns3::WifiRadioEnergyModelHelper::WifiRadioEnergyModelHelper(), and ns3::YansWifiPhyHelper::YansWifiPhyHelper().

+ Here is the call graph for this function:

void ns3::ObjectFactory::SetTypeId ( const char *  tid)
Parameters
tidthe TypeId of the object to instantiate.

Definition at line 53 of file object-factory.cc.

References ns3::TypeId::LookupByName(), m_tid, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::ObjectFactory::SetTypeId ( std::string  tid)
Parameters
tidthe TypeId of the object to instantiate.

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

References ns3::TypeId::LookupByName(), m_tid, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const ObjectFactory factory 
)
friend

Definition at line 103 of file object-factory.cc.

std::istream& operator>> ( std::istream &  is,
ObjectFactory factory 
)
friend

Definition at line 118 of file object-factory.cc.

Member Data Documentation

AttributeConstructionList ns3::ObjectFactory::m_parameters
private

Definition at line 88 of file object-factory.h.

Referenced by Create(), ns3::operator<<(), ns3::operator>>(), and Set().

TypeId ns3::ObjectFactory::m_tid
private

Definition at line 87 of file object-factory.h.

Referenced by Create(), GetTypeId(), ns3::operator<<(), ns3::operator>>(), Set(), and SetTypeId().


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