]>
git.proxmox.com Git - ceph.git/blob - ceph/src/include/encoding_btree.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_INCLUDE_ENCODING_BTREE_H
5 #define CEPH_INCLUDE_ENCODING_BTREE_H
7 #include "include/cpp-btree/btree_map.h"
9 template<class T
, class U
>
10 inline void encode(const btree::btree_map
<T
,U
>& m
, bufferlist
& bl
)
12 __u32 n
= (__u32
)(m
.size());
14 for (typename
btree::btree_map
<T
,U
>::const_iterator p
= m
.begin(); p
!= m
.end(); ++p
) {
16 encode(p
->second
, bl
);
19 template<class T
, class U
>
20 inline void encode(const btree::btree_map
<T
,U
>& m
, bufferlist
& bl
, uint64_t features
)
22 __u32 n
= (__u32
)(m
.size());
24 for (typename
btree::btree_map
<T
,U
>::const_iterator p
= m
.begin(); p
!= m
.end(); ++p
) {
25 encode(p
->first
, bl
, features
);
26 encode(p
->second
, bl
, features
);
29 template<class T
, class U
>
30 inline void decode(btree::btree_map
<T
,U
>& m
, bufferlist::iterator
& p
)
41 template<class T
, class U
>
42 inline void encode_nohead(const btree::btree_map
<T
,U
>& m
, bufferlist
& bl
)
44 for (typename
btree::btree_map
<T
,U
>::const_iterator p
= m
.begin(); p
!= m
.end(); ++p
) {
46 encode(p
->second
, bl
);
49 template<class T
, class U
>
50 inline void decode_nohead(int n
, btree::btree_map
<T
,U
>& m
, bufferlist::iterator
& p
)