![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
The process-local registry singleton. More...
#include "ToolRegistry.h"
Public Member Functions | |
| const ToolRecord * | find (const std::string &name) const |
Find a record by logical name, or nullptr if none is registered. | |
| bool | provides (const std::string &name, const std::string &op) const |
True iff a record named name exists, is enabled, and advertises op. | |
| std::vector< const ToolRecord * > | byOperation (const std::string &op) const |
Enabled tools advertising op, ordered by descending preference then name. | |
| const std::vector< ToolRecord > & | records () const |
All records, in registration order (used by the provsql.tools view). | |
| void | upsert (const ToolRecord &rec) |
| Register a new tool or replace the record with the same name. | |
| bool | remove (const std::string &name) |
Remove the record named name; returns false if none existed. | |
| bool | setEnabled (const std::string &name, bool enabled) |
Flip the enabled flag of name; returns false if none existed. | |
| bool | setPreference (const std::string &name, int preference) |
Set the preference of name; returns false if none existed. | |
| void | reset () |
| Discard all records and re-seed the compiled-in defaults. | |
Static Public Member Functions | |
| static ToolRegistry & | instance () |
| Access the per-process registry, seeding it on first use. | |
Private Member Functions | |
| ToolRegistry () | |
| void | seed () |
Private Attributes | |
| std::vector< ToolRecord > | records_ |
The process-local registry singleton.
Not thread-safe; PostgreSQL backends are single-threaded, which is the only context that touches it.
Definition at line 177 of file ToolRegistry.h.
|
inlineprivate |
Definition at line 215 of file ToolRegistry.h.


| std::vector< const ToolRecord * > provsql::ToolRegistry::byOperation | ( | const std::string & | op | ) | const |
Enabled tools advertising op, ordered by descending preference then name.
Definition at line 137 of file ToolRegistry.cpp.
| const ToolRecord * provsql::ToolRegistry::find | ( | const std::string & | name | ) | const |
Find a record by logical name, or nullptr if none is registered.
Definition at line 122 of file ToolRegistry.cpp.

|
static |
Access the per-process registry, seeding it on first use.
Definition at line 116 of file ToolRegistry.cpp.


| bool provsql::ToolRegistry::provides | ( | const std::string & | name, |
| const std::string & | op ) const |
True iff a record named name exists, is enabled, and advertises op.
Definition at line 130 of file ToolRegistry.cpp.

|
inline |
All records, in registration order (used by the provsql.tools view).
Definition at line 195 of file ToolRegistry.h.
| bool provsql::ToolRegistry::remove | ( | const std::string & | name | ) |
Remove the record named name; returns false if none existed.
Definition at line 164 of file ToolRegistry.cpp.

| void provsql::ToolRegistry::reset | ( | ) |
Discard all records and re-seed the compiled-in defaults.
Definition at line 111 of file ToolRegistry.cpp.


|
private |
| bool provsql::ToolRegistry::setEnabled | ( | const std::string & | name, |
| bool | enabled ) |
Flip the enabled flag of name; returns false if none existed.
Definition at line 174 of file ToolRegistry.cpp.
| bool provsql::ToolRegistry::setPreference | ( | const std::string & | name, |
| int | preference ) |
Set the preference of name; returns false if none existed.
Definition at line 185 of file ToolRegistry.cpp.
| void provsql::ToolRegistry::upsert | ( | const ToolRecord & | rec | ) |
Register a new tool or replace the record with the same name.
Definition at line 153 of file ToolRegistry.cpp.

|
private |
Definition at line 220 of file ToolRegistry.h.