svf-lib 1.0.1236 → 1.0.1237

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,7 +58,7 @@ class List
58
58
  class ListNode
59
59
  {
60
60
  public:
61
- ListNode(Data d)
61
+ ListNode(const Data& d)
62
62
  {
63
63
  data = d;
64
64
  next = nullptr;
@@ -87,12 +87,12 @@ public:
87
87
  return (head == nullptr);
88
88
  }
89
89
 
90
- inline bool find(Data data) const
90
+ inline bool find(const Data& data) const
91
91
  {
92
92
  return (nodeSet.find(data) == nodeSet.end() ? false : true);
93
93
  }
94
94
 
95
- void push(Data data)
95
+ void push(const Data& data)
96
96
  {
97
97
  if (nodeSet.find(data) == nodeSet.end())
98
98
  {
@@ -136,7 +136,6 @@ private:
136
136
  template<class Data>
137
137
  class FIFOWorkList
138
138
  {
139
- typedef Set<Data> DataSet;
140
139
  typedef std::deque<Data> DataDeque;
141
140
  public:
142
141
  FIFOWorkList() {}
@@ -148,35 +147,46 @@ public:
148
147
  return data_list.empty();
149
148
  }
150
149
 
151
- inline bool find(Data data) const
150
+ inline bool find(const Data& data) const
152
151
  {
153
- return (data_set.find(data) == data_set.end() ? false : true);
152
+ return std::find(data_list.begin(), data_list.end(), data) != data_list.end();
154
153
  }
155
154
 
156
155
  /**
157
156
  * Push a data into the work list.
158
157
  */
159
- inline bool push(Data data)
158
+ inline bool push(const Data& data)
160
159
  {
161
- if (data_set.find(data) == data_set.end())
162
- {
163
- data_list.push_back(data);
164
- data_set.insert(data);
165
- return true;
166
- }
167
- else
168
- return false;
160
+ data_list.push_back(data);
161
+ return true;
169
162
  }
170
163
 
171
164
  /**
172
165
  * Pop a data from the END of work list.
173
166
  */
174
167
  inline Data pop()
168
+ {
169
+ Data data = front();
170
+ removeFront();
171
+ return data;
172
+ }
173
+
174
+ /**
175
+ * Remove a data from the END of work list, no return value
176
+ */
177
+ inline void removeFront()
175
178
  {
176
179
  assert(!empty() && "work list is empty");
177
- Data data = data_list.front();
178
180
  data_list.pop_front();
179
- data_set.erase(data);
181
+ }
182
+
183
+ /**
184
+ * Get reference of top data from the END of work list.
185
+ */
186
+ inline Data& front()
187
+ {
188
+ assert(!empty() && "work list is empty");
189
+ Data& data = data_list.front();
180
190
  return data;
181
191
  }
182
192
 
@@ -186,11 +196,9 @@ public:
186
196
  inline void clear()
187
197
  {
188
198
  data_list.clear();
189
- data_set.clear();
190
199
  }
191
200
 
192
201
  private:
193
- DataSet data_set; ///< store all data in the work list.
194
202
  DataDeque data_list; ///< work list using std::vector.
195
203
  };
196
204
 
@@ -202,7 +210,6 @@ private:
202
210
  template<class Data>
203
211
  class FILOWorkList
204
212
  {
205
- typedef Set<Data> DataSet;
206
213
  typedef std::vector<Data> DataVector;
207
214
  public:
208
215
  FILOWorkList() {}
@@ -214,35 +221,46 @@ public:
214
221
  return data_list.empty();
215
222
  }
216
223
 
217
- inline bool find(Data data) const
224
+ inline bool find(const Data& data) const
218
225
  {
219
- return (data_set.find(data) == data_set.end() ? false : true);
226
+ return std::find(data_list.begin(), data_list.end(), data) != data_list.end();
220
227
  }
221
228
 
222
229
  /**
223
230
  * Push a data into the work list.
224
231
  */
225
- inline bool push(Data data)
232
+ inline bool push(const Data& data)
226
233
  {
227
- if (data_set.find(data) == data_set.end())
228
- {
229
- data_list.push_back(data);
230
- data_set.insert(data);
231
- return true;
232
- }
233
- else
234
- return false;
234
+ data_list.push_back(data);
235
+ return true;
235
236
  }
236
237
 
237
238
  /**
238
239
  * Pop a data from the END of work list.
239
240
  */
240
241
  inline Data pop()
242
+ {
243
+ Data data = back();
244
+ removeBack();
245
+ return data;
246
+ }
247
+
248
+ /**
249
+ * Remove a data from the END of work list, no return value
250
+ */
251
+ inline void removeBack()
241
252
  {
242
253
  assert(!empty() && "work list is empty");
243
- Data data = data_list.back();
244
254
  data_list.pop_back();
245
- data_set.erase(data);
255
+ }
256
+
257
+ /**
258
+ * Get reference of top data from the END of work list.
259
+ */
260
+ inline Data& back()
261
+ {
262
+ assert(!empty() && "work list is empty");
263
+ Data& data = data_list.back();
246
264
  return data;
247
265
  }
248
266
 
@@ -252,11 +270,9 @@ public:
252
270
  inline void clear()
253
271
  {
254
272
  data_list.clear();
255
- data_set.clear();
256
273
  }
257
274
 
258
275
  private:
259
- DataSet data_set; ///< store all data in the work list.
260
276
  DataVector data_list; ///< work list using std::vector.
261
277
  };
262
278
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1236",
3
+ "version": "1.0.1237",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {