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 /**
44 * Add the given signal to the set of accumulated signals. Never add the same
45 * signal more than once. The SpectrumModels of the signal and the one used
46 * for instantiation of the helper have to be the same.
47 *
48 * \param signal the signal to be added
49 * \return false, if the signal was not added because the SpectrumModel of the
50 * signal does not match the one of the helper, true otherwise.
51 */
53
54 /**
55 * Remove the given signal to the set of accumulated signals.
56 *
57 * \param signal the signal to be removed
58 * \return false, if the signal was not removed (because it was not added
59 * before), true otherwise.
60 */
62
63 /**
64 * Remove all currently accumulated signals.
65 */
66 void ClearSignals();
67
68 /**
69 * Get the sum of all accumulated signals.
70 *
71 * \return the sum of the signals
72 */
74
75 /**
76 * Get the SpectrumModel used by the helper.
77 *
78 * \return the helpers SpectrumModel
79 */
81
82 private:
83 // Disable implicit copy constructors
84 /**
85 * \brief Copy constructor - defined and not implemented.
86 */
88 /**
89 * \brief Copy constructor - defined and not implemented.
90 * \returns
91 */
93 /**
94 * The helpers SpectrumModel.
95 */
97
98 /**
99 * The set of accumulated signals.
100 */
101 std::set<Ptr<const SpectrumValue>> m_signals;
102
103 /**
104 * The precomputed sum of all accumulated signals.
105 */
107
108 /**
109 * Mark m_signal as dirty, whenever a signal is added or removed. m_signal has
110 * to be recomputed before next use.
111 */
112 mutable bool m_dirty;
113};
114
115} // namespace lrwpan
116} // namespace ns3
117
118#endif /* LR_WPAN_INTERFERENCE_HELPER_H */
Smart pointer class similar to boost::intrusive_ptr.
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.
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.