From: Jianpeng Ma Date: Thu, 20 Nov 2014 08:15:15 +0000 (+0800) Subject: encoding: Add type boost::tuple encoding/decode func. X-Git-Tag: v0.91~55^2~3^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=edaacf95f0275c89965031755343058c8ef92adf;p=ceph.git encoding: Add type boost::tuple encoding/decode func. Signed-off-by: Jianpeng Ma --- diff --git a/src/include/encoding.h b/src/include/encoding.h index d19b60e9eeae..70d718c2df70 100644 --- a/src/include/encoding.h +++ b/src/include/encoding.h @@ -287,6 +287,7 @@ inline void decode(T &o, bufferlist& bl) #include #include #include +#include #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 &p, bufferlist::iterator &bp) } } +//triple tuple +template +inline void encode(const boost::tuple &t, bufferlist& bl) +{ + encode(boost::get<0>(t), bl); + encode(boost::get<1>(t), bl); + encode(boost::get<2>(t), bl); +} +template +inline void decode(boost::tuple &t, bufferlist::iterator &bp) +{ + decode(boost::get<0>(t), bp); + decode(boost::get<1>(t), bp); + decode(boost::get<2>(t), bp); +} + // pair template inline void encode(const std::pair &p, bufferlist &bl, uint64_t features)