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