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 
36 enum ReqType
37 {
39 };
40 
45 class UlJob : public Object
46 {
47 public:
49  {
51  };
52  UlJob (void);
53  virtual ~UlJob (void);
54  SSRecord *
55  GetSsRecord (void);
56  void SetSsRecord (SSRecord* ssRecord);
58  void SetSchedulingType (ServiceFlow::SchedulingType schedulingType);
59  ServiceFlow *
60  GetServiceFlow (void);
61  void SetServiceFlow (ServiceFlow *serviceFlow);
62 
63  ReqType GetType (void);
64  void SetType (ReqType type);
65 
66  Time GetReleaseTime (void);
67  void SetReleaseTime (Time releaseTime);
68 
69  Time GetPeriod (void);
70  void SetPeriod (Time period);
71 
72  Time GetDeadline (void);
73  void SetDeadline (Time deadline);
74 
75  uint32_t GetSize (void);
76  void SetSize (uint32_t size);
77 
78 private:
79  friend bool operator == (const UlJob &a, const UlJob &b);
80 
81  Time m_releaseTime; /* The time after which the job can be processed*/
82  Time m_period; /* For periodic jobs*/
83  Time m_deadline; /* Request should be satisfied by this time */
84  uint32_t m_size; /* Number of minislots requested */
85  enum ServiceFlow::SchedulingType m_schedulingType; /* Scheduling type of flow */
86 
87  uint8_t m_flag; /* To delete or not..*/
88  uint8_t m_retryCount;
89  double m_ugsJitter; /* The jitter in the grant, valid only for UGS flows */
91  double m_last_jitterCalTime; /* Last time avg jitter was calculated */
92 
93  SSRecord *m_ssRecord; /* Pointer to SSRecord */
94 
95  ReqType m_type; /* Type of request, DATA or Unicast req slots */
97 
98 };
99 
100 
101 class PriorityUlJob : public Object
102 {
103 
108 public:
109  PriorityUlJob ();
110  int GetPriority (void);
111  void SetPriority (int priority);
112 
113  Ptr<UlJob>
114  GetUlJob (void);
115  void SetUlJob (Ptr<UlJob> job);
116 
117 private:
120 };
121 
122 struct SortProcess : public std::binary_function<PriorityUlJob*, PriorityUlJob*, bool>
123 {
124  bool operator () (PriorityUlJob& left, PriorityUlJob& right) const
125  { // return true if left is logically less then right for given comparison
126  if (left.GetPriority () < right.GetPriority ())
127  {
128  return true;
129  }
130  else if (left.GetPriority () == right.GetPriority ())
131  {
132  int32_t leftBacklogged = left.GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
133  int32_t rightBacklogged = left.GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
134  if (leftBacklogged <= rightBacklogged)
135  {
136  return true;
137  }
138  else
139  {
140  return false;
141  }
142  }
143  else
144  {
145  return false;
146  }
147  }
148 };
149 
150 struct SortProcessPtr: public std::binary_function< Ptr<PriorityUlJob>, Ptr<PriorityUlJob>, bool>
151 {
153  { //return true if left is logically less then right for given comparison
154  if (left->GetPriority () < right->GetPriority ())
155  {
156  return true;
157  }
158  else if (left->GetPriority () == right->GetPriority ())
159  {
160  int32_t leftBacklogged = left->GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
161  int32_t rightBacklogged = left->GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
162  if (leftBacklogged <= rightBacklogged)
163  {
164  return true;
165  }
166  else
167  {
168  return false;
169  }
170  }
171  else
172  {
173  return false;
174  }
175  }
176 };
177 
178 
179 } // namespace ns3
180 
181 #endif /* UL_JOB_H */
ReqType GetType(void)
Definition: ul-job.cc:59
bool operator()(Ptr< PriorityUlJob > &left, Ptr< PriorityUlJob > &right) const
Definition: ul-job.h:152
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)
Definition: ul-job.cc:95
ReqType
Definition: ul-job.h:36
void SetDeadline(Time deadline)
Definition: ul-job.cc:111
virtual ~UlJob(void)
Definition: ul-job.cc:31
Time m_releaseTime
Definition: ul-job.h:81
void SetSize(uint32_t size)
Definition: ul-job.cc:123
this class implements a structure to compute the priority of service flows
Definition: ul-job.h:45
UlJob(void)
Definition: ul-job.cc:27
Ptr< UlJob > GetUlJob(void)
Definition: ul-job.cc:157
SSRecord * m_ssRecord
Definition: ul-job.h:93
Time GetDeadline(void)
Definition: ul-job.cc:106
void SetReleaseTime(Time releaseTime)
Definition: ul-job.cc:89
void SetPeriod(Time period)
Definition: ul-job.cc:100
enum ServiceFlow::SchedulingType m_schedulingType
Definition: ul-job.h:85
Time GetReleaseTime(void)
Definition: ul-job.cc:83
friend bool operator==(const UlJob &a, const UlJob &b)
Definition: ul-job.cc:128
uint8_t m_retryCount
Definition: ul-job.h:88
Time m_deadline
Definition: ul-job.h:83
void SetSsRecord(SSRecord *ssRecord)
Definition: ul-job.cc:41
bool operator()(PriorityUlJob &left, PriorityUlJob &right) const
Definition: ul-job.h:124
void SetPriority(int priority)
Definition: ul-job.cc:151
SSRecord * GetSsRecord(void)
Definition: ul-job.cc:36
void SetServiceFlow(ServiceFlow *serviceFlow)
Definition: ul-job.cc:77
ReqType m_type
Definition: ul-job.h:95
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)
Definition: ul-job.cc:162
Time m_period
Definition: ul-job.h:82
uint32_t m_size
Definition: ul-job.h:84
int m_jitterSamples
Definition: ul-job.h:90
double m_ugsJitter
Definition: ul-job.h:89
JobPriority
Definition: ul-job.h:48
void SetSchedulingType(ServiceFlow::SchedulingType schedulingType)
Definition: ul-job.cc:53
ServiceFlow * GetServiceFlow(void)
Definition: ul-job.cc:71
PriorityUlJob()
this class implements an auxiliar struct to compute the priority of the rtPS and nrtPS in the interme...
Definition: ul-job.cc:140
ServiceFlow * m_serviceFlow
Definition: ul-job.h:96
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)
Definition: ul-job.cc:145
enum ServiceFlow::SchedulingType GetSchedulingType(void)
Definition: ul-job.cc:47
uint32_t GetSize(void)
Definition: ul-job.cc:117
uint8_t m_flag
Definition: ul-job.h:87
double m_last_jitterCalTime
Definition: ul-job.h:91
Ptr< UlJob > m_job
Definition: ul-job.h:119
void SetType(ReqType type)
Definition: ul-job.cc:65