Some C++ Enterprise utilities

Hi.

I’ve been writing a lot of Enterprise code (for plugins) in C++ lately, and to avoid repetition I’ve been separating out recurring or significant components. As such, this is a bit of a grab bag, and should continue to grow as I tease out more such patterns. In case they might be useful to others, they’re available as public repositories:

ByteReader

corona_enterprise_utils

I use them as Git submodules, but that isn’t a strict requirement. They’ve been largely for my own use, thus documentation is not terribly extensive. :) (If anyone does take a crack at them, pester me here with any questions.)

ByteReader  is separated (and its code slightly different) since it’s meant for at least one non-Corona-specific use. However, this is a one-sided isolation, as  corona_enterprise_utils  uses it extensively.

All my own code is under MIT. The aligned allocator comes from libsimdpp while the math expressions stuff (still a work in progress) was adapted from tinyexpr (Boost and zlib license, respectively, both very permissive).

Some current highlights:

  • Lua memory allocator, useful for APIs that accept a custom allocator: with this you can simply use the API’s own results without any sort of C++ -> Lua copy, and allocation errors become Lua errors; as a side effect (good or bad), the garbage collector is also aware of these allocations

  • The aforementioned ByteReader , which is a protocol I’m using in my own libraries to read data from not-necessarily-a-string sources, e.g. to pass memory (or snapshots of memory) around

  • Along those lines, blobs (which implement the ByteReader protocol), meant to share memory among different parts of your program, possibly for writing; the blobs have some support for alignment, e.g. to accommodate SIMD optimizations

  • (These last two would allow you to take advantage of these features once they land in some things I’m making, as well as add them to your own projects, possibly with interop in mind)

  • Helpers to create objects in thread-local storage (meant to take advantage of an upcoming plugin)

  • Miscellaneous Lua support, e.g. for C++ object management

  • Some dynamic library helpers

  • Very much a WIP, but an attempt to query the hardware’s compute capabilities

  • The aforementioned math expressions, templatized for more general use