A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lr-wpan-interference-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013 Fraunhofer FKIE
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author:
18 * Sascha Alexander Jopen <jopen@cs.uni-bonn.de>
19 */
20#ifndef LR_WPAN_INTERFERENCE_HELPER_H
21#define LR_WPAN_INTERFERENCE_HELPER_H
22
23#include <ns3/ptr.h>
24#include <ns3/simple-ref-count.h>
25
26#include <set>
27
28namespace ns3
29{
30
31class SpectrumValue;
32class SpectrumModel;
33
34namespace lrwpan
35{
36
37/**
38 * \ingroup lr-wpan
39 *
40 * \brief This class provides helper functions for LrWpan interference handling.
41 */
42class LrWpanInterferenceHelper : public SimpleRefCount<LrWpanInterferenceHelper>
43{
44 public:
45 /**
46 * Create a new interference helper for the given SpectrumModel.
47 *
48 * \param spectrumModel the SpectrumModel to be used
49 */
51
53
54 /**
55 * Add the given signal to the set of accumulated signals. Never add the same
56 * signal more than once. The SpectrumModels of the signal and the one used
57 * for instantiation of the helper have to be the same.
58 *
59 * \param signal the signal to be added
60 * \return false, if the signal was not added because the SpectrumModel of the
61 * signal does not match the one of the helper, true otherwise.
62 */
64
65 /**
66 * Remove the given signal to the set of accumulated signals.
67 *
68 * \param signal the signal to be removed
69 * \return false, if the signal was not removed (because it was not added
70 * before), true otherwise.
71 */
73
74 /**
75 * Remove all currently accumulated signals.
76 */
77 void ClearSignals();
78
79 /**
80 * Get the sum of all accumulated signals.
81 *
82 * \return the sum of the signals
83 */
85
86 /**
87 * Get the SpectrumModel used by the helper.
88 *
89 * \return the helpers SpectrumModel
90 */
92
93 private:
94 // Disable implicit copy constructors
95 /**
96 * \brief Copy constructor - defined and not implemented.
97 */
99 /**
100 * \brief Copy constructor - defined and not implemented.
101 * \returns
102 */
104 /**
105 * The helpers SpectrumModel.
106 */
108
109 /**
110 * The set of accumulated signals.
111 */
112 std::set<Ptr<const SpectrumValue>> m_signals;
113
114 /**
115 * The precomputed sum of all accumulated signals.
116 */
118
119 /**
120 * Mark m_signal as dirty, whenever a signal is added or removed. m_signal has
121 * to be recomputed before next use.
122 */
123 mutable bool m_dirty;
124};
125
126} // namespace lrwpan
127} // namespace ns3
128
129#endif /* LR_WPAN_INTERFERENCE_HELPER_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
A template-based reference counting class.
This class provides helper functions for LrWpan interference handling.
Ptr< SpectrumValue > GetSignalPsd() const
Get the sum of all accumulated signals.
LrWpanInterferenceHelper(const LrWpanInterferenceHelper &)
Copy constructor - defined and not implemented.
bool AddSignal(Ptr< const SpectrumValue > signal)
Add the given signal to the set of accumulated signals.
void ClearSignals()
Remove all currently accumulated signals.
Ptr< const SpectrumModel > GetSpectrumModel() const
Get the SpectrumModel used by the helper.
LrWpanInterferenceHelper & operator=(const LrWpanInterferenceHelper &)
Copy constructor - defined and not implemented.
std::set< Ptr< const SpectrumValue > > m_signals
The set of accumulated signals.
Ptr< SpectrumValue > m_signal
The precomputed sum of all accumulated signals.
bool m_dirty
Mark m_signal as dirty, whenever a signal is added or removed.
Ptr< const SpectrumModel > m_spectrumModel
The helpers SpectrumModel.
bool RemoveSignal(Ptr< const SpectrumValue > signal)
Remove the given signal to the set of accumulated signals.
Every class exported by the ns3 library is enclosed in the ns3 namespace.