Thread-safe global op registry.
All methods are static; the underlying map and its lock live in a
function-local static inside OpRegistry.cpp. Schemas are stored
by non-owning pointer — the caller (typically a constexpr static in an
op's translation unit) must guarantee that the pointee outlives the
registry.
Notes
The map keys are std::string_view references into each
schema's name field. Because schemas are required to live for the
process lifetime, the keys are stable for the same duration — no string
copying or hashing of string contents per lookup is needed.
Static methods
4Returns a snapshot of every registered schema.
Acquires a shared read lock. The snapshot is a freshly allocated vector; the schemas it points to remain valid for the process lifetime.
Returns
std::vector<const OpSchema*>All currently registered schemas, ordered alphabetically by name (the backing container is a std::map).
Notes
Intended for diagnostics, profiler dumps, and Python introspection
— not for the hot dispatch path, which should use lookup.
Looks up a registered schema by canonical op name.
Acquires a shared read lock. Multiple threads may call concurrently.
Parameters
namestd::string_viewReturns
const OpSchema*Pointer to the registered schema, or nullptr when no op of that name exists. The returned pointer is stable for the lifetime of the process.
Registers a schema under schema.name.
Acquires an exclusive write lock. If an op with the same name was already registered the entry is silently overwritten — this is intentional, to let tests inject mocked schemas without going through a deregister API. Production code registers each schema exactly once at static-init time.
Parameters
schemaconst OpSchema&Notes
schema.name is captured as a std::string_view; do
not pass schemas whose name is backed by a temporary
std::string.
Returns the number of registered ops.
Acquires a shared read lock.
Returns
std::size_tCurrent size of the registry.