5G-LENA nr-v3.1-69-g2dd513a7
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
sfnsf.h
1// Copyright (c) 2019 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#ifndef SFNSF_H
6#define SFNSF_H
7
8#include <ns3/simple-ref-count.h>
9
10namespace ns3
11{
12
31class SfnSf : public SimpleRefCount<SfnSf>
32{
33 public:
37 SfnSf() = default;
38
47 SfnSf(uint32_t frameNum, uint8_t sfNum, uint8_t slotNum, uint8_t numerology);
48
54 uint64_t GetEncoding() const;
61 uint64_t GetEncodingWithSymStartRnti(uint8_t symStart, uint16_t rnti) const;
62
69 void FromEncoding(uint64_t sfn);
70
77 static uint64_t Encode(const SfnSf& p);
83 static SfnSf Decode(uint64_t sfn);
84
88 static uint32_t GetSubframesPerFrame();
89
94 uint32_t GetSlotPerSubframe() const;
95
102 uint64_t Normalize() const;
103
108 void Add(uint32_t slotN);
109
115 SfnSf GetFutureSfnSf(uint32_t slotN);
116
125 bool operator<(const SfnSf& rhs) const;
126
133 bool operator==(const SfnSf& o) const;
134
139 uint32_t GetFrame() const;
144 uint8_t GetSubframe() const;
149 uint8_t GetSlot() const;
158 uint8_t GetNumerology() const;
159
160 private:
161 uint32_t m_frameNum{0};
162 uint8_t m_subframeNum{0};
163 uint8_t m_slotNum{0};
164 uint8_t m_numerology{255};
165};
166
167} // namespace ns3
168#endif // SFNSF_H
The SfnSf class.
Definition sfnsf.h:32
static SfnSf Decode(uint64_t sfn)
Decode the parameter and return a SfnSf.
Definition sfnsf.cc:91
uint8_t GetNumerology() const
GetNumerology.
Definition sfnsf.cc:170
uint8_t GetSubframe() const
GetSubframe.
Definition sfnsf.cc:158
uint64_t Normalize() const
Normalize the SfnSf in slot number.
Definition sfnsf.cc:99
uint32_t GetSlotPerSubframe() const
Get SlotPerSubframe.
Definition sfnsf.cc:79
SfnSf GetFutureSfnSf(uint32_t slotN)
Get a Future SfnSf.
Definition sfnsf.cc:109
static uint64_t Encode(const SfnSf &p)
Encode the parameter in a uint64_t.
Definition sfnsf.cc:85
uint64_t GetEncoding() const
Get encoding for this SfnSf.
Definition sfnsf.cc:24
void Add(uint32_t slotN)
Add to this SfnSf a number of slot indicated by the first parameter.
Definition sfnsf.cc:117
uint64_t GetEncodingWithSymStartRnti(uint8_t symStart, uint16_t rnti) const
Get an encoding of frame & slot number, plus starting OFDM symbol and RNTI.
Definition sfnsf.cc:42
bool operator<(const SfnSf &rhs) const
operator < (less than)
Definition sfnsf.cc:128
uint8_t GetSlot() const
GetSlot.
Definition sfnsf.cc:164
SfnSf()=default
constructor
bool operator==(const SfnSf &o) const
operator ==, compares frame, subframe, and slot
Definition sfnsf.cc:144
void FromEncoding(uint64_t sfn)
Fill the private fields with the value extracted from the parameter.
Definition sfnsf.cc:63
static uint32_t GetSubframesPerFrame()
Definition sfnsf.cc:73
uint32_t GetFrame() const
GetFrame.
Definition sfnsf.cc:152