inline void denc(const T& o, size_t& p, uint64_t features=0);
inline void denc(const T& o, buffer::list::contiguous_appender& p,
uint64_t features=0);
- inline void denc(T& o, buffer::ptr::iterator& p);
+ inline void denc(T& o, buffer::ptr::iterator& p, uint64_t features=0);
or (for featured objects)
inline void denc(const T& o, size_t& p, uint64_t features);
inline void denc(const T& o, buffer::list::contiguous_appender& p,
uint64_t features);
- inline void denc(T& o, buffer::ptr::iterator& p);
+ inline void denc(T& o, buffer::ptr::iterator& p, uint64_t features);
- These are symmetrical, so that they can be used from the magic DENC
method of writing the bound_encode/encode/decode methods all in one go;
- they differ only in the type of p. The feature argument for decode is
- ignored.
+ they differ only in the type of p.
- These are automatically fabricated via a template that calls into
the denc_traits<> methods (see below), provided denc_traits<T>::supported
static void bound_encode(const T &o, size_t& p, uint64_t f=0);
static void encode(const T &o, buffer::list::contiguous_appender& p,
uint64_t f=0);
- static void decode(T& o, buffer::ptr::iterator &p);
+ static void decode(T& o, buffer::ptr::iterator &p, uint64_t f=0);
};
or (for featured objects)
static void bound_encode(const T &o, size_t& p, uint64_t f);
static void encode(const T &o, buffer::list::contiguous_appender& p,
uint64_t f);
- static void decode(T& o, buffer::ptr::iterator &p);
+ static void decode(T& o, buffer::ptr::iterator &p, uint64_t f=0);
};
- denc_traits<T> is normally declared via the WRITE_CLASS_DENC(type) macro,
uint64_t f=0) { \
p.append((const char*)&o, sizeof(o)); \
} \
- static void decode(type& o, buffer::ptr::iterator &p) { \
+ static void decode(type& o, buffer::ptr::iterator &p, \
+ uint64_t f=0) { \
o = *(type *)p.get_pos_add(sizeof(o)); \
} \
};
uint64_t f=0) { \
*(etype *)p.get_pos_add(sizeof(etype)) = o; \
} \
- static void decode(itype& o, buffer::ptr::iterator &p) { \
- o = *(etype*)p.get_pos_add(sizeof(etype)); \
+ static void decode(itype& o, buffer::ptr::iterator &p, \
+ uint64_t f=0) { \
+ o = *(etype*)p.get_pos_add(sizeof(etype)); \
} \
};
buffer::ptr::iterator& p,
uint64_t features=0)
{
- traits::decode(o, p);
+ traits::decode(o, p, features);
}
static typename std::enable_if<sizeof(AA) &&
featured, void>::type
encode(const std::pair<A,B>& v, bufferlist::contiguous_appender& p,
- uint64_t f) {
+ uint64_t f) {
denc(v.first, p, f);
denc(v.second, p, f);
}
- static void decode(std::pair<A,B>& v, buffer::ptr::iterator& p) {
- denc(v.first, p);
- denc(v.second, p);
+ static void decode(std::pair<A,B>& v, buffer::ptr::iterator& p, uint64_t f=0) {
+ denc(v.first, p, f);
+ denc(v.second, p, f);
}
};
denc(e, p, f);
}
}
- static void decode(std::list<T>& s, buffer::ptr::iterator& p) {
+ static void decode(std::list<T>& s, buffer::ptr::iterator& p,
+ uint64_t f=0) {
s.clear();
uint32_t num;
denc(num, p);
while (num--) {
s.emplace_back(T());
- denc(s.back(), p);
+ denc(s.back(), p, f);
}
}
};
denc(e, p, f);
}
}
- static void decode(std::vector<T>& s, buffer::ptr::iterator& p) {
+ static void decode(std::vector<T>& s, buffer::ptr::iterator& p, uint64_t f=0) {
s.clear();
uint32_t num;
denc(num, p);
s.resize(num);
for (unsigned i=0; i<num; ++i) {
- denc(s[i], p);
+ denc(s[i], p, f);
}
}
}
}
static void decode_nohead(size_t num, std::vector<T>& s,
- buffer::ptr::iterator& p) {
+ buffer::ptr::iterator& p, uint64_t f=0) {
s.resize(num);
for (unsigned i=0; i<num; ++i) {
- denc(s[i], p);
+ denc(s[i], p, f);
}
}
denc(e, p, f);
}
}
- static void decode(std::set<T>& s, buffer::ptr::iterator& p) {
+ static void decode(std::set<T>& s, buffer::ptr::iterator& p, uint64_t f=0) {
s.clear();
uint32_t num;
denc(num, p);
while (num--) {
T temp;
- denc(temp, p);
+ denc(temp, p, f);
s.insert(temp);
}
}
}
}
static void decode_nohead(size_t num, std::set<T>& s,
- buffer::ptr::iterator& p) {
+ buffer::ptr::iterator& p, uint64_t f=0) {
s.clear();
while (num--) {
T temp;
- denc(temp, p);
+ denc(temp, p, f);
s.insert(temp);
}
}
}
}
- static void decode(std::map<A,B>& v, buffer::ptr::iterator& p) {
+ static void decode(std::map<A,B>& v, buffer::ptr::iterator& p, uint64_t f=0) {
v.clear();
uint32_t num;
denc(num, p);
A key;
while (num--) {
- denc(key, p);
- denc(v[key], p);
+ denc(key, p, f);
+ denc(v[key], p, f);
}
}
}
}
static void decode_nohead(size_t num, std::map<A,B>& v,
- buffer::ptr::iterator& p) {
+ buffer::ptr::iterator& p,
+ uint64_t f=0) {
v.clear();
A key;
while (num--) {
- denc(key, p);
- denc(v[key], p);
+ denc(key, p, f);
+ denc(v[key], p, f);
}
}
};
uint64_t f=0) { \
v.encode(p); \
} \
- static void decode(T& v, buffer::ptr::iterator& p) { \
+ static void decode(T& v, buffer::ptr::iterator& p, uint64_t f=0) { \
v.decode(p); \
} \
};
uint64_t f) { \
v.encode(p, f); \
} \
- static void decode(T& v, buffer::ptr::iterator& p) { \
- v.decode(p); \
+ static void decode(T& v, buffer::ptr::iterator& p, uint64_t f=0) { \
+ v.decode(p, f); \
} \
};
void encode(bufferlist::contiguous_appender& p, uint64_t f) const { \
_denc_friend(*this, p, f); \
} \
- void decode(buffer::ptr::iterator& p) { \
- _denc_friend(*this, p, 0); \
+ void decode(buffer::ptr::iterator& p, uint64_t f=0) { \
+ _denc_friend(*this, p, f); \
} \
template<typename T, typename P> \
friend typename std::enable_if<boost::is_same<T,Type>::value || \