]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
encoding: Add type boost::tuple<A,B,C> encoding/decode func.
authorJianpeng Ma <jianpeng.ma@intel.com>
Thu, 20 Nov 2014 08:15:15 +0000 (16:15 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Fri, 12 Dec 2014 06:23:35 +0000 (14:23 +0800)
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/include/encoding.h

index d19b60e9eeaefbcdc51a59aa6a58f498b4ad0085..70d718c2df7036f637e5b4d3b215568c4206fa92 100644 (file)
@@ -287,6 +287,7 @@ inline void decode(T &o, bufferlist& bl)
 #include <vector>
 #include <string>
 #include <boost/optional.hpp>
+#include <boost/tuple/tuple.hpp>
 
 #ifndef _BACKWARD_BACKWARD_WARNING_H
 #define _BACKWARD_BACKWARD_WARNING_H   // make gcc 4.3 shut up about hash_*
@@ -318,6 +319,22 @@ inline void decode(boost::optional<T> &p, bufferlist::iterator &bp)
   }
 }
 
+//triple tuple
+template<class A, class B, class C>
+inline void encode(const boost::tuple<A, B, C> &t, bufferlist& bl)
+{
+  encode(boost::get<0>(t), bl);
+  encode(boost::get<1>(t), bl);
+  encode(boost::get<2>(t), bl);
+}
+template<class A, class B, class C>
+inline void decode(boost::tuple<A, B, C> &t, bufferlist::iterator &bp)
+{
+  decode(boost::get<0>(t), bp);
+  decode(boost::get<1>(t), bp);
+  decode(boost::get<2>(t), bp);
+}
+
 // pair
 template<class A, class B>
 inline void encode(const std::pair<A,B> &p, bufferlist &bl, uint64_t features)