ecto
tendril.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <ecto/tendril.hpp>
3 #include <boost/archive/binary_iarchive.hpp>
4 #include <boost/archive/binary_oarchive.hpp>
5 #include <boost/iostreams/device/array.hpp>
6 #include <boost/iostreams/device/back_inserter.hpp>
7 #include <boost/iostreams/stream_buffer.hpp>
8 
9 namespace ecto
10 {
11  namespace serialization
12  {
13 
14  template<typename BufT>
15  void
16  save(BufT& buf, const tendril& t)
17  {
18  namespace io = boost::iostreams;
19  io::back_insert_device<BufT> inserter(buf);
20  io::stream_buffer < io::back_insert_device<BufT> > strbuf(inserter);
21  {
22  boost::archive::binary_oarchive boa(strbuf, boost::archive::no_header);
23  boa << t;
24  }
25  }
26 
27  template<typename BufT>
28  void
29  load(const BufT& buf, tendril& t)
30  {
31  namespace io = boost::iostreams;
32  io::array_source msgsrc((char*) buf.data(), buf.size());
33  io::stream_buffer < io::array_source > msgbufsrc(msgsrc);
34  {
35  boost::archive::binary_iarchive bia(msgbufsrc, boost::archive::no_header);
36  bia >> t;
37  }
38  }
39  }
40 }
Definition: parameters.hpp:11
void save(BufT &buf, const tendril &t)
Definition: tendril.hpp:16
A tendril is the slender, winding organ of the ecto::cell that gives it its awesome type erasure and ...
Definition: tendril.hpp:84
void load(const BufT &buf, tendril &t)
Definition: tendril.hpp:29