A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
waveform-generator-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 WAVEFORM_GENERATOR_HELPER_H
10#define WAVEFORM_GENERATOR_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 *
29 * Create a Waveform generator, which can be used to inject specific noise in the channel.
30 */
32{
33 public:
36
37 /**
38 * set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
39 *
40 * @param channel
41 */
42 void SetChannel(Ptr<SpectrumChannel> channel);
43
44 /**
45 * set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
46 *
47 * @param channelName
48 */
49 void SetChannel(std::string channelName);
50
51 /**
52 *
53 * @param txPsd the Power Spectral Density to be used for transmission by all created PHY
54 * instances
55 */
57
58 /**
59 * @param name the name of the attribute to set
60 * @param v the value of the attribute
61 *
62 * Set these attributes on each HdOfdmSpectrumPhy instance to be created
63 */
64 void SetPhyAttribute(std::string name, const AttributeValue& v);
65
66 /**
67 * @param n1 the name of the attribute to set
68 * @param v1 the value of the attribute to set
69 *
70 * Set these attributes on each AlohaNoackNetDevice created
71 */
72 void SetDeviceAttribute(std::string n1, const AttributeValue& v1);
73
74 /**
75 * \tparam Ts \deduced Argument types
76 * \param type the type of the model to set
77 * \param [in] args Name and AttributeValue pairs to set.
78 *
79 * Configure the AntennaModel instance for each new device to be created
80 */
81 template <typename... Ts>
82 void SetAntenna(std::string type, Ts&&... args);
83
84 /**
85 * @param c the set of nodes on which a device must be created
86 * @return a device container which contains all the devices created by this method.
87 */
89 /**
90 * @param node the node on which a device must be created
91 * \returns a device container which contains all the devices created by this method.
92 */
94 /**
95 * @param nodeName the name of node on which a device must be created
96 * @return a device container which contains all the devices created by this method.
97 */
98 NetDeviceContainer Install(std::string nodeName) const;
99
100 protected:
101 ObjectFactory m_phy; //!< Object factory for the phy objects
102 ObjectFactory m_device; //!< Object factory for the NetDevice objects
103 ObjectFactory m_antenna; //!< Object factory for the Antenna objects
105 Ptr<SpectrumValue> m_txPsd; //!< Tx power spectral density
106};
107
108/***************************************************************
109 * Implementation of the templates declared above.
110 ***************************************************************/
111
112template <typename... Ts>
113void
114WaveformGeneratorHelper::SetAntenna(std::string type, Ts&&... args)
115{
116 m_antenna = ObjectFactory(type, std::forward<Ts>(args)...);
117}
118
119} // namespace ns3
120
121#endif /* WAVEFORM_GENERATOR_HELPER_H */
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.
Create a Waveform generator, which can be used to inject specific noise in the channel.
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
void SetAntenna(std::string type, Ts &&... args)
Ptr< SpectrumValue > m_txPsd
Tx power spectral density.
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
ObjectFactory m_phy
Object factory for the phy objects.
void SetChannel(Ptr< SpectrumChannel > channel)
set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
Ptr< SpectrumChannel > m_channel
Channel.
NetDeviceContainer Install(NodeContainer c) const
void SetPhyAttribute(std::string name, const AttributeValue &v)
ObjectFactory m_device
Object factory for the NetDevice objects.
ObjectFactory m_antenna
Object factory for the Antenna objects.
Every class exported by the ns3 library is enclosed in the ns3 namespace.