5G-LENA nr-v3.0-32-g83aee33
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
sfnsf.h
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
3// Copyright (c) 2019 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4//
5// SPDX-License-Identifier: GPL-2.0-only
6
7#ifndef SFNSF_H
8#define SFNSF_H
9
10#include <ns3/simple-ref-count.h>
11
12namespace ns3
13{
14
33class SfnSf : public SimpleRefCount<SfnSf>
34{
35 public:
39 SfnSf() = default;
40
49 SfnSf(uint32_t frameNum, uint8_t sfNum, uint8_t slotNum, uint8_t numerology);
50
56 uint64_t GetEncoding() const;
63 uint64_t GetEncodingWithSymStartRnti(uint8_t symStart, uint16_t rnti) const;
64
71 void FromEncoding(uint64_t sfn);
72
79 static uint64_t Encode(const SfnSf& p);
85 static SfnSf Decode(uint64_t sfn);
86
90 static uint32_t GetSubframesPerFrame();
91
96 uint32_t GetSlotPerSubframe() const;
97
104 uint64_t Normalize() const;
105
110 void Add(uint32_t slotN);
111
117 SfnSf GetFutureSfnSf(uint32_t slotN);
118
127 bool operator<(const SfnSf& rhs) const;
128
135 bool operator==(const SfnSf& o) const;
136
141 uint32_t GetFrame() const;
146 uint8_t GetSubframe() const;
151 uint8_t GetSlot() const;
160 uint8_t GetNumerology() const;
161
162 private:
163 uint32_t m_frameNum{0};
164 uint8_t m_subframeNum{0};
165 uint8_t m_slotNum{0};
166 uint8_t m_numerology{255};
167};
168
169} // namespace ns3
170#endif // SFNSF_H
The SfnSf class.
Definition sfnsf.h:34
static SfnSf Decode(uint64_t sfn)
Decode the parameter and return a SfnSf.
Definition sfnsf.cc:93
uint8_t GetNumerology() const
GetNumerology.
Definition sfnsf.cc:172
uint8_t GetSubframe() const
GetSubframe.
Definition sfnsf.cc:160
uint64_t Normalize() const
Normalize the SfnSf in slot number.
Definition sfnsf.cc:101
uint32_t GetSlotPerSubframe() const
Get SlotPerSubframe.
Definition sfnsf.cc:81
SfnSf GetFutureSfnSf(uint32_t slotN)
Get a Future SfnSf.
Definition sfnsf.cc:111
static uint64_t Encode(const SfnSf &p)
Encode the parameter in a uint64_t.
Definition sfnsf.cc:87
uint64_t GetEncoding() const
Get encoding for this SfnSf.
Definition sfnsf.cc:26
void Add(uint32_t slotN)
Add to this SfnSf a number of slot indicated by the first parameter.
Definition sfnsf.cc:119
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:44
bool operator<(const SfnSf &rhs) const
operator < (less than)
Definition sfnsf.cc:130
uint8_t GetSlot() const
GetSlot.
Definition sfnsf.cc:166
SfnSf()=default
constructor
bool operator==(const SfnSf &o) const
operator ==, compares frame, subframe, and slot
Definition sfnsf.cc:146
void FromEncoding(uint64_t sfn)
Fill the private fields with the value extracted from the parameter.
Definition sfnsf.cc:65
static uint32_t GetSubframesPerFrame()
Definition sfnsf.cc:75
uint32_t GetFrame() const
GetFrame.
Definition sfnsf.cc:154