A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
spectrum-transmit-filter.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 University of Washington
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
18#ifndef SPECTRUM_TRANSMIT_FILTER_H
19#define SPECTRUM_TRANSMIT_FILTER_H
20
21#include <ns3/object.h>
22
23namespace ns3
24{
25
26struct SpectrumSignalParameters;
27class SpectrumPhy;
28
29/**
30 * \ingroup spectrum
31 *
32 * \brief spectrum-aware transmit filter object
33 *
34 * Interface for transmit filters that permit an early discard of signal
35 * reception before propagation loss models or receiving Phy objects have
36 * to process the signal, for performance optimization purposes.
37 *
38 */
40{
41 public:
43
44 /**
45 * \brief Get the type ID.
46 * \return the object TypeId
47 */
48 static TypeId GetTypeId();
49
50 /**
51 * Add a transmit filter to be consulted next if this filter does not
52 * filter the signal
53 *
54 * \param next next transmit filter to add to the chain
55 */
57
58 /**
59 * Return the next transmit filter in the chain
60 *
61 * \return next transmit filter in the chain
62 */
64
65 /**
66 * Evaluate whether the signal to be scheduled on the receiving Phy should
67 * instead be filtered (discarded) before being processed in this channel
68 * and on the receiving Phy.
69 *
70 * \param params the spectrum signal parameters.
71 * \param receiverPhy pointer to the receiving SpectrumPhy
72 *
73 * \return whether to perform filtering of the signal
74 */
76
77 /**
78 * If this loss model uses objects of type RandomVariableStream,
79 * set the stream numbers to the integers starting with the offset
80 * 'stream'. Return the number of streams (possibly zero) that
81 * have been assigned. If there are SpectrumTransmitFilters chained
82 * together, this method will also assign streams to the
83 * downstream models.
84 *
85 * \param stream the stream index offset start
86 * \return the number of stream indices assigned by this model
87 */
88 int64_t AssignStreams(int64_t stream);
89
90 protected:
91 void DoDispose() override;
92 /**
93 * Assign a fixed random variable stream number to the random variables used by this model.
94 *
95 * Subclasses must implement this; those not using random variables can return zero.
96 *
97 * \param stream first stream index to use
98 * \return the number of stream indices assigned by this model
99 */
100 virtual int64_t DoAssignStreams(int64_t stream) = 0;
101
102 private:
103 /**
104 * Evaluate whether the signal to be scheduled on the receiving Phy should
105 * instead be filtered (discarded) before being processed in this channel
106 * and on the receiving Phy.
107 *
108 * \param params the spectrum signal parameters.
109 * \param receiverPhy pointer to the receiving SpectrumPhy
110 *
111 * \return whether to perform filtering of the signal
112 */
114 Ptr<const SpectrumPhy> receiverPhy) = 0;
115
116 Ptr<SpectrumTransmitFilter> m_next{nullptr}; //!< SpectrumTransmitFilter chained to this one.
117};
118
119} // namespace ns3
120
121#endif /* SPECTRUM_TRANSMIT_FILTER_H */
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
spectrum-aware transmit filter object
bool Filter(Ptr< const SpectrumSignalParameters > params, Ptr< const SpectrumPhy > receiverPhy)
Evaluate whether the signal to be scheduled on the receiving Phy should instead be filtered (discarde...
int64_t AssignStreams(int64_t stream)
If this loss model uses objects of type RandomVariableStream, set the stream numbers to the integers ...
static TypeId GetTypeId()
Get the type ID.
virtual bool DoFilter(Ptr< const SpectrumSignalParameters > params, Ptr< const SpectrumPhy > receiverPhy)=0
Evaluate whether the signal to be scheduled on the receiving Phy should instead be filtered (discarde...
Ptr< const SpectrumTransmitFilter > GetNext() const
Return the next transmit filter in the chain.
virtual int64_t DoAssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model.
void SetNext(Ptr< SpectrumTransmitFilter > next)
Add a transmit filter to be consulted next if this filter does not filter the signal.
Ptr< SpectrumTransmitFilter > m_next
SpectrumTransmitFilter chained to this one.
void DoDispose() override
Destructor implementation.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.