eigen_mqueue.cpp
Go to the documentation of this file.
4 #include <rtt/types/TransportPlugin.hpp>
6 #include <boost/serialization/vector.hpp>
7 #include <Eigen/Dense>
8 
9 using namespace std;
10 using namespace RTT::detail;
11 using namespace Eigen;
12 using namespace RTT;
13 using namespace RTT::mqueue;
14 using namespace RTT::types;
15 
16 // From Shmuel Levine : http://stackoverflow.com/questions/18382457/eigen-and-boostserialize
17 namespace boost{
18  namespace serialization{
19 
20  template< class Archive,
21  class S,
22  int Rows_,
23  int Cols_,
24  int Ops_,
25  int MaxRows_,
26  int MaxCols_>
27  inline void save(
28  Archive & ar,
29  const Eigen::Matrix<S, Rows_, Cols_, Ops_, MaxRows_, MaxCols_> & g,
30  const unsigned int version)
31  {
32  int rows = g.rows();
33  int cols = g.cols();
34 
35  ar & rows;
36  ar & cols;
37  ar & boost::serialization::make_array(g.data(), g.size());
38  }
39 
40  template< class Archive,
41  class S,
42  int Rows_,
43  int Cols_,
44  int Ops_,
45  int MaxRows_,
46  int MaxCols_>
47  inline void load(
48  Archive & ar,
49  Eigen::Matrix<S, Rows_, Cols_, Ops_, MaxRows_, MaxCols_> & g,
50  const unsigned int version)
51  {
52  int rows, cols;
53  ar & rows;
54  ar & cols;
55  g.resize(rows, cols);
56  ar & boost::serialization::make_array(g.data(), g.size());
57  }
58 
59  template< class Archive,
60  class S,
61  int Rows_,
62  int Cols_,
63  int Ops_,
64  int MaxRows_,
65  int MaxCols_>
66  inline void serialize(
67  Archive & ar,
68  Eigen::Matrix<S, Rows_, Cols_, Ops_, MaxRows_, MaxCols_> & g,
69  const unsigned int version)
70  {
71  split_free(ar, g, version);
72  }
73 
74 
75  } // namespace serialization
76 } // namespace boost
77 namespace RTT {
78  namespace mqueue {
79  bool MQEigenPlugin::registerTransport(std::string name, TypeInfo* ti)
80  {
81  if ( name == "eigen_vector" )
83  if ( name == "eigen_matrix" )
85 
86  return false;
87  }
88 
89  std::string MQEigenPlugin::getTransportName() const {
90  return "mqueue";
91  }
92 
93  std::string MQEigenPlugin::getTypekitName() const {
94  return "Eigen";
95  }
96  std::string MQEigenPlugin::getName() const {
97  return "eigen-mqueue-types";
98  }
99  }
100 }
101 
103 
#define ORO_TYPEKIT_PLUGIN(TYPEKIT)
void serialize(Archive &ar, Eigen::Matrix< S, Rows_, Cols_, Ops_, MaxRows_, MaxCols_ > &g, const unsigned int version)
void load(Archive &ar, Eigen::Matrix< S, Rows_, Cols_, Ops_, MaxRows_, MaxCols_ > &g, const unsigned int version)
bool addProtocol(int protocol_id, TypeTransporter *tt)
void save(Archive &ar, const Eigen::Matrix< S, Rows_, Cols_, Ops_, MaxRows_, MaxCols_ > &g, const unsigned int version)
#define ORO_MQUEUE_PROTOCOL_ID


eigen_typekit
Author(s): Ruben Smits
autogenerated on Wed Jul 3 2019 19:39:42