5G-LENA nr-v3.3-159-ga6832aa7
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
bandwidth-part-gnb.cc
1// Copyright (c) 2017 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#include "bandwidth-part-gnb.h"
6
7#include "nr-gnb-mac.h"
8#include "nr-gnb-phy.h"
9
10#include "ns3/abort.h"
11#include "ns3/boolean.h"
12#include "ns3/log.h"
13#include "ns3/pointer.h"
14
15namespace ns3
16{
17
18NS_LOG_COMPONENT_DEFINE("BandwidthPartGnb");
19NS_OBJECT_ENSURE_REGISTERED(BandwidthPartGnb);
20
21TypeId
23{
24 static TypeId tid = TypeId("ns3::BandwidthPartGnb")
25 .SetParent<NrComponentCarrier>()
26 .AddConstructor<BandwidthPartGnb>()
27 .AddAttribute("NrGnbPhy",
28 "The PHY associated to this GnbNetDevice",
29 PointerValue(),
30 MakePointerAccessor(&BandwidthPartGnb::m_phy),
31 MakePointerChecker<NrGnbPhy>())
32 .AddAttribute("NrGnbMac",
33 "The MAC associated to this GnbNetDevice",
34 PointerValue(),
35 MakePointerAccessor(&BandwidthPartGnb::m_mac),
36 MakePointerChecker<NrGnbMac>())
37 .AddAttribute("MacScheduler",
38 "The scheduler associated to this GnbNetDevice",
39 PointerValue(),
40 MakePointerAccessor(&BandwidthPartGnb::m_scheduler),
41 MakePointerChecker<NrMacScheduler>());
42 return tid;
43}
44
45BandwidthPartGnb::BandwidthPartGnb()
47{
48 NS_LOG_FUNCTION(this);
49 m_phy = nullptr;
50}
51
52BandwidthPartGnb::~BandwidthPartGnb()
53{
54 NS_LOG_FUNCTION(this);
55}
56
57void
59{
60 NS_LOG_FUNCTION(this);
61 m_phy->Dispose();
62 m_phy = nullptr;
63 m_mac->Dispose();
64 m_mac = nullptr;
65 m_scheduler = nullptr;
66 Object::DoDispose();
67}
68
69Ptr<NrGnbPhy>
71{
72 NS_LOG_FUNCTION(this);
73 return m_phy;
74}
75
76void
78{
79 NS_LOG_FUNCTION(this);
80 NS_ABORT_IF(m_phy != nullptr);
81 m_phy = s;
82}
83
84Ptr<NrGnbMac>
86{
87 NS_LOG_FUNCTION(this);
88 return m_mac;
89}
90
91void
93{
94 NS_LOG_FUNCTION(this);
95 m_mac = s;
96}
97
98Ptr<NrMacScheduler>
100{
101 NS_LOG_FUNCTION(this);
102 return m_scheduler;
103}
104
105void
107{
108 NS_LOG_FUNCTION(this);
109 m_scheduler = s;
110}
111
112void
114{
115 NS_LOG_FUNCTION(this);
116 NS_ASSERT(m_phy != nullptr);
117 if (primaryCarrier)
118 {
119 m_phy->SetPrimary();
120 }
121}
122
123uint16_t
125{
126 return m_cellId;
127}
128
129void
131{
132 NS_LOG_FUNCTION(this << cellId);
133 m_cellId = cellId;
134}
135
136} // namespace ns3
void DoDispose() override
DoDispose method inherited from Object.
void SetPhy(Ptr< NrGnbPhy > s)
Ptr< NrMacScheduler > GetScheduler()
void SetNrMacScheduler(Ptr< NrMacScheduler > s)
void SetCellId(uint16_t cellId)
void SetAsPrimary(bool primaryCarrier)
Set this bandwidth part as primary.
void SetMac(Ptr< NrGnbMac > s)
static TypeId GetTypeId()
Get the type ID.