A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ul-job.h
Go to the documentation of this file.
1/*
2 * Copyright (c)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Juliana Freitag Borin, Flavio Kubota and Nelson L.
7 * S. da Fonseca - wimaxgroup@lrc.ic.unicamp.br
8 */
9
10#ifndef UL_JOB_H
11#define UL_JOB_H
12
13#include "service-flow-record.h"
14#include "service-flow.h"
15#include "ss-record.h"
16
17#include "ns3/header.h"
18
19#include <stdint.h>
20
21namespace ns3
22{
23
24class SSRecord;
25class ServiceFlow;
26
27/// Request type enumeration
33
34/**
35 * \ingroup wimax
36 * \brief this class implements a structure to compute the priority of service flows
37 */
38class UlJob : public Object
39{
40 public:
41 /// Job priority enumeration
48
49 UlJob();
50 ~UlJob() override;
51 /**
52 * Get SS record
53 * \returns the SS record
54 */
55 SSRecord* GetSsRecord() const;
56 /**
57 * Set SS record
58 * \param ssRecord the SS record
59 */
60 void SetSsRecord(SSRecord* ssRecord);
61 /**
62 * Get scheduling type
63 * \returns the scheduling type
64 */
66 /**
67 * Set scheduling type
68 * \param schedulingType the scheduling type
69 */
71 /**
72 * Get service flow
73 * \returns the service flow
74 */
76 /**
77 * Set service flow
78 * \param serviceFlow
79 */
80 void SetServiceFlow(ServiceFlow* serviceFlow);
81
82 /**
83 * Get type
84 * \returns the request type
85 */
86 ReqType GetType() const;
87 /**
88 * Set type
89 * \param type the type
90 */
91 void SetType(ReqType type);
92
93 /**
94 * Get release time
95 * \returns the release time
96 */
97 Time GetReleaseTime() const;
98 /**
99 * Set release time
100 * \param releaseTime the release time
101 */
102 void SetReleaseTime(Time releaseTime);
103
104 /**
105 * Get period
106 * \returns the period time
107 */
108 Time GetPeriod() const;
109 /**
110 * Set period
111 * \param period the period
112 */
113 void SetPeriod(Time period);
114
115 /**
116 * Get deadline
117 * \returns the deadline time
118 */
119 Time GetDeadline() const;
120 /**
121 * Set deadline
122 * \param deadline the dead line
123 */
124 void SetDeadline(Time deadline);
125
126 /**
127 * Get size
128 * \returns the size
129 */
130 uint32_t GetSize() const;
131 /**
132 * Set size
133 * \param size the size
134 */
135 void SetSize(uint32_t size);
136
137 private:
138 /// equality operator
139 friend bool operator==(const UlJob& a, const UlJob& b);
140
141 Time m_releaseTime; ///< The time after which the job can be processed
142 Time m_period; ///< For periodic jobs
143 Time m_deadline; ///< Request should be satisfied by this time
144 uint32_t m_size; ///< Number of minislots requested
145 ServiceFlow::SchedulingType m_schedulingType; ///< Scheduling type of flow
146
147 SSRecord* m_ssRecord; ///< Pointer to SSRecord
148
149 ReqType m_type; ///< Type of request, DATA or Unicast req slots
150 ServiceFlow* m_serviceFlow; ///< service flow
151};
152
153/**
154 * PriorityUlJob class
155 */
156class PriorityUlJob : public Object
157{
158 /**
159 * \brief this class implements an auxiliary struct to compute the priority of the rtPS and
160 * nrtPS in the intermediate queue
161 */
162 public:
164 /**
165 * Get priority
166 * \returns the priority
167 */
168 int GetPriority() const;
169 /**
170 * Set priority
171 * \param priority the priority
172 */
173 void SetPriority(int priority);
174
175 /**
176 * Get UL job function
177 * \returns the UL job
178 */
179 Ptr<UlJob> GetUlJob() const;
180 /**
181 * Set UL job
182 * \param job the UL job
183 */
184 void SetUlJob(Ptr<UlJob> job);
185
186 private:
187 int m_priority; ///< the priority
188 Ptr<UlJob> m_job; ///< the job
189};
190
191/// SortProcess structure
193{
194 /**
195 * \brief comparison operator
196 * \param left left side input
197 * \param right right side input
198 * \returns true if left is logically less then right for given comparison
199 */
200 bool operator()(PriorityUlJob& left, PriorityUlJob& right) const
201 {
202 if (left.GetPriority() < right.GetPriority())
203 {
204 return true;
205 }
206 else if (left.GetPriority() == right.GetPriority())
207 {
208 int32_t leftBacklogged =
209 left.GetUlJob()->GetServiceFlow()->GetRecord()->GetBacklogged();
210 int32_t rightBacklogged =
211 left.GetUlJob()->GetServiceFlow()->GetRecord()->GetBacklogged();
212 return leftBacklogged <= rightBacklogged;
213 }
214 else
215 {
216 return false;
217 }
218 }
219};
220
221/// SortProcessPtr structure
223{
224 /**
225 * \brief comparison operator
226 * \param left left side input
227 * \param right right side input
228 * \returns true if left is logically less then right for given comparison
229 */
231 {
232 if (left->GetPriority() < right->GetPriority())
233 {
234 return true;
235 }
236 else if (left->GetPriority() == right->GetPriority())
237 {
238 int32_t leftBacklogged =
239 left->GetUlJob()->GetServiceFlow()->GetRecord()->GetBacklogged();
240 int32_t rightBacklogged =
241 left->GetUlJob()->GetServiceFlow()->GetRecord()->GetBacklogged();
242 return leftBacklogged <= rightBacklogged;
243 }
244 else
245 {
246 return false;
247 }
248 }
249};
250
251} // namespace ns3
252
253#endif /* UL_JOB_H */
A base class which provides memory management and object aggregation.
Definition object.h:78
PriorityUlJob class.
Definition ul-job.h:157
void SetUlJob(Ptr< UlJob > job)
Set UL job.
Definition ul-job.cc:158
Ptr< UlJob > GetUlJob() const
Get UL job function.
Definition ul-job.cc:152
void SetPriority(int priority)
Set priority.
Definition ul-job.cc:146
int GetPriority() const
Get priority.
Definition ul-job.cc:140
PriorityUlJob()
this class implements an auxiliary struct to compute the priority of the rtPS and nrtPS in the interm...
Definition ul-job.cc:135
Ptr< UlJob > m_job
the job
Definition ul-job.h:188
int m_priority
the priority
Definition ul-job.h:187
Smart pointer class similar to boost::intrusive_ptr.
This class is used by the base station to store some information related to subscriber station in the...
Definition ss-record.h:35
This class implements service flows as described by the IEEE-802.16 standard.
SchedulingType
section 11.13.11 Service flow scheduling type, page 701
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
this class implements a structure to compute the priority of service flows
Definition ul-job.h:39
void SetSize(uint32_t size)
Set size.
Definition ul-job.cc:118
SSRecord * GetSsRecord() const
Get SS record.
Definition ul-job.cc:28
void SetServiceFlow(ServiceFlow *serviceFlow)
Set service flow.
Definition ul-job.cc:70
void SetSsRecord(SSRecord *ssRecord)
Set SS record.
Definition ul-job.cc:34
ServiceFlow * m_serviceFlow
service flow
Definition ul-job.h:150
ServiceFlow::SchedulingType GetSchedulingType() const
Get scheduling type.
Definition ul-job.cc:40
ReqType m_type
Type of request, DATA or Unicast req slots.
Definition ul-job.h:149
friend bool operator==(const UlJob &a, const UlJob &b)
equality operator
Definition ul-job.cc:130
JobPriority
Job priority enumeration.
Definition ul-job.h:43
@ INTERMEDIATE
Definition ul-job.h:45
SSRecord * m_ssRecord
Pointer to SSRecord.
Definition ul-job.h:147
uint32_t m_size
Number of minislots requested.
Definition ul-job.h:144
void SetReleaseTime(Time releaseTime)
Set release time.
Definition ul-job.cc:82
Time GetReleaseTime() const
Get release time.
Definition ul-job.cc:76
Time m_deadline
Request should be satisfied by this time.
Definition ul-job.h:143
void SetSchedulingType(ServiceFlow::SchedulingType schedulingType)
Set scheduling type.
Definition ul-job.cc:46
uint32_t GetSize() const
Get size.
Definition ul-job.cc:112
void SetType(ReqType type)
Set type.
Definition ul-job.cc:58
void SetPeriod(Time period)
Set period.
Definition ul-job.cc:94
Time m_releaseTime
The time after which the job can be processed.
Definition ul-job.h:141
Time GetDeadline() const
Get deadline.
Definition ul-job.cc:100
Time GetPeriod() const
Get period.
Definition ul-job.cc:88
ServiceFlow * GetServiceFlow() const
Get service flow.
Definition ul-job.cc:64
ReqType GetType() const
Get type.
Definition ul-job.cc:52
ServiceFlow::SchedulingType m_schedulingType
Scheduling type of flow.
Definition ul-job.h:145
~UlJob() override
Definition ul-job.cc:23
Time m_period
For periodic jobs.
Definition ul-job.h:142
void SetDeadline(Time deadline)
Set deadline.
Definition ul-job.cc:106
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ReqType
Request type enumeration.
Definition ul-job.h:29
@ UNICAST_POLLING
Definition ul-job.h:31
@ DATA
Definition ul-job.h:30
SortProcess structure.
Definition ul-job.h:193
bool operator()(PriorityUlJob &left, PriorityUlJob &right) const
comparison operator
Definition ul-job.h:200
SortProcessPtr structure.
Definition ul-job.h:223
bool operator()(Ptr< PriorityUlJob > &left, Ptr< PriorityUlJob > &right) const
comparison operator
Definition ul-job.h:230