NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
neograph::graph::ReducerRegistry Class Reference

Singleton registry for channel reducer functions. More...

#include <loader.h>

Public Member Functions

ReducerFn get (const std::string &name) const
 Look up a reducer by name.
 
std::vector< std::string > names () const
 List all registered reducer names, sorted.
 
void register_reducer (const std::string &name, ReducerFn fn)
 Register a named reducer function.
 

Static Public Member Functions

static ReducerRegistry & instance ()
 Get the singleton instance.
 

Detailed Description

Singleton registry for channel reducer functions.

Maps reducer names (used in JSON graph definitions) to ReducerFn implementations. Built-in reducers: "overwrite", "append".

[](const json& current, const json& incoming) {
return current.get<int>() + incoming.get<int>();
});
void register_reducer(const std::string &name, ReducerFn fn)
Register a named reducer function.
static ReducerRegistry & instance()
Get the singleton instance.
Note
Legacy process-global convenience API.

ReducerRegistry, ConditionRegistry, and NodeFactory synchronize concurrent registration and lookup. Engines capture a registry snapshot at construction. Use an isolated GraphRegistry for separate engines: built-ins resolve by default, while singleton custom entries require explicit GlobalFallback.

Definition at line 42 of file loader.h.

Member Function Documentation

◆ get()

ReducerFn neograph::graph::ReducerRegistry::get ( const std::string &  name) const

Look up a reducer by name.

Parameters
nameReducer name.
Returns
The ReducerFn, or throws if not found.

◆ instance()

static ReducerRegistry & neograph::graph::ReducerRegistry::instance ( )
static

Get the singleton instance.

Returns
Reference to the global ReducerRegistry.

◆ names()

std::vector< std::string > neograph::graph::ReducerRegistry::names ( ) const

List all registered reducer names, sorted.

Introspection accessor for external tooling (e.g. a visual topology editor) that needs to enumerate the available reducer palette without grepping engine source.

Returns
Sorted vector of reducer names.

◆ register_reducer()

void neograph::graph::ReducerRegistry::register_reducer ( const std::string &  name,
ReducerFn  fn 
)

Register a named reducer function.

Parameters
nameReducer name (referenced in JSON channel definitions).
fnReducer function that merges current and incoming values.

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