Line |
Branch |
Exec |
Source |
1 |
|
|
// |
2 |
|
|
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) |
3 |
|
|
// |
4 |
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying |
5 |
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
6 |
|
|
// |
7 |
|
|
// Official repository: https://github.com/CPPAlliance/http_proto |
8 |
|
|
// |
9 |
|
|
|
10 |
|
|
#ifndef BOOST_HTTP_PROTO_DETAIL_CIRCULAR_BUFFER_HPP |
11 |
|
|
#define BOOST_HTTP_PROTO_DETAIL_CIRCULAR_BUFFER_HPP |
12 |
|
|
|
13 |
|
|
#include <boost/http_proto/buffer.hpp> |
14 |
|
|
|
15 |
|
|
namespace boost { |
16 |
|
|
namespace http_proto { |
17 |
|
|
namespace detail { |
18 |
|
|
|
19 |
|
|
class circular_buffer |
20 |
|
|
{ |
21 |
|
|
unsigned char* base_ = nullptr; |
22 |
|
|
std::size_t cap_ = 0; |
23 |
|
|
std::size_t in_pos_ = 0; |
24 |
|
|
std::size_t in_len_ = 0; |
25 |
|
|
|
26 |
|
|
public: |
27 |
|
|
struct buffers |
28 |
|
|
{ |
29 |
|
|
mutable_buffer first; |
30 |
|
|
mutable_buffer second; |
31 |
|
|
}; |
32 |
|
|
|
33 |
|
✗ |
circular_buffer() = default; |
34 |
|
|
circular_buffer( |
35 |
|
|
circular_buffer const&) = default; |
36 |
|
|
circular_buffer& operator=( |
37 |
|
|
circular_buffer const&) = default; |
38 |
|
|
|
39 |
|
|
circular_buffer( |
40 |
|
|
void* base, |
41 |
|
|
std::size_t capacity) noexcept; |
42 |
|
|
|
43 |
|
|
bool empty() const noexcept; |
44 |
|
|
buffers data() const noexcept; |
45 |
|
|
buffers prepare() noexcept; |
46 |
|
|
void commit(std::size_t n) noexcept; |
47 |
|
|
void consume(std::size_t n) noexcept; |
48 |
|
|
}; |
49 |
|
|
|
50 |
|
|
} // detail |
51 |
|
|
} // http_proto |
52 |
|
|
} // boost |
53 |
|
|
|
54 |
|
|
#endif |
55 |
|
|
|