queue.hh (11375:f98df9231cdd) queue.hh (11377:a06a4debe272)
1/*
2 * Copyright (c) 2012-2013, 2015-2016 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 55 unchanged lines hidden (view full) ---

64class Queue : public Drainable
65{
66 protected:
67 /** Local label (for functional print requests) */
68 const std::string label;
69
70 /**
71 * The total number of entries in this queue. This number is set
1/*
2 * Copyright (c) 2012-2013, 2015-2016 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 55 unchanged lines hidden (view full) ---

64class Queue : public Drainable
65{
66 protected:
67 /** Local label (for functional print requests) */
68 const std::string label;
69
70 /**
71 * The total number of entries in this queue. This number is set
72 * as the number of entries requested plus (numReserve - 1). This
72 * as the number of entries requested plus any reserve. This
73 * allows for the same number of effective entries while still
74 * maintaining an overflow reserve.
75 */
76 const int numEntries;
77
78 /**
79 * The number of entries to hold as a temporary overflow
80 * space. This is used to allow temporary overflow of the number

--- 34 unchanged lines hidden (view full) ---

115 int allocated;
116
117 public:
118
119 /**
120 * Create a queue with a given number of entries.
121 *
122 * @param num_entries The number of entries in this queue.
73 * allows for the same number of effective entries while still
74 * maintaining an overflow reserve.
75 */
76 const int numEntries;
77
78 /**
79 * The number of entries to hold as a temporary overflow
80 * space. This is used to allow temporary overflow of the number

--- 34 unchanged lines hidden (view full) ---

115 int allocated;
116
117 public:
118
119 /**
120 * Create a queue with a given number of entries.
121 *
122 * @param num_entries The number of entries in this queue.
123 * @param num_overflow The extra overflow entries needed.
123 * @param reserve The extra overflow entries needed.
124 */
125 Queue(const std::string &_label, int num_entries, int reserve) :
124 */
125 Queue(const std::string &_label, int num_entries, int reserve) :
126 label(_label), numEntries(num_entries + reserve - 1),
126 label(_label), numEntries(num_entries + reserve),
127 numReserve(reserve), entries(numEntries), _numInService(0),
128 allocated(0)
129 {
130 for (int i = 0; i < numEntries; ++i) {
131 freeList.push_back(&entries[i]);
132 }
133 }
134
135 bool isEmpty() const
136 {
137 return allocated == 0;
138 }
139
140 bool isFull() const
141 {
127 numReserve(reserve), entries(numEntries), _numInService(0),
128 allocated(0)
129 {
130 for (int i = 0; i < numEntries; ++i) {
131 freeList.push_back(&entries[i]);
132 }
133 }
134
135 bool isEmpty() const
136 {
137 return allocated == 0;
138 }
139
140 bool isFull() const
141 {
142 return (allocated > numEntries - numReserve);
142 return (allocated >= numEntries - numReserve);
143 }
144
145 int numInService() const
146 {
147 return _numInService;
148 }
149
150 /**

--- 101 unchanged lines hidden ---
143 }
144
145 int numInService() const
146 {
147 return _numInService;
148 }
149
150 /**

--- 101 unchanged lines hidden ---