A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
adhoc-aloha-noack-ideal-phy-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010 CTTC
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Nicola Baldo <nbaldo@cttc.es>
7 */
8
9#ifndef ADHOC_ALOHA_NOACK_IDEAL_PHY_HELPER_H
10#define ADHOC_ALOHA_NOACK_IDEAL_PHY_HELPER_H
11
12#include <ns3/attribute.h>
13#include <ns3/net-device-container.h>
14#include <ns3/node-container.h>
15#include <ns3/object-factory.h>
16#include <ns3/queue.h>
17
18#include <string>
19
20namespace ns3
21{
22
23class SpectrumValue;
24class SpectrumChannel;
25
26/**
27 * \ingroup spectrum
28 * \brief create the AlohaNoackNetDevice
29 */
31{
32 public:
35
36 /**
37 * set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
38 *
39 * @param channel
40 */
41 void SetChannel(Ptr<SpectrumChannel> channel);
42
43 /**
44 * set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
45 *
46 * @param channelName
47 */
48 void SetChannel(std::string channelName);
49
50 /**
51 *
52 * @param txPsd the Power Spectral Density to be used for transmission by all created PHY
53 * instances
54 */
56
57 /**
58 *
59 * @param noisePsd the Power Spectral Density to be used for transmission by all created PHY
60 * instances
61 */
63
64 /**
65 * @param name the name of the attribute to set
66 * @param v the value of the attribute
67 *
68 * Set these attributes on each HdOfdmSpectrumPhy instance to be created
69 */
70 void SetPhyAttribute(std::string name, const AttributeValue& v);
71
72 /**
73 * @param n1 the name of the attribute to set
74 * @param v1 the value of the attribute to set
75 *
76 * Set these attributes on each AlohaNoackNetDevice created
77 */
78 void SetDeviceAttribute(std::string n1, const AttributeValue& v1);
79
80 /**
81 * \tparam Ts \deduced Argument types
82 * \param type the type of the model to set
83 * \param [in] args Name and AttributeValue pairs to set.
84 *
85 * Configure the AntennaModel instance for each new device to be created
86 */
87 template <typename... Ts>
88 void SetAntenna(std::string type, Ts&&... args);
89
90 /**
91 * @param c the set of nodes on which a device must be created
92 * @return a device container which contains all the devices created by this method.
93 */
95 /**
96 * @param node the node on which a device must be created
97 * \returns a device container which contains all the devices created by this method.
98 */
100 /**
101 * @param nodeName the name of node on which a device must be created
102 * @return a device container which contains all the devices created by this method.
103 */
104 NetDeviceContainer Install(std::string nodeName) const;
105
106 protected:
107 ObjectFactory m_phy; //!< Object factory for the phy objects
108 ObjectFactory m_device; //!< Object factory for the NetDevice objects
109 ObjectFactory m_queue; //!< Object factory for the Queue objects
110 ObjectFactory m_antenna; //!< Object factory for the Antenna objects
112 Ptr<SpectrumValue> m_txPsd; //!< Tx power spectral density
113 Ptr<SpectrumValue> m_noisePsd; //!< Noise power spectral density
114};
115
116/***************************************************************
117 * Implementation of the templates declared above.
118 ***************************************************************/
119
120template <typename... Ts>
121void
122AdhocAlohaNoackIdealPhyHelper::SetAntenna(std::string type, Ts&&... args)
123{
124 m_antenna = ObjectFactory(std::forward<Ts>(args)...);
125}
126
127} // namespace ns3
128
129#endif /* ADHOC_ALOHA_NOACK_IDEAL_PHY_HELPER_H */
void SetPhyAttribute(std::string name, const AttributeValue &v)
ObjectFactory m_queue
Object factory for the Queue objects.
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
Ptr< SpectrumValue > m_noisePsd
Noise power spectral density.
void SetAntenna(std::string type, Ts &&... args)
Ptr< SpectrumValue > m_txPsd
Tx power spectral density.
void SetNoisePowerSpectralDensity(Ptr< SpectrumValue > noisePsd)
ObjectFactory m_phy
Object factory for the phy objects.
ObjectFactory m_antenna
Object factory for the Antenna objects.
ObjectFactory m_device
Object factory for the NetDevice objects.
void SetChannel(Ptr< SpectrumChannel > channel)
set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
NetDeviceContainer Install(NodeContainer c) const
Hold a value for an Attribute.
Definition attribute.h:59
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.