GCC Code Coverage Report


Directory: libs/http_proto/include/boost/http_proto/
File: boost/http_proto/detail/circular_buffer.hpp
Date: 2023-02-02 18:17:22
Exec Total Coverage
Lines: 1 1 100.0%
Functions: 1 1 100.0%
Branches: 0 0 -%

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 std::size_t out_size_ = 0;
26
27 public:
28 using const_buffers_type =
29 const_buffers_pair;
30 using mutable_buffers_type =
31 mutable_buffers_pair;
32
33 1512 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 std::size_t size() const noexcept;
44 std::size_t max_size() const noexcept;
45 std::size_t capacity() const noexcept;
46 const_buffers_type data() const noexcept;
47 mutable_buffers_type prepare(std::size_t n);
48 void commit(std::size_t n);
49 void consume(std::size_t n) noexcept;
50
51 // VFALCO I'm not happy with this
52 void uncommit(std::size_t n);
53 };
54
55 } // detail
56 } // http_proto
57 } // boost
58
59 #endif
60