A Discrete-Event Network Simulator
API
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 
32 namespace ns3
33 {
34 
35 class SSRecord;
36 class ServiceFlow;
37 
39 enum ReqType
40 {
43 };
44 
49 class UlJob : public Object
50 {
51  public:
54  {
55  LOW,
57  HIGH
58  };
59 
60  UlJob();
61  ~UlJob() override;
71  void SetSsRecord(SSRecord* ssRecord);
91  void SetServiceFlow(ServiceFlow* serviceFlow);
92 
97  ReqType GetType();
102  void SetType(ReqType type);
103 
113  void SetReleaseTime(Time releaseTime);
114 
119  Time GetPeriod();
124  void SetPeriod(Time period);
125 
130  Time GetDeadline();
135  void SetDeadline(Time deadline);
136 
141  uint32_t GetSize() const;
146  void SetSize(uint32_t size);
147 
148  private:
150  friend bool operator==(const UlJob& a, const UlJob& b);
151 
155  uint32_t m_size;
157 
159 
162 };
163 
167 class PriorityUlJob : public Object
168 {
173  public:
174  PriorityUlJob();
179  int GetPriority() const;
184  void SetPriority(int priority);
185 
195  void SetUlJob(Ptr<UlJob> job);
196 
197  private:
200 };
201 
204 {
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  if (leftBacklogged <= rightBacklogged)
224  {
225  return true;
226  }
227  else
228  {
229  return false;
230  }
231  }
232  else
233  {
234  return false;
235  }
236  }
237 };
238 
241 {
249  {
250  if (left->GetPriority() < right->GetPriority())
251  {
252  return true;
253  }
254  else if (left->GetPriority() == right->GetPriority())
255  {
256  int32_t leftBacklogged =
257  left->GetUlJob()->GetServiceFlow()->GetRecord()->GetBacklogged();
258  int32_t rightBacklogged =
259  left->GetUlJob()->GetServiceFlow()->GetRecord()->GetBacklogged();
260  if (leftBacklogged <= rightBacklogged)
261  {
262  return true;
263  }
264  else
265  {
266  return false;
267  }
268  }
269  else
270  {
271  return false;
272  }
273  }
274 };
275 
276 } // namespace ns3
277 
278 #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:176
Ptr< UlJob > GetUlJob()
Get UL job function.
Definition: ul-job.cc:170
void SetPriority(int priority)
Set priority.
Definition: ul-job.cc:164
int GetPriority() const
Get priority.
Definition: ul-job.cc:158
PriorityUlJob()
this class implements an auxiliary struct to compute the priority of the rtPS and nrtPS in the interm...
Definition: ul-job.cc:153
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:78
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
ServiceFlow * GetServiceFlow()
Get service flow.
Definition: ul-job.cc:75
Time GetPeriod()
Get period.
Definition: ul-job.cc:99
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
Time GetDeadline()
Get deadline.
Definition: ul-job.cc:111
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 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
ReqType GetType()
Get type.
Definition: ul-job.cc:63
enum ServiceFlow::SchedulingType m_schedulingType
Scheduling type of flow.
Definition: ul-job.h:156
enum ServiceFlow::SchedulingType GetSchedulingType()
Get scheduling type.
Definition: ul-job.cc:51
~UlJob() override
Definition: ul-job.cc:34
Time m_period
For periodic jobs.
Definition: ul-job.h:153
Time GetReleaseTime()
Get release time.
Definition: ul-job.cc:87
void SetDeadline(Time deadline)
Set deadline.
Definition: ul-job.cc:117
SSRecord * GetSsRecord()
Get SS record.
Definition: ul-job.cc:39
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:241
bool operator()(Ptr< PriorityUlJob > &left, Ptr< PriorityUlJob > &right) const
comparison operator
Definition: ul-job.h:248