]>
git.proxmox.com Git - ceph.git/blob - ceph/src/include/btree_map.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_BTREE_MAP_H
5 #define CEPH_INCLUDE_BTREE_MAP_H
7 #include "include/cpp-btree/btree.h"
8 #include "include/cpp-btree/btree_map.h"
9 #include "include/assert.h" // cpp-btree uses system assert, blech
10 #include "include/encoding.h"
12 template<class T
, class U
>
13 inline void encode(const btree::btree_map
<T
,U
>& m
, bufferlist
& bl
)
15 __u32 n
= (__u32
)(m
.size());
17 for (typename
btree::btree_map
<T
,U
>::const_iterator p
= m
.begin(); p
!= m
.end(); ++p
) {
19 encode(p
->second
, bl
);
22 template<class T
, class U
>
23 inline void encode(const btree::btree_map
<T
,U
>& m
, bufferlist
& bl
, uint64_t features
)
25 __u32 n
= (__u32
)(m
.size());
27 for (typename
btree::btree_map
<T
,U
>::const_iterator p
= m
.begin(); p
!= m
.end(); ++p
) {
28 encode(p
->first
, bl
, features
);
29 encode(p
->second
, bl
, features
);
32 template<class T
, class U
>
33 inline void decode(btree::btree_map
<T
,U
>& m
, bufferlist::iterator
& p
)
44 template<class T
, class U
>
45 inline void encode_nohead(const btree::btree_map
<T
,U
>& m
, bufferlist
& bl
)
47 for (typename
btree::btree_map
<T
,U
>::const_iterator p
= m
.begin(); p
!= m
.end(); ++p
) {
49 encode(p
->second
, bl
);
52 template<class T
, class U
>
53 inline void decode_nohead(int n
, btree::btree_map
<T
,U
>& m
, bufferlist::iterator
& p
)