| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2025 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/buffers | ||
| 8 | // | ||
| 9 | |||
| 10 | #include <boost/buffers/any_buffers.hpp> | ||
| 11 | #include <boost/buffers/detail/except.hpp> | ||
| 12 | |||
| 13 | namespace boost { | ||
| 14 | namespace buffers { | ||
| 15 | |||
| 16 | template<> | ||
| 17 | 4 | any_buffers<true>:: | |
| 18 | 4 | any_buffers() noexcept | |
| 19 | { | ||
| 20 | struct impl : any_impl | ||
| 21 | { | ||
| 22 | 1 | bool is_small_buffers() const noexcept override | |
| 23 | { | ||
| 24 | 1 | return true; | |
| 25 | } | ||
| 26 | |||
| 27 | 1 | bool is_small_iter() const noexcept override | |
| 28 | { | ||
| 29 | 1 | return true; | |
| 30 | } | ||
| 31 | |||
| 32 | 19 | void copy( | |
| 33 | any_buffers& dest, | ||
| 34 | std::shared_ptr<any_impl const> const& sp) const override | ||
| 35 | { | ||
| 36 | 19 | dest.sp_ = sp; | |
| 37 | 19 | } | |
| 38 | |||
| 39 | 217 | void it_copy(void*, void const*) const override | |
| 40 | { | ||
| 41 | 217 | } | |
| 42 | |||
| 43 | 466 | void it_destroy(void*) const override | |
| 44 | { | ||
| 45 | 466 | } | |
| 46 | |||
| 47 | 1 | void inc(void*) const override | |
| 48 | { | ||
| 49 | 1 | } | |
| 50 | |||
| 51 | 1 | void dec(void*) const override | |
| 52 | { | ||
| 53 | 1 | } | |
| 54 | |||
| 55 | 3 | value_type deref(void const*) const override | |
| 56 | { | ||
| 57 | 3 | return {}; | |
| 58 | } | ||
| 59 | |||
| 60 | 132 | bool equal(void const*, void const*) const override | |
| 61 | { | ||
| 62 | 132 | return true; | |
| 63 | } | ||
| 64 | |||
| 65 | 218 | void begin(void*) const override | |
| 66 | { | ||
| 67 | 218 | } | |
| 68 | |||
| 69 | 31 | void end(void*) const override | |
| 70 | { | ||
| 71 | 31 | } | |
| 72 | }; | ||
| 73 | |||
| 74 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | static impl const instance; |
| 75 | 8 | sp_ = std::shared_ptr<any_impl const>( | |
| 76 | 4 | &instance, null_deleter{} ); | |
| 77 | 4 | } | |
| 78 | |||
| 79 | template<> | ||
| 80 | 3 | any_buffers<false>:: | |
| 81 | 3 | any_buffers() noexcept | |
| 82 | { | ||
| 83 | struct impl : any_impl | ||
| 84 | { | ||
| 85 | 2 | bool is_small_buffers() const noexcept override | |
| 86 | { | ||
| 87 | 2 | return true; | |
| 88 | } | ||
| 89 | |||
| 90 | 2 | bool is_small_iter() const noexcept override | |
| 91 | { | ||
| 92 | 2 | return true; | |
| 93 | } | ||
| 94 | |||
| 95 | 37 | void copy( | |
| 96 | any_buffers& dest, | ||
| 97 | std::shared_ptr<any_impl const> const& sp) const override | ||
| 98 | { | ||
| 99 | 37 | dest.sp_ = sp; | |
| 100 | 37 | } | |
| 101 | |||
| 102 | 217 | void it_copy(void*, void const*) const override | |
| 103 | { | ||
| 104 | 217 | } | |
| 105 | |||
| 106 | 500 | void it_destroy(void*) const override | |
| 107 | { | ||
| 108 | 500 | } | |
| 109 | |||
| 110 | 1 | void inc(void*) const override | |
| 111 | { | ||
| 112 | 1 | } | |
| 113 | |||
| 114 | 1 | void dec(void*) const override | |
| 115 | { | ||
| 116 | 1 | } | |
| 117 | |||
| 118 | 3 | value_type deref(void const*) const override | |
| 119 | { | ||
| 120 | 3 | return {}; | |
| 121 | } | ||
| 122 | |||
| 123 | 149 | bool equal(void const*, void const*) const override | |
| 124 | { | ||
| 125 | 149 | return true; | |
| 126 | } | ||
| 127 | |||
| 128 | 235 | void begin(void*) const override | |
| 129 | { | ||
| 130 | 235 | } | |
| 131 | |||
| 132 | 48 | void end(void*) const override | |
| 133 | { | ||
| 134 | 48 | } | |
| 135 | }; | ||
| 136 | |||
| 137 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
3 | static impl const instance; |
| 138 | 6 | sp_ = std::shared_ptr<any_impl const>( | |
| 139 | 3 | &instance, null_deleter{} ); | |
| 140 | 3 | } | |
| 141 | |||
| 142 | template<> | ||
| 143 | ✗ | any_buffers<true>:: | |
| 144 | any_buffers:: | ||
| 145 | const_iterator:: | ||
| 146 | ✗ | const_iterator() noexcept | |
| 147 | ✗ | : sp_(any_buffers<true>().begin().sp_) | |
| 148 | { | ||
| 149 | ✗ | } | |
| 150 | |||
| 151 | template<> | ||
| 152 | ✗ | any_buffers<false>:: | |
| 153 | any_buffers:: | ||
| 154 | const_iterator:: | ||
| 155 | ✗ | const_iterator() noexcept | |
| 156 | ✗ | : sp_(any_buffers<false>().begin().sp_) | |
| 157 | { | ||
| 158 | ✗ | } | |
| 159 | |||
| 160 | } // buffers | ||
| 161 | } // boost | ||
| 162 |