circlebuf.hh (11460:b49763e919c8) circlebuf.hh (12032:d218c2fe9440)
1/*
2 * Copyright (c) 2015 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

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

242 }
243
244 private:
245 CircleBuf<value_type> buf;
246};
247
248
249template <typename T>
1/*
2 * Copyright (c) 2015 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

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

242 }
243
244 private:
245 CircleBuf<value_type> buf;
246};
247
248
249template <typename T>
250static void
250void
251arrayParamOut(CheckpointOut &cp, const std::string &name,
252 const CircleBuf<T> &param)
253{
254 std::vector<T> temp(param.size());
255 param.peek(temp.begin(), temp.size());
256 arrayParamOut(cp, name, temp);
257}
258
259template <typename T>
251arrayParamOut(CheckpointOut &cp, const std::string &name,
252 const CircleBuf<T> &param)
253{
254 std::vector<T> temp(param.size());
255 param.peek(temp.begin(), temp.size());
256 arrayParamOut(cp, name, temp);
257}
258
259template <typename T>
260static void
260void
261arrayParamIn(CheckpointIn &cp, const std::string &name,
262 CircleBuf<T> &param)
263{
264 std::vector<T> temp;
265 arrayParamIn(cp, name, temp);
266
267 param.flush();
268 param.write(temp.cbegin(), temp.size());
269}
270
271template <typename T>
261arrayParamIn(CheckpointIn &cp, const std::string &name,
262 CircleBuf<T> &param)
263{
264 std::vector<T> temp;
265 arrayParamIn(cp, name, temp);
266
267 param.flush();
268 param.write(temp.cbegin(), temp.size());
269}
270
271template <typename T>
272static void
272void
273arrayParamOut(CheckpointOut &cp, const std::string &name,
274 const Fifo<T> &param)
275{
276 std::vector<T> temp(param.size());
277 param.peek(temp.begin(), temp.size());
278 arrayParamOut(cp, name, temp);
279}
280
281template <typename T>
273arrayParamOut(CheckpointOut &cp, const std::string &name,
274 const Fifo<T> &param)
275{
276 std::vector<T> temp(param.size());
277 param.peek(temp.begin(), temp.size());
278 arrayParamOut(cp, name, temp);
279}
280
281template <typename T>
282static void
282void
283arrayParamIn(CheckpointIn &cp, const std::string &name,
284 Fifo<T> &param)
285{
286 std::vector<T> temp;
287 arrayParamIn(cp, name, temp);
288
289 fatal_if(param.capacity() < temp.size(),
290 "Trying to unserialize data into too small FIFO\n");
291
292 param.flush();
293 param.write(temp.cbegin(), temp.size());
294}
295
296#endif // __BASE_CIRCLEBUF_HH__
283arrayParamIn(CheckpointIn &cp, const std::string &name,
284 Fifo<T> &param)
285{
286 std::vector<T> temp;
287 arrayParamIn(cp, name, temp);
288
289 fatal_if(param.capacity() < temp.size(),
290 "Trying to unserialize data into too small FIFO\n");
291
292 param.flush();
293 param.write(temp.cbegin(), temp.size());
294}
295
296#endif // __BASE_CIRCLEBUF_HH__