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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
*/
7
8
#include "
spectrum-transmit-filter.h
"
9
10
#include "
spectrum-phy.h
"
11
#include "
spectrum-signal-parameters.h
"
12
13
#include <ns3/log.h>
14
15
namespace
ns3
16
{
17
18
NS_LOG_COMPONENT_DEFINE
(
"SpectrumTransmitFilter"
);
19
20
NS_OBJECT_ENSURE_REGISTERED
(SpectrumTransmitFilter);
21
22
TypeId
23
SpectrumTransmitFilter::GetTypeId
()
24
{
25
static
TypeId
tid =
26
TypeId
(
"ns3::SpectrumTransmitFilter"
).
SetParent
<
Object
>().SetGroupName(
"Spectrum"
);
27
return
tid;
28
}
29
30
SpectrumTransmitFilter::SpectrumTransmitFilter
()
31
{
32
NS_LOG_FUNCTION
(
this
);
33
}
34
35
void
36
SpectrumTransmitFilter::DoDispose
()
37
{
38
NS_LOG_FUNCTION
(
this
);
39
if
(
m_next
)
40
{
41
m_next
->Dispose();
42
}
43
m_next
=
nullptr
;
44
Object::DoDispose
();
45
}
46
47
void
48
SpectrumTransmitFilter::SetNext
(
Ptr<SpectrumTransmitFilter>
next)
49
{
50
m_next
= next;
51
}
52
53
Ptr<const SpectrumTransmitFilter>
54
SpectrumTransmitFilter::GetNext
()
const
55
{
56
return
m_next
;
57
}
58
59
bool
60
SpectrumTransmitFilter::Filter
(
Ptr<const SpectrumSignalParameters>
params,
61
Ptr<const SpectrumPhy>
receiverPhy)
62
{
63
NS_LOG_FUNCTION
(
this
<< params << receiverPhy);
64
bool
result =
DoFilter
(params, receiverPhy);
65
if
(result)
66
{
67
return
true
;
68
}
69
else
if
(
m_next
)
70
{
71
return
m_next
->Filter(params, receiverPhy);
72
}
73
else
74
{
75
return
false
;
76
}
77
}
78
79
int64_t
80
SpectrumTransmitFilter::AssignStreams
(int64_t stream)
81
{
82
auto
currentStream = stream;
83
currentStream +=
DoAssignStreams
(stream);
84
if
(
m_next
)
85
{
86
currentStream +=
m_next
->AssignStreams(currentStream);
87
}
88
return
(currentStream - stream);
89
}
90
91
}
// namespace ns3
ns3::Object
A base class which provides memory management and object aggregation.
Definition
object.h:78
ns3::Object::DoDispose
virtual void DoDispose()
Destructor implementation.
Definition
object.cc:433
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
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:60
ns3::SpectrumTransmitFilter::AssignStreams
int64_t AssignStreams(int64_t stream)
If this loss model uses objects of type RandomVariableStream, set the stream numbers to the integers ...
Definition
spectrum-transmit-filter.cc:80
ns3::SpectrumTransmitFilter::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
spectrum-transmit-filter.cc:23
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:54
ns3::SpectrumTransmitFilter::DoAssignStreams
virtual int64_t DoAssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model.
ns3::SpectrumTransmitFilter::SpectrumTransmitFilter
SpectrumTransmitFilter()
Definition
spectrum-transmit-filter.cc:30
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:48
ns3::SpectrumTransmitFilter::m_next
Ptr< SpectrumTransmitFilter > m_next
SpectrumTransmitFilter chained to this one.
Definition
spectrum-transmit-filter.h:105
ns3::SpectrumTransmitFilter::DoDispose
void DoDispose() override
Destructor implementation.
Definition
spectrum-transmit-filter.cc:36
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
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:229
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
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 Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0