ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
provsql::ToolRegistry Class Reference

The process-local registry singleton. More...

#include "ToolRegistry.h"

Public Member Functions

const ToolRecordfind (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 ToolRegistryinstance ()
 Access the per-process registry, seeding it on first use.

Private Member Functions

 ToolRegistry ()
void seed ()

Private Attributes

std::vector< ToolRecordrecords_

Detailed Description

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.

Constructor & Destructor Documentation

◆ ToolRegistry()

provsql::ToolRegistry::ToolRegistry ( )
inlineprivate

Definition at line 215 of file ToolRegistry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ byOperation()

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.

◆ find()

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.

Here is the caller graph for this function:

◆ instance()

ToolRegistry & provsql::ToolRegistry::instance ( )
static

Access the per-process registry, seeding it on first use.

Definition at line 116 of file ToolRegistry.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ provides()

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.

Here is the call graph for this function:

◆ records()

const std::vector< ToolRecord > & provsql::ToolRegistry::records ( ) const
inline

All records, in registration order (used by the provsql.tools view).

Definition at line 195 of file ToolRegistry.h.

◆ remove()

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.

Here is the caller graph for this function:

◆ reset()

void provsql::ToolRegistry::reset ( )

Discard all records and re-seed the compiled-in defaults.

Definition at line 111 of file ToolRegistry.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ seed()

void provsql::ToolRegistry::seed ( )
private

Definition at line 36 of file ToolRegistry.cpp.

Here is the caller graph for this function:

◆ setEnabled()

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.

◆ setPreference()

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.

◆ upsert()

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.

Here is the caller graph for this function:

Member Data Documentation

◆ records_

std::vector<ToolRecord> provsql::ToolRegistry::records_
private

Definition at line 220 of file ToolRegistry.h.


The documentation for this class was generated from the following files: