A Discrete-Event Network Simulator
API
ul-job.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Juliana Freitag Borin, Flavio Kubota and Nelson L.
19  * S. da Fonseca - wimaxgroup@lrc.ic.unicamp.br
20  */
21 
22 #ifndef UL_JOB_H
23 #define UL_JOB_H
24 
25 #include <stdint.h>
26 #include "ns3/header.h"
27 #include "ss-record.h"
28 #include "service-flow.h"
29 #include "service-flow-record.h"
30 
31 namespace ns3 {
32 
33 class SSRecord;
34 class ServiceFlow;
35 
37 enum ReqType
38 {
41 };
42 
47 class UlJob : public Object
48 {
49 public:
52  {
53  LOW,
56  };
57  UlJob (void);
58  virtual ~UlJob (void);
63  SSRecord *
64  GetSsRecord (void);
69  void SetSsRecord (SSRecord* ssRecord);
79  void SetSchedulingType (ServiceFlow::SchedulingType schedulingType);
84  ServiceFlow *
85  GetServiceFlow (void);
90  void SetServiceFlow (ServiceFlow *serviceFlow);
91 
96  ReqType GetType (void);
101  void SetType (ReqType type);
102 
107  Time GetReleaseTime (void);
112  void SetReleaseTime (Time releaseTime);
113 
118  Time GetPeriod (void);
123  void SetPeriod (Time period);
124 
129  Time GetDeadline (void);
134  void SetDeadline (Time deadline);
135 
140  uint32_t GetSize (void);
145  void SetSize (uint32_t size);
146 
147 private:
149  friend bool operator == (const UlJob &a, const UlJob &b);
150 
154  uint32_t m_size;
156 
158 
161 
162 };
163 
167 class PriorityUlJob : public Object
168 {
169 
174 public:
175  PriorityUlJob ();
180  int GetPriority (void);
185  void SetPriority (int priority);
186 
191  Ptr<UlJob>
192  GetUlJob (void);
197  void SetUlJob (Ptr<UlJob> job);
198 
199 private:
202 };
203 
205 struct SortProcess : public std::binary_function<PriorityUlJob*, PriorityUlJob*, bool>
206 {
213  bool operator () (PriorityUlJob& left, PriorityUlJob& right) const
214  {
215  if (left.GetPriority () < right.GetPriority ())
216  {
217  return true;
218  }
219  else if (left.GetPriority () == right.GetPriority ())
220  {
221  int32_t leftBacklogged = left.GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
222  int32_t rightBacklogged = 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 
240 struct SortProcessPtr: public std::binary_function< Ptr<PriorityUlJob>, Ptr<PriorityUlJob>, bool>
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 = left->GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
257  int32_t rightBacklogged = left->GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
258  if (leftBacklogged <= rightBacklogged)
259  {
260  return true;
261  }
262  else
263  {
264  return false;
265  }
266  }
267  else
268  {
269  return false;
270  }
271  }
272 };
273 
274 
275 } // namespace ns3
276 
277 #endif /* UL_JOB_H */
ReqType GetType(void)
Get type.
Definition: ul-job.cc:59
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
Time GetPeriod(void)
Get period.
Definition: ul-job.cc:95
ReqType
Request type enumeration.
Definition: ul-job.h:37
void SetDeadline(Time deadline)
Set deadline.
Definition: ul-job.cc:111
virtual ~UlJob(void)
Definition: ul-job.cc:31
Time m_releaseTime
The time after which the job can be processed.
Definition: ul-job.h:151
void SetSize(uint32_t size)
Set size.
Definition: ul-job.cc:123
this class implements a structure to compute the priority of service flows
Definition: ul-job.h:47
UlJob(void)
Definition: ul-job.cc:27
Ptr< UlJob > GetUlJob(void)
Get UL job functiion.
Definition: ul-job.cc:163
SSRecord * m_ssRecord
Pointer to SSRecord.
Definition: ul-job.h:157
Time GetDeadline(void)
Get deadline.
Definition: ul-job.cc:106
void SetReleaseTime(Time releaseTime)
Set release time.
Definition: ul-job.cc:89
void SetPeriod(Time period)
Set period.
Definition: ul-job.cc:100
PriorityUlJob class.
Definition: ul-job.h:167
SortProcessPtr structure.
Definition: ul-job.h:240
enum ServiceFlow::SchedulingType m_schedulingType
Scheduling type of flow.
Definition: ul-job.h:155
SchedulingType
section 11.13.11 Service flow scheduling type, page 701
Definition: service-flow.h:58
Time GetReleaseTime(void)
Get release time.
Definition: ul-job.cc:83
friend bool operator==(const UlJob &a, const UlJob &b)
equality operator
Definition: ul-job.cc:134
Time m_deadline
Request should be satisfied by this time.
Definition: ul-job.h:153
void SetSsRecord(SSRecord *ssRecord)
Set SS record.
Definition: ul-job.cc:41
void SetPriority(int priority)
Set priority.
Definition: ul-job.cc:157
SortProcess structure.
Definition: ul-job.h:205
bool operator()(Ptr< PriorityUlJob > &left, Ptr< PriorityUlJob > &right) const
comparison operator
Definition: ul-job.h:248
SSRecord * GetSsRecord(void)
Get SS record.
Definition: ul-job.cc:36
void SetServiceFlow(ServiceFlow *serviceFlow)
Set service flow.
Definition: ul-job.cc:77
ReqType m_type
Type of request, DATA or Unicast req slots.
Definition: ul-job.h:159
Every class exported by the ns3 library is enclosed in the ns3 namespace.
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:39
void SetUlJob(Ptr< UlJob > job)
Set UL job.
Definition: ul-job.cc:168
bool operator()(PriorityUlJob &left, PriorityUlJob &right) const
comparison operator
Definition: ul-job.h:213
Time m_period
For periodic jobs.
Definition: ul-job.h:152
uint32_t m_size
Number of minislots requested.
Definition: ul-job.h:154
int m_priority
the priority
Definition: ul-job.h:200
void SetSchedulingType(ServiceFlow::SchedulingType schedulingType)
Set scheduling type.
Definition: ul-job.cc:53
ServiceFlow * GetServiceFlow(void)
Get service flow.
Definition: ul-job.cc:71
JobPriority
Job priority enumeration.
Definition: ul-job.h:51
PriorityUlJob()
this class implements an auxiliary struct to compute the priority of the rtPS and nrtPS in the interm...
Definition: ul-job.cc:146
ServiceFlow * m_serviceFlow
service flow
Definition: ul-job.h:160
This class is used by the base station to store some information related to subscriber station in the...
Definition: ss-record.h:43
A base class which provides memory management and object aggregation.
Definition: object.h:87
int GetPriority(void)
Get priority.
Definition: ul-job.cc:151
enum ServiceFlow::SchedulingType GetSchedulingType(void)
Get scheduling type.
Definition: ul-job.cc:47
uint32_t GetSize(void)
Get size.
Definition: ul-job.cc:117
Ptr< UlJob > m_job
the job
Definition: ul-job.h:201
void SetType(ReqType type)
Set type.
Definition: ul-job.cc:65