]>
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/ceph_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
, ceph::buffer::list
& bl
)
16 __u32 n
= (__u32
)(m
.size());
18 for (typename
btree::btree_map
<T
,U
>::const_iterator p
= m
.begin(); p
!= m
.end(); ++p
) {
20 encode(p
->second
, bl
);
23 template<class T
, class U
>
24 inline void encode(const btree::btree_map
<T
,U
>& m
, ceph::buffer::list
& bl
, uint64_t features
)
27 __u32 n
= (__u32
)(m
.size());
29 for (typename
btree::btree_map
<T
,U
>::const_iterator p
= m
.begin(); p
!= m
.end(); ++p
) {
30 encode(p
->first
, bl
, features
);
31 encode(p
->second
, bl
, features
);
34 template<class T
, class U
>
35 inline void decode(btree::btree_map
<T
,U
>& m
, ceph::buffer::list::const_iterator
& p
)
47 template<class T
, class U
>
48 inline void encode_nohead(const btree::btree_map
<T
,U
>& m
, ceph::buffer::list
& bl
)
51 for (typename
btree::btree_map
<T
,U
>::const_iterator p
= m
.begin(); p
!= m
.end(); ++p
) {
53 encode(p
->second
, bl
);
56 template<class T
, class U
>
57 inline void decode_nohead(int n
, btree::btree_map
<T
,U
>& m
, ceph::buffer::list::const_iterator
& p
)