Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef SERIALIZE_TOOLS_H_
00010 #define SERIALIZE_TOOLS_H_
00011
00012 #include <boost/archive/text_oarchive.hpp>
00013 #include <boost/archive/text_iarchive.hpp>
00014 #include <boost/serialization/base_object.hpp>
00015 #include <boost/serialization/utility.hpp>
00016 #include <boost/serialization/list.hpp>
00017 #include <boost/serialization/split_free.hpp>
00018 #include <boost/serialization/assume_abstract.hpp>
00019 #include <surfacelet/SurfacePatch.h>
00020 #include <pcl/point_types.h>
00021 #include <pcl/point_cloud.h>
00022 #include <tf/tf.h>
00023
00024 namespace boost {
00025 namespace serialization {
00026
00027 template<class Archive>
00028 void save(Archive &ar, tf::Transform m, const unsigned int version) {
00029 geometry_msgs::Pose tmp;
00030 tf::Pose pose;
00031 tf::poseTFToMsg(m, tmp);
00032 ar & tmp.position.x;
00033 ar & tmp.position.y;
00034 ar & tmp.position.z;
00035 ar & tmp.orientation.x;
00036 ar & tmp.orientation.y;
00037 ar & tmp.orientation.z;
00038 ar & tmp.orientation.w;
00039 m = pose;
00040 }
00041
00042 template<class Archive>
00043 void load(Archive &ar, tf::Transform& m, const unsigned int version) {
00044 geometry_msgs::Pose tmp;
00045 ar & tmp.position.x;
00046 ar & tmp.position.y;
00047 ar & tmp.position.z;
00048 ar & tmp.orientation.x;
00049 ar & tmp.orientation.y;
00050 ar & tmp.orientation.z;
00051 ar & tmp.orientation.w;
00052 tf::Pose pose;
00053 tf::poseMsgToTF(tmp, pose);
00054 m = pose;
00055 }
00056
00057 template<class Archive>
00058 inline void serialize(
00059 Archive & ar,
00060 tf::Transform & t,
00061 const unsigned int file_version
00062 ){
00063 split_free(ar, t, file_version);
00064 }
00065
00066 template<class Archive>
00067 void serialize(Archive &ar, SurfacePatch& m, const unsigned int version) {
00068 ar & m.x;
00069 ar & m.y;
00070 ar & m.z;
00071 ar & m.normal_x;
00072 ar & m.normal_y;
00073 ar & m.normal_z;
00074 ar & m.scale_x;
00075 ar & m.scale_y;
00076 ar & m.scale_z;
00077 ar & m.std_dev_z;
00078 }
00079
00080 template<class Archive>
00081 void serialize(Archive &ar, pcl::PointXYZ& m, const unsigned int version) {
00082 ar & m.x;
00083 ar & m.y;
00084 ar & m.z;
00085
00086 }
00087 }
00088 }
00089
00090 #endif