A global registry of named schemas for PropertyTree.
More...
#include <schema_registry.h>
|
|
| SchemaRegistry (const SchemaRegistry &)=delete |
|
SchemaRegistry & | operator= (const SchemaRegistry &)=delete |
|
| SchemaRegistry (const SchemaRegistry &&)=delete |
|
SchemaRegistry & | operator= (const SchemaRegistry &&)=delete |
| void | registerSchema (const std::string &key, const PropertyTree &schema) |
| | Register an already-parsed schema under a logical key.
|
| void | registerSchemaFromFile (const std::string &key, const std::string &path) |
| | Register a schema from a YAML file path.
|
| bool | contains (const std::string &key) const |
| | Check whether a schema is registered under this key.
|
| PropertyTree | get (const std::string &key) const |
| | Retrieve a registered schema by key.
|
| void | loadAndRetainPluginLibraries (const boost_plugin_loader::PluginLoader &loader) |
| | Load plugin libraries and retain ownership for the lifetime of their registered schemas.
|
| void | registerDerivedType (const std::string &base_type_name, const std::string &derived_type_name) |
| | Register that a derived type can be used where a base type is expected.
|
| bool | isDerivedFrom (const std::string &base_type_name, const std::string &candidate_type) const |
| | Check if a given type is derived from (or equal to) a base type.
|
| std::vector< std::string > | getDerivedTypes (const std::string &base_type_name) const |
| | Get all registered derived types for a base type.
|
|
|
static std::shared_ptr< SchemaRegistry > | instance () |
| | Access the singleton instance.
|
| static PropertyTree | loadFile (const std::string &path) |
| | Load and parse an arbitrary YAML file into a PropertyTree.
|
A global registry of named schemas for PropertyTree.
Use SchemaRegistry::instance() to access the singleton.
◆ registerSchema()
| void tesseract::common::SchemaRegistry::registerSchema |
( |
const std::string & | key, |
|
|
const PropertyTree & | schema ) |
Register an already-parsed schema under a logical key.
- Parameters
-
| key | Unique identifier for this schema. |
| schema | Parsed PropertyTree schema. |
◆ registerSchemaFromFile()
| void tesseract::common::SchemaRegistry::registerSchemaFromFile |
( |
const std::string & | key, |
|
|
const std::string & | path ) |
Register a schema from a YAML file path.
- Parameters
-
| key | Unique identifier for this schema. |
| path | Path to a .yaml schema file. |
◆ contains()
| bool tesseract::common::SchemaRegistry::contains |
( |
const std::string & | key | ) |
const |
Check whether a schema is registered under this key.
- Parameters
-
- Returns
- True if present.
◆ get()
| PropertyTree tesseract::common::SchemaRegistry::get |
( |
const std::string & | key | ) |
const |
Retrieve a registered schema by key.
- Parameters
-
- Returns
- Copy of the schema PropertyTree.
- Exceptions
-
| std::out_of_range | if the key is not found. |
◆ loadFile()
| PropertyTree tesseract::common::SchemaRegistry::loadFile |
( |
const std::string & | path | ) |
|
|
static |
Load and parse an arbitrary YAML file into a PropertyTree.
- Parameters
-
| path | Path to a .yaml file. |
- Returns
- Parsed PropertyTree.
- Exceptions
-
| YAML::Exception | on parse errors. |
◆ loadAndRetainPluginLibraries()
| void tesseract::common::SchemaRegistry::loadAndRetainPluginLibraries |
( |
const boost_plugin_loader::PluginLoader & | loader | ) |
|
Load plugin libraries and retain ownership for the lifetime of their registered schemas.
Libraries are loaded before the registry mutex is acquired so their static schema registration may safely call back into this registry. Loaded libraries are deduplicated by their resolved path.
- Parameters
-
| loader | Configured plugin loader defining the libraries and search paths to use. |
- Exceptions
-
| boost_plugin_loader::PluginLoaderException | if no plugin libraries were provided. |
◆ registerDerivedType()
| void tesseract::common::SchemaRegistry::registerDerivedType |
( |
const std::string & | base_type_name, |
|
|
const std::string & | derived_type_name ) |
Register that a derived type can be used where a base type is expected.
- Parameters
-
| base_type_name | The base type name (e.g., "MyBaseClass") |
| derived_type_name | The derived type name (e.g., "MyDerivedClass") |
◆ isDerivedFrom()
| bool tesseract::common::SchemaRegistry::isDerivedFrom |
( |
const std::string & | base_type_name, |
|
|
const std::string & | candidate_type ) const |
Check if a given type is derived from (or equal to) a base type.
- Parameters
-
| base_type_name | The base type to check against |
| candidate_type | The type to check |
- Returns
- True if candidate is the base or derives from it
◆ getDerivedTypes()
| std::vector< std::string > tesseract::common::SchemaRegistry::getDerivedTypes |
( |
const std::string & | base_type_name | ) |
const |
Get all registered derived types for a base type.
- Parameters
-
| base_type_name | The base type |
- Returns
- Vector of all type names that derive from (or equal) the base