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;
66  SSRecord* GetSsRecord() const;
71  void SetSsRecord(SSRecord* ssRecord);
86  ServiceFlow* GetServiceFlow() const;
91  void SetServiceFlow(ServiceFlow* serviceFlow);
92 
97  ReqType GetType() const;
102  void SetType(ReqType type);
103 
108  Time GetReleaseTime() const;
113  void SetReleaseTime(Time releaseTime);
114 
119  Time GetPeriod() const;
124  void SetPeriod(Time period);
125 
130  Time GetDeadline() const;
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 
190  Ptr<UlJob> GetUlJob() const;
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  return leftBacklogged <= rightBacklogged;
224  }
225  else
226  {
227  return false;
228  }
229  }
230 };
231 
234 {
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