A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
spectrum-transmit-filter.cc
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
19
#include "
spectrum-transmit-filter.h
"
20
21
#include "
spectrum-phy.h
"
22
#include "
spectrum-signal-parameters.h
"
23
24
#include <ns3/log.h>
25
26
namespace
ns3
27
{
28
29
NS_LOG_COMPONENT_DEFINE
(
"SpectrumTransmitFilter"
);
30
31
NS_OBJECT_ENSURE_REGISTERED
(SpectrumTransmitFilter);
32
33
TypeId
34
SpectrumTransmitFilter::GetTypeId
()
35
{
36
static
TypeId
tid =
37
TypeId
(
"ns3::SpectrumTransmitFilter"
).
SetParent
<
Object
>().SetGroupName(
"Spectrum"
);
38
return
tid;
39
}
40
41
SpectrumTransmitFilter::SpectrumTransmitFilter
()
42
{
43
NS_LOG_FUNCTION
(
this
);
44
}
45
46
void
47
SpectrumTransmitFilter::DoDispose
()
48
{
49
NS_LOG_FUNCTION
(
this
);
50
if
(
m_next
)
51
{
52
m_next
->Dispose();
53
}
54
m_next
=
nullptr
;
55
Object::DoDispose
();
56
}
57
58
void
59
SpectrumTransmitFilter::SetNext
(
Ptr<SpectrumTransmitFilter>
next)
60
{
61
m_next
= next;
62
}
63
64
Ptr<const SpectrumTransmitFilter>
65
SpectrumTransmitFilter::GetNext
()
const
66
{
67
return
m_next
;
68
}
69
70
bool
71
SpectrumTransmitFilter::Filter
(
Ptr<const SpectrumSignalParameters>
params,
72
Ptr<const SpectrumPhy>
receiverPhy)
73
{
74
NS_LOG_FUNCTION
(
this
<< params << receiverPhy);
75
bool
result =
DoFilter
(params, receiverPhy);
76
if
(result)
77
{
78
return
true
;
79
}
80
else
if
(
m_next
)
81
{
82
return
m_next
->Filter(params, receiverPhy);
83
}
84
else
85
{
86
return
false
;
87
}
88
}
89
90
}
// namespace ns3
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:89
ns3::Object::DoDispose
virtual void DoDispose()
Destructor implementation.
Definition:
object.cc:353
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:78
ns3::SpectrumTransmitFilter::Filter
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...
Definition:
spectrum-transmit-filter.cc:71
ns3::SpectrumTransmitFilter::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
spectrum-transmit-filter.cc:34
ns3::SpectrumTransmitFilter::DoFilter
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...
ns3::SpectrumTransmitFilter::GetNext
Ptr< const SpectrumTransmitFilter > GetNext() const
Return the next transmit filter in the chain.
Definition:
spectrum-transmit-filter.cc:65
ns3::SpectrumTransmitFilter::SpectrumTransmitFilter
SpectrumTransmitFilter()
Definition:
spectrum-transmit-filter.cc:41
ns3::SpectrumTransmitFilter::SetNext
void SetNext(Ptr< SpectrumTransmitFilter > next)
Add a transmit filter to be consulted next if this filter does not filter the signal.
Definition:
spectrum-transmit-filter.cc:59
ns3::SpectrumTransmitFilter::m_next
Ptr< SpectrumTransmitFilter > m_next
SpectrumTransmitFilter chained to this one.
Definition:
spectrum-transmit-filter.h:94
ns3::SpectrumTransmitFilter::DoDispose
void DoDispose() override
Destructor implementation.
Definition:
spectrum-transmit-filter.cc:47
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:936
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition:
log-macros-enabled.h:238
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:46
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
spectrum-phy.h
spectrum-signal-parameters.h
spectrum-transmit-filter.h
src
spectrum
model
spectrum-transmit-filter.cc
Generated on Sun Jul 2 2023 18:22:03 for ns-3 by
1.9.6