NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
neograph::graph::ConditionRegistry Class Reference

Singleton registry for conditional edge routing functions. More...

#include <loader.h>

Public Member Functions

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

Static Public Member Functions

static ConditionRegistryinstance ()
 Get the singleton instance.
 

Detailed Description

Singleton registry for conditional edge routing functions.

Maps condition names (used in JSON edge definitions) to ConditionFn implementations. Built-in conditions: "has_tool_calls", "route_channel".

[](const GraphState& state) -> std::string {
return state.get("messages").size() > 10 ? "true" : "false";
});
static ConditionRegistry & instance()
Get the singleton instance.
void register_condition(const std::string &name, ConditionFn fn)
Register a named condition function.
Thread-safe container for all graph state channels.
Definition state.h:26
json get(const std::string &channel) const
Read a channel's current value (thread-safe, shared lock).

Definition at line 104 of file loader.h.

Member Function Documentation

◆ get()

ConditionFn neograph::graph::ConditionRegistry::get ( const std::string &  name) const

Look up a condition by name.

Parameters
nameCondition name.
Returns
The ConditionFn, or throws if not found.

◆ instance()

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

Get the singleton instance.

Returns
Reference to the global ConditionRegistry.

◆ names()

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

List all registered condition names, sorted.

Introspection accessor for external tooling (e.g. a visual topology editor) that needs to enumerate the available conditional-routing palette.

Returns
Sorted vector of condition names.

◆ register_condition()

void neograph::graph::ConditionRegistry::register_condition ( const std::string &  name,
ConditionFn  fn 
)

Register a named condition function.

Parameters
nameCondition name (referenced in JSON edge definitions).
fnCondition function that evaluates state and returns a route key.

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