Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
Olympe::BBVariableRegistry Class Reference

Non-singleton registry populated from the active TaskGraphTemplate. More...

#include <BBVariableRegistry.h>

Public Member Functions

 BBVariableRegistry ()=default
 
void LoadFromTemplate (const TaskGraphTemplate &tmpl)
 Rebuilds the registry from the blackboard entries of a template.
 
const std::vector< VarSpec > & GetAllVariables () const
 Returns all variables (local and global), sorted by name.
 
std::vector< VarSpecGetVariablesByType (VariableType type) const
 Returns variables whose type matches type, sorted by name.
 
std::vector< VarSpecGetLocalVariables () const
 Returns only local-scope variables.
 
std::vector< VarSpecGetGlobalVariables () const
 Returns only global-scope variables.
 
bool HasVariable (const std::string &name) const
 Returns true if a variable with the given name is registered.
 
size_t GetCount () const
 Returns the number of registered variables.
 

Static Public Member Functions

static std::string FormatDisplayLabel (const std::string &name, VariableType type, bool isGlobal)
 Formats a display label for a variable.
 

Private Attributes

std::vector< VarSpecm_vars
 

Detailed Description

Non-singleton registry populated from the active TaskGraphTemplate.

Intentionally non-singleton because the variable set depends on which graph is currently open in the editor. Create one instance per editor panel and call LoadFromTemplate() whenever the template changes.

Definition at line 47 of file BBVariableRegistry.h.

Constructor & Destructor Documentation

◆ BBVariableRegistry()

Olympe::BBVariableRegistry::BBVariableRegistry ( )
default

Member Function Documentation

◆ FormatDisplayLabel()

std::string Olympe::BBVariableRegistry::FormatDisplayLabel ( const std::string &  name,
VariableType  type,
bool  isGlobal 
)
static

Formats a display label for a variable.

Format: "<name> (<TypeName>, <scope>)" Example: "health (Float, local)"

Parameters
nameVariable key.
typeVariable type.
isGlobalScope flag.
Returns
Formatted display label.

Definition at line 135 of file BBVariableRegistry.cpp.

References Olympe::VariableTypeName().

Referenced by LoadFromTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAllVariables()

const std::vector< VarSpec > & Olympe::BBVariableRegistry::GetAllVariables ( ) const

Returns all variables (local and global), sorted by name.

Definition at line 96 of file BBVariableRegistry.cpp.

References m_vars.

◆ GetCount()

size_t Olympe::BBVariableRegistry::GetCount ( ) const

Returns the number of registered variables.

Definition at line 153 of file BBVariableRegistry.cpp.

References m_vars.

◆ GetGlobalVariables()

std::vector< VarSpec > Olympe::BBVariableRegistry::GetGlobalVariables ( ) const

Returns only global-scope variables.

Definition at line 123 of file BBVariableRegistry.cpp.

References GetComponentTypeID_Static(), and m_vars.

+ Here is the call graph for this function:

◆ GetLocalVariables()

std::vector< VarSpec > Olympe::BBVariableRegistry::GetLocalVariables ( ) const

Returns only local-scope variables.

Definition at line 112 of file BBVariableRegistry.cpp.

References GetComponentTypeID_Static(), and m_vars.

+ Here is the call graph for this function:

◆ GetVariablesByType()

std::vector< VarSpec > Olympe::BBVariableRegistry::GetVariablesByType ( VariableType  type) const

Returns variables whose type matches type, sorted by name.

Parameters
typeVariableType filter.

Definition at line 101 of file BBVariableRegistry.cpp.

References GetComponentTypeID_Static(), and m_vars.

+ Here is the call graph for this function:

◆ HasVariable()

bool Olympe::BBVariableRegistry::HasVariable ( const std::string &  name) const

Returns true if a variable with the given name is registered.

Parameters
nameVariable key to look up.

Definition at line 143 of file BBVariableRegistry.cpp.

References GetComponentTypeID_Static(), and m_vars.

+ Here is the call graph for this function:

◆ LoadFromTemplate()

void Olympe::BBVariableRegistry::LoadFromTemplate ( const TaskGraphTemplate tmpl)

Member Data Documentation

◆ m_vars

std::vector<VarSpec> Olympe::BBVariableRegistry::m_vars
private

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