Class ManifestManager

Class Documentation

class ManifestManager

Manages manifest loading, validation, and entity access.

Thread-safe class for managing the manifest lifecycle. Provides access to parsed entities and relationship queries.

Public Functions

explicit ManifestManager(rclcpp::Node *node = nullptr)

Construct ManifestManager.

Parameters:

node – ROS node for logging (can be nullptr for testing)

bool load_manifest(const std::string &file_path, bool strict = true)

Load manifest from file.

Note

ERRORs (broken references, circular deps, duplicate bindings) always cause failure regardless of strict mode, as they indicate a fundamentally broken manifest. Only WARNINGs are affected by the strict flag.

Parameters:
  • file_path – Path to manifest YAML file

  • strict – If true, also fail on warnings; errors always cause failure

Returns:

true if loaded and validated successfully

bool load_manifest_from_string(const std::string &yaml_content, bool strict = true)

Load manifest from YAML string (useful for testing)

Note

See load_manifest() for behavior details.

Parameters:
  • yaml_content – YAML content

  • strict – If true, also fail on warnings; errors always cause failure

Returns:

true if loaded and validated successfully

bool reload_manifest()

Reload manifest from previously loaded file path.

Re-parses the base manifest file AND re-scans the fragments directory (if one has been configured via set_fragments_dir). Fragments are merged on top of the base manifest before validation runs. A missing fragments directory is treated as “no fragments” and does not fail the reload.

Returns:

true if reloaded successfully

void set_fragments_dir(const std::string &dir)

Configure a directory containing manifest fragment files.

When set, every load_manifest / reload_manifest call scans the directory for files whose name ends in .yaml or .yml (recursion is not performed), parses each one with the standard ManifestParser, and merges the declared entities on top of the base manifest before validation. Plugins that deploy new nodes at runtime can drop a per-deploy fragment alongside their deployed files without editing the base manifest.

Merge rules:

  • apps / components / functions are appended; duplicate IDs across the merged manifest cause validation to fail the same way they would in a single file.

  • fragments may not declare top-level areas, metadata, discovery, scripts, capabilities, or lock_overrides - those must stay in the base manifest. Each forbidden field a fragment declares is recorded as a FRAGMENT_FORBIDDEN_FIELD validation error and causes manifest loading / reloading to fail.

Call with an empty string to disable fragment scanning.

Parameters:

dir – Absolute or gateway-relative path to a directory. Does not need to exist at call time; a missing directory on load is treated as “no fragments found”.

std::string get_fragments_dir() const

Get the currently configured fragments directory (empty if unset).

void unload_manifest()

Unload current manifest (revert to runtime-only mode)

bool is_manifest_active() const

Check if manifest is loaded and active.

std::string get_manifest_path() const

Get the loaded manifest file path.

ValidationResult get_validation_result() const

Get last validation result.

std::optional<ManifestMetadata> get_metadata() const

Get manifest metadata.

ManifestConfig get_config() const

Get manifest config.

std::unordered_map<std::string, ManifestLockConfig> get_lock_overrides() const

Get per-entity lock configuration overrides from manifest.

std::vector<ScriptEntryConfig> get_scripts() const

Get script entries defined in manifest.

std::vector<Area> get_areas() const

Get all areas from manifest.

std::vector<Component> get_components() const

Get all components from manifest.

std::vector<App> get_apps() const

Get all apps from manifest.

std::vector<Function> get_functions() const

Get all functions from manifest.

std::optional<Area> get_area(const std::string &id) const

Get area by ID.

std::optional<Component> get_component(const std::string &id) const

Get component by ID.

std::optional<App> get_app(const std::string &id) const

Get app by ID.

std::optional<Function> get_function(const std::string &id) const

Get function by ID.

std::vector<Component> get_components_for_area(const std::string &area_id) const

Get components belonging to an area.

std::vector<App> get_apps_for_component(const std::string &component_id) const

Get apps located on a component.

std::vector<std::string> get_hosts_for_function(const std::string &function_id) const

Get entities hosted by a function.

std::vector<Area> get_subareas(const std::string &area_id) const

Get subareas of an area.

std::vector<Component> get_subcomponents(const std::string &component_id) const

Get subcomponents of a component.

std::optional<json> get_capabilities_override(const std::string &entity_id) const

Get custom capabilities override for an entity.

json get_status_json() const

Get manifest status as JSON (for /manifest/status endpoint)