include/pops/runtime/program/external_brick.hpp Source FileΒΆ
|
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
|
external_brick.hpp
Go to the documentation of this file.
4// Spec 3 brick is native / generated / macro / external-C++; this header owns the last category. A
5// user ships a brick in a standalone `.so` that, at static-init time, registers a manifest entry via
6// `POPS_REGISTER_BRICK(id, category, requirements)`. The host then exports a C `pops_brick_manifest()`
7// function (JSON over `BrickRegistry::instance().ids()` + each entry) that `pops.lib.load_cpp_library`
9// descriptor. This is a HOST registry (no POPS_HD, no device state): it catalogs the brick's identity
19// Escapes a string so a manifest field built from a user-supplied id/category/CSV is always valid
20// JSON: the two structural characters (`"` and `\`) plus every control character (`\n`, `\r`, `\t`,
21// and the rest of `\x00`-`\x1f` as `\uXXXX`), which RFC 8259 forbids unescaped inside a string. A
22// raw control character would make `json.loads` (lib.py) reject the whole manifest, so the escape
65// \n \r \t \b \f and \uXXXX (manifest tokens are ASCII, so a \u escape only ever carries a control
118// time by `POPS_REGISTER_BRICK` (in the user's `.so`) and read by the host's `pops_brick_manifest()`
157 // requirements/capabilities are the CSV strings the macro registered (empty when none). This is
158 // the wire form a brick `.so` exports through `pops_brick_manifest()` (POPS_DEFINE_BRICK_MANIFEST);
192// The capabilities field is left empty by this 3-argument form; a brick that PROVIDES capabilities
193// calls `BrickRegistry::instance().register_brick({...})` directly. The trailing static is a unique
194// dummy whose initializer performs the registration (zero-cost at runtime, runs once before main).
206// Exports the C reader `pops.lib.load_cpp_library` dlopens after opening a brick `.so`. Use ONCE at
211// It returns the JSON of EVERY brick the `.so` registered (BrickRegistry::to_json). The string is a
212// function-local static built once on first call (the registry is fully populated by then, since the
213// static initializers ran before any host call), so the `const char*` stays valid for the process.
Definition external_brick.hpp:122
std::string to_json() const
Definition external_brick.hpp:160
const std::vector< std::string > & ids() const
Definition external_brick.hpp:150
const std::vector< BrickManifestEntry > & entries() const
Definition external_brick.hpp:153
void register_brick(const BrickManifestEntry &entry)
Definition external_brick.hpp:132
const BrickManifestEntry * lookup(const std::string &id) const
Definition external_brick.hpp:144
std::size_t size() const
Definition external_brick.hpp:174
static BrickRegistry & instance()
Definition external_brick.hpp:125
Definition cache_manager.hpp:37
std::string json_unescape(const std::string &s)
Definition external_brick.hpp:68
std::string json_escape(const std::string &s)
Definition external_brick.hpp:24
Definition external_brick.hpp:110
std::string capabilities
Definition external_brick.hpp:114
std::string category
Definition external_brick.hpp:112
std::string requirements
Definition external_brick.hpp:113
Generated by