0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-15 14:31:11 +01:00
construct/include/ircd/buffer
Jason Volk 45effc15d8 ircd::buffer: Fix warning from dependent type munge (gcc-11).
ircd:Ⓜ️:fetch: Fix non-trivial aggregate (gcc-10).

ircd::ctx::ole: Fix anonymous may be used uninitialized (gcc-11).
2022-06-28 12:37:13 -07:00
..
buffer.h ircd::buffer: Fix warning from dependent type munge (gcc-11). 2022-06-28 12:37:13 -07:00
buffer_base.h ircd::buffer: Minor simplify conversion construction casts. 2022-06-17 21:11:54 -07:00
buffers.h ircd::buffer: Split buffers:: related into header. 2021-09-14 23:39:55 -07:00
const_buffer.h ircd::buffer: Adorn out-of-line asio glue with noexcept. 2022-06-17 21:11:53 -07:00
copy.h ircd::buffer: Minor qualifiers; minor cleanup. 2021-04-22 12:27:56 -07:00
fixed_buffer.h ircd::buffer: Fix template name conflicts for clang-11; apply inline linkages. 2020-10-29 04:06:59 -07:00
move.h ircd::buffer: Minor qualifiers; minor cleanup. 2021-04-22 12:27:56 -07:00
mutable_buffer.h ircd::buffer: Adorn out-of-line asio glue with noexcept. 2022-06-17 21:11:53 -07:00
parse_buffer.h ircd::buffer::parse_buffer: Remove erroneous cast operator. 2019-06-22 16:58:58 -06:00
README.md
shared_buffer.h ircd::buffer: Fix template name conflicts for clang-11; apply inline linkages. 2020-10-29 04:06:59 -07:00
unique_buffer.h Revert "ircd: ISO C++ requires template on destructor names out-of-line." (gcc-11/12) 2022-06-20 17:26:39 -07:00
window_buffer.h ircd::buffer: lte range assertion on ctor; remove attr; minor reorg. 2020-06-05 04:32:57 -07:00

Memory Buffer Tools

This is a modernization of the (char *buf, size_t buf_sz) pattern used when working with segments of RAMs. While in C99 it is possible (and recommended) for a project to create a struct buffer { char *ptr; size_t size; }; and then manually perform object semantics buffer_copy(dst, src); buffer_move(dst, src)``buffer_free(buf); etc, we create those devices using C++ language features here instead.

This suite is born out of (though not directly based on) the boost::asio buffer objects boost::asio::const_buffer and boost::asio::mutable_buffer and the two principal objects used ubiquitously throughout IRCd share the same names and general properties. We also offer conversions between them for developers working with any asio interfaces directly.

To summarize some basics about these tools:

  • Most of these interfaces are "thin" and don't own their underlying data, nor will they copy their underlying data even if their instance itself is copied.

  • We work with signed char * (and const char *) types. We do not work with void pointers because size integers always represent a count of single bytes and there is no reason to lose or confuse that information. If unsigned char * types are required by some library function an explicit cast to uint8_t * may be required especially to avoid warnings. Note that we compile this project with -fsigned-char and don't support platforms that have incompatible conversions.