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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author:
7 * Sascha Alexander Jopen <jopen@cs.uni-bonn.de>
8 */
9#ifndef LR_WPAN_INTERFERENCE_HELPER_H
10#define LR_WPAN_INTERFERENCE_HELPER_H
11
12#include "ns3/ptr.h"
13#include "ns3/simple-ref-count.h"
14
15#include <set>
16
17namespace ns3
18{
19
20class SpectrumValue;
21class SpectrumModel;
22
23namespace lrwpan
24{
25
26/**
27 * @ingroup lr-wpan
28 *
29 * @brief This class provides helper functions for LrWpan interference handling.
30 */
31class LrWpanInterferenceHelper : public SimpleRefCount<LrWpanInterferenceHelper>
32{
33 public:
34 /**
35 * Create a new interference helper for the given SpectrumModel.
36 *
37 * @param spectrumModel the SpectrumModel to be used
38 */
40
42
43 // Delete copy constructor and assignment operator to avoid misuse
46
47 /**
48 * Add the given signal to the set of accumulated signals. Never add the same
49 * signal more than once. The SpectrumModels of the signal and the one used
50 * for instantiation of the helper have to be the same.
51 *
52 * @param signal the signal to be added
53 * @return false, if the signal was not added because the SpectrumModel of the
54 * signal does not match the one of the helper, true otherwise.
55 */
57
58 /**
59 * Remove the given signal to the set of accumulated signals.
60 *
61 * @param signal the signal to be removed
62 * @return false, if the signal was not removed (because it was not added
63 * before), true otherwise.
64 */
66
67 /**
68 * Remove all currently accumulated signals.
69 */
70 void ClearSignals();
71
72 /**
73 * Get the sum of all accumulated signals.
74 *
75 * @return the sum of the signals
76 */
78
79 /**
80 * Get the SpectrumModel used by the helper.
81 *
82 * @return the helpers SpectrumModel
83 */
85
86 private:
87 /**
88 * The helpers SpectrumModel.
89 */
91
92 /**
93 * The set of accumulated signals.
94 */
95 std::set<Ptr<const SpectrumValue>> m_signals;
96
97 /**
98 * The precomputed sum of all accumulated signals.
99 */
101
102 /**
103 * Mark m_signal as dirty, whenever a signal is added or removed. m_signal has
104 * to be recomputed before next use.
105 */
106 mutable bool m_dirty;
107};
108
109} // namespace lrwpan
110} // namespace ns3
111
112#endif /* LR_WPAN_INTERFERENCE_HELPER_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
Set of frequency values implementing the domain of the functions in the Function Space defined by Spe...
Set of values corresponding to a given SpectrumModel.
Ptr< SpectrumValue > GetSignalPsd() const
Get the sum of all accumulated signals.
LrWpanInterferenceHelper & operator=(const LrWpanInterferenceHelper &)=delete
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.
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.
LrWpanInterferenceHelper(Ptr< const SpectrumModel > spectrumModel)
Create a new interference helper for the given SpectrumModel.
Ptr< const SpectrumModel > m_spectrumModel
The helpers SpectrumModel.
bool RemoveSignal(Ptr< const SpectrumValue > signal)
Remove the given signal to the set of accumulated signals.
LrWpanInterferenceHelper(const LrWpanInterferenceHelper &)=delete
Every class exported by the ns3 library is enclosed in the ns3 namespace.