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
 

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
 
void EnsureInitialized ()
 

Private Attributes

std::once_flag init_once_
 
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 51 of file tool_registry.h.

Member Typedef Documentation

◆ HandlerFactory

Initial value:
std::function<std::unique_ptr<resources::CommandHandler>()>

Definition at line 54 of file tool_registry.h.

Constructor & Destructor Documentation

◆ ToolRegistry()

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

Member Function Documentation

◆ Get()

ToolRegistry & yaze::cli::agent::ToolRegistry::Get ( )
static

◆ RegisterTool()

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

◆ GetAllTools()

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

Definition at line 175 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 193 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 205 of file tool_registry.cc.

References tools_.

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

◆ EnsureInitialized()

void yaze::cli::agent::ToolRegistry::EnsureInitialized ( )
private

Definition at line 164 of file tool_registry.cc.

References init_once_, and yaze::cli::agent::RegisterBuiltinAgentTools().

Referenced by Get().

Here is the call graph for this function:

Member Data Documentation

◆ init_once_

std::once_flag yaze::cli::agent::ToolRegistry::init_once_
private

Definition at line 82 of file tool_registry.h.

Referenced by EnsureInitialized().

◆ tools_

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

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