SST  6.0.0
StructuralSimulationToolkit
serialize_deque.h
1 // Copyright 2009-2016 Sandia Corporation. Under the terms
2 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2016, Sandia Corporation
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SERIALIZE_DEQUE_H
13 #define SERIALIZE_DEQUE_H
14 
15 #include <deque>
16 #include <sst/core/serialization/serializer.h>
17 
18 namespace SST {
19 namespace Core {
20 namespace Serialization {
21 
22 template <class T>
23 class serialize<std::deque<T> > {
24  typedef std::deque<T> Deque;
25 
26 public:
27  void
28  operator()(Deque& v, serializer& ser) {
29  typedef typename std::set<T>::iterator iterator;
30  switch(ser.mode()) {
31  case serializer::SIZER: {
32  size_t size = v.size();
33  ser.size(size);
34  for (auto it = v.begin(); it != v.end(); ++it){
35  T& t = const_cast<T&>(*it);
36  serialize<T>()(t,ser);
37  }
38  break;
39  }
40  case serializer::PACK: {
41  size_t size = v.size();
42  ser.pack(size);
43  for (auto it = v.begin(); it != v.end(); ++it){
44  T& t = const_cast<T&>(*it);
45  serialize<T>()(t,ser);
46  }
47  break;
48  }
49  case serializer::UNPACK: {
50  size_t size;
51  ser.unpack(size);
52  for (int i=0; i < size; ++i){
53  T t;
54  serialize<T>()(t,ser);
55  v.push_back(t);
56  }
57  break;
58  }
59  }
60  }
61 };
62 
63 }
64 }
65 }
66 #endif // SERIALIZE_DEQUE_H
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
Definition: action.cc:17
Base serialize class.
Definition: serialize.h:32