yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::cli::agent::ToolRegistry Class Reference

Centralized registry for all agent tools. More...

#include <tool_registry.h>

Classes

struct  ToolEntry
 

Public Types

using HandlerFactory = std::function<std::unique_ptr<resources::CommandHandler>()>
 

Public Member Functions

void RegisterTool (const ToolDefinition &def, HandlerFactory factory)
 
std::vector< ToolDefinitionGetAllTools () const
 
std::optional< ToolDefinitionGetToolDefinition (const std::string &name) const
 
std::vector< ToolDefinitionGetToolsByCategory (const std::string &category) const
 
absl::StatusOr< std::unique_ptr< resources::CommandHandler > > CreateHandler (const std::string &tool_name) const
 

Static Public Member Functions

static ToolRegistryGet ()
 

Private Member Functions

 ToolRegistry ()=default
 

Private Attributes

std::map< std::string, ToolEntrytools_
 

Detailed Description

Centralized registry for all agent tools.

Replaces the hardcoded switch/case in ToolDispatcher. Allows tools to self-register and provides a unified way to discover, query, and instantiate tools.

Definition at line 42 of file tool_registry.h.

Member Typedef Documentation

◆ HandlerFactory

Definition at line 45 of file tool_registry.h.

Constructor & Destructor Documentation

◆ ToolRegistry()

yaze::cli::agent::ToolRegistry::ToolRegistry ( )
privatedefault

Member Function Documentation

◆ Get()

◆ RegisterTool()

void yaze::cli::agent::ToolRegistry::RegisterTool ( const ToolDefinition & def,
HandlerFactory factory )

Definition at line 14 of file tool_registry.cc.

References yaze::cli::agent::ToolDefinition::name, and tools_.

◆ GetAllTools()

std::vector< ToolDefinition > yaze::cli::agent::ToolRegistry::GetAllTools ( ) const

Definition at line 18 of file tool_registry.cc.

References yaze::zelda3::name, and tools_.

Referenced by yaze::cli::agent::ToolDispatcher::GetAvailableTools().

◆ GetToolDefinition()

std::optional< ToolDefinition > yaze::cli::agent::ToolRegistry::GetToolDefinition ( const std::string & name) const

◆ GetToolsByCategory()

std::vector< ToolDefinition > yaze::cli::agent::ToolRegistry::GetToolsByCategory ( const std::string & category) const

Definition at line 35 of file tool_registry.cc.

References yaze::zelda3::category, yaze::zelda3::name, and tools_.

◆ CreateHandler()

absl::StatusOr< std::unique_ptr< resources::CommandHandler > > yaze::cli::agent::ToolRegistry::CreateHandler ( const std::string & tool_name) const

Definition at line 46 of file tool_registry.cc.

References tools_.

Referenced by yaze::cli::agent::ToolDispatcher::Dispatch().

Member Data Documentation

◆ tools_

std::map<std::string, ToolEntry> yaze::cli::agent::ToolRegistry::tools_
private

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