A Discrete-Event Network Simulator
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
9
10#include "spectrum-phy.h"
12
13#include <ns3/log.h>
14
15namespace ns3
16{
17
18NS_LOG_COMPONENT_DEFINE("SpectrumTransmitFilter");
19
20NS_OBJECT_ENSURE_REGISTERED(SpectrumTransmitFilter);
21
22TypeId
24{
25 static TypeId tid =
26 TypeId("ns3::SpectrumTransmitFilter").SetParent<Object>().SetGroupName("Spectrum");
27 return tid;
28}
29
34
35void
37{
38 NS_LOG_FUNCTION(this);
39 if (m_next)
40 {
41 m_next->Dispose();
42 }
43 m_next = nullptr;
45}
46
47void
52
55{
56 return m_next;
57}
58
59bool
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
79int64_t
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
A base class which provides memory management and object aggregation.
Definition object.h:78
virtual void DoDispose()
Destructor implementation.
Definition object.cc:433
Smart pointer class similar to boost::intrusive_ptr.
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:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.