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

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

#include <object-factory.h>

Public Member Functions

 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.

Member Function Documentation

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

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

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

Referenced by ns3::SpectrumChannelHelper::AddPropagationLoss(), ns3::SpectrumChannelHelper::AddSpectrumPropagationLoss(), ns3::Ipv4NixVectorHelper::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(), ns3::CreateObjectWithAttributes(), ns3::PointerValue::DeserializeFromString(), ns3::LteHelper::DoInitialize(), ns3::BasicEnergySourceHelper::DoInstall(), ns3::RvBatteryModelHelper::DoInstall(), ns3::AcousticModemEnergyModelHelper::DoInstall(), ns3::WifiRadioEnergyModelHelper::DoInstall(), ns3::SteadyStateRandomWaypointTest::DoRun(), ns3::WaypointMobilityModelNotifyTest::DoRun(), ns3::InterferenceHelperSequenceTest::DoRun(), ns3::Bug555TestCase::DoRun(), ns3::ObjectFactoryTestCase::DoRun(), PointerAttributeTestCase::DoRun(), ns3::FlowMonitorHelper::GetMonitor(), ns3::BridgeHelper::Install(), ns3::Ping6Helper::Install(), ns3::UdpServerHelper::Install(), ns3::EnergySourceHelper::Install(), ns3::TapBridgeHelper::Install(), ns3::CsmaHelper::Install(), ns3::UdpClientHelper::Install(), ns3::PointToPointHelper::Install(), ns3::WaveformGeneratorHelper::Install(), ns3::InternetStackHelper::Install(), ns3::AdhocAlohaNoackIdealPhyHelper::Install(), ns3::SpectrumAnalyzerHelper::Install(), ns3::WifiHelper::Install(), ns3::UdpTraceClientHelper::Install(), ns3::MobilityHelper::Install(), ns3::UanHelper::Install(), ns3::WifiHelper::InstallCR(), ns3::V4PingHelper::InstallPriv(), ns3::PacketSinkHelper::InstallPriv(), ns3::UdpEchoServerHelper::InstallPriv(), ns3::BulkSendHelper::InstallPriv(), ns3::OnOffHelper::InstallPriv(), ns3::VisualSimulatorImpl::NotifyConstructionCompleted(), ns3::MobilityHelper::SetPositionAllocator(), ns3::DefaultSimulatorImpl::SetScheduler(), ns3::RealtimeSimulatorImpl::SetScheduler(), ns3::DistributedSimulatorImpl::SetScheduler(), ns3::MeshHelper::SetStackInstaller(), ns3::UeManager::SetupDataRadioBearer(), and BasicEnergyUpdateTest::StateSwitchTest().

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().

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

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

References NS_LOG_FUNCTION.

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

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 58 of file object-factory.cc.

References ns3::AttributeValue::Copy(), ns3::TypeId::GetName(), ns3::TypeId::LookupAttributeByName(), 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(), ns3::SteadyStateRandomWaypointTest::DoRun(), ns3::WaypointMobilityModelNotifyTest::DoRun(), PointerAttributeTestCase::DoRun(), ns3::TapBridgeHelper::Install(), ns3::OnOffHelper::OnOffHelper(), ns3::PacketSinkHelper::PacketSinkHelper(), ns3::BasicEnergySourceHelper::Set(), ns3::RvBatteryModelHelper::Set(), ns3::AcousticModemEnergyModelHelper::Set(), ns3::WifiRadioEnergyModelHelper::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::OnOffHelper::SetAttribute(), ns3::Ping6Helper::SetAttribute(), ns3::BulkSendHelper::SetAttribute(), ns3::FdNetDeviceHelper::SetAttribute(), ns3::V4PingHelper::SetAttribute(), ns3::EmuHelper::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::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::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(), and ns3::V4PingHelper::V4PingHelper().

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

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

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

Referenced by ns3::AcousticModemEnergyModelHelper::AcousticModemEnergyModelHelper(), ns3::YansWifiChannelHelper::AddPropagationLoss(), ns3::SpectrumChannelHelper::AddPropagationLoss(), ns3::SpectrumChannelHelper::AddSpectrumPropagationLoss(), ns3::BulkSendHelper::BulkSendHelper(), ns3::InternetStackHelper::CreateAndAggregateObjectFromTypeId(), ns3::CreateObjectWithAttributes(), ns3::CsmaHelper::CsmaHelper(), ns3::SteadyStateRandomWaypointTest::DoRun(), ns3::WifiTest::DoRun(), ns3::WaypointMobilityModelNotifyTest::DoRun(), BasicEnergyUpdateTest::DoRun(), ns3::InterferenceHelperSequenceTest::DoRun(), ns3::Bug555TestCase::DoRun(), ns3::ObjectFactoryTestCase::DoRun(), PointerAttributeTestCase::DoRun(), ns3::DsrHelper::DsrHelper(), ns3::FdNetDeviceHelper::FdNetDeviceHelper(), ns3::FlowMonitorHelper::FlowMonitorHelper(), ns3::EnergySourceHelper::Install(), ns3::MobilityHelper::MobilityHelper(), ns3::OlsrHelper::OlsrHelper(), ns3::OnOffHelper::OnOffHelper(), ns3::PacketSinkHelper::PacketSinkHelper(), ns3::Ping6Helper::Ping6Helper(), ns3::PointToPointHelper::PointToPointHelper(), ns3::SpectrumAnalyzerHelper::SetAntenna(), ns3::WaveformGeneratorHelper::SetAntenna(), ns3::AdhocAlohaNoackIdealPhyHelper::SetAntenna(), ns3::SpectrumChannelHelper::SetChannel(), ns3::LteHelper::SetEnbAntennaModelType(), ns3::YansWifiPhyHelper::SetErrorRateModel(), ns3::LteHelper::SetFadingModel(), 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::CsmaHelper::SetQueue(), ns3::EmuHelper::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(), ns3::TapBridgeHelper::TapBridgeHelper(), ns3::UdpClientHelper::UdpClientHelper(), ns3::UdpEchoClientHelper::UdpEchoClientHelper(), ns3::UdpEchoServerHelper::UdpEchoServerHelper(), ns3::UdpServerHelper::UdpServerHelper(), ns3::UdpTraceClientHelper::UdpTraceClientHelper(), ns3::V4PingHelper::V4PingHelper(), ns3::WifiRadioEnergyModelHelper::WifiRadioEnergyModelHelper(), and ns3::YansWifiPhyHelper::YansWifiPhyHelper().

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

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

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

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

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

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


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