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

Provides Blackboard variable values and dynamic pin values at runtime. More...

#include <RuntimeEnvironment.h>

Public Member Functions

 RuntimeEnvironment ()=default
 
void SetBlackboardVariable (const std::string &key, float value)
 Stores or overwrites a Blackboard variable.
 
bool GetBlackboardVariable (const std::string &key, float &outValue) const
 Looks up a Blackboard variable.
 
bool HasBlackboardVariable (const std::string &key) const
 Returns true when the given key has been set.
 
void SetDynamicPinValue (const std::string &pinID, float value)
 Stores or overwrites the runtime value for a dynamic data pin.
 
bool GetDynamicPinValue (const std::string &pinID, float &outValue) const
 Looks up the runtime value of a dynamic data pin.
 
void Clear ()
 Removes all stored variables and pin values.
 

Private Attributes

std::map< std::string, floatm_blackboardVariables
 Blackboard key -> value.
 
std::map< std::string, floatm_dynamicPinValues
 Pin UUID -> value.
 

Detailed Description

Provides Blackboard variable values and dynamic pin values at runtime.

Acts as the single source of truth for all float data during condition evaluation. Populated before evaluation begins (or updated dynamically as connected nodes provide new data).

Definition at line 36 of file RuntimeEnvironment.h.

Constructor & Destructor Documentation

◆ RuntimeEnvironment()

Olympe::RuntimeEnvironment::RuntimeEnvironment ( )
default

Member Function Documentation

◆ Clear()

void Olympe::RuntimeEnvironment::Clear ( )

Removes all stored variables and pin values.

Definition at line 57 of file RuntimeEnvironment.cpp.

References m_blackboardVariables, and m_dynamicPinValues.

◆ GetBlackboardVariable()

bool Olympe::RuntimeEnvironment::GetBlackboardVariable ( const std::string &  key,
float outValue 
) const

Looks up a Blackboard variable.

Parameters
keyVariable identifier.
outValueReceives the value when found.
Returns
true when the key exists; false otherwise.

Definition at line 21 of file RuntimeEnvironment.cpp.

References GetComponentTypeID_Static(), and m_blackboardVariables.

+ Here is the call graph for this function:

◆ GetDynamicPinValue()

bool Olympe::RuntimeEnvironment::GetDynamicPinValue ( const std::string &  pinID,
float outValue 
) const

Looks up the runtime value of a dynamic data pin.

Parameters
pinIDPin UUID.
outValueReceives the value when found.
Returns
true when the pin ID exists; false otherwise.

Definition at line 44 of file RuntimeEnvironment.cpp.

References GetComponentTypeID_Static(), and m_dynamicPinValues.

+ Here is the call graph for this function:

◆ HasBlackboardVariable()

bool Olympe::RuntimeEnvironment::HasBlackboardVariable ( const std::string &  key) const

Returns true when the given key has been set.

Parameters
keyVariable identifier.

Definition at line 30 of file RuntimeEnvironment.cpp.

References GetComponentTypeID_Static(), and m_blackboardVariables.

+ Here is the call graph for this function:

◆ SetBlackboardVariable()

void Olympe::RuntimeEnvironment::SetBlackboardVariable ( const std::string &  key,
float  value 
)

Stores or overwrites a Blackboard variable.

Parameters
keyVariable identifier (e.g. "mHealth").
valueFloat value to associate with the key.

Definition at line 16 of file RuntimeEnvironment.cpp.

References GetComponentTypeID_Static(), and m_blackboardVariables.

Referenced by Olympe::Examples::Example1_SimpleHealthCheck(), Olympe::Examples::Example3_ConditionChainAND(), Olympe::Examples::Example4_ConditionChainOR(), Olympe::Examples::Example5_ComparisonOperators(), and Olympe::GraphRuntimeInstance::SetBlackboardVariable().

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

◆ SetDynamicPinValue()

void Olympe::RuntimeEnvironment::SetDynamicPinValue ( const std::string &  pinID,
float  value 
)

Stores or overwrites the runtime value for a dynamic data pin.

Parameters
pinIDPin UUID (matches DynamicDataPin::id or NodeConditionRef::leftPinID / rightPinID).
valueFloat value delivered by the connected node.

Definition at line 39 of file RuntimeEnvironment.cpp.

References GetComponentTypeID_Static(), and m_dynamicPinValues.

Referenced by Olympe::GraphRuntimeInstance::SetDynamicPinValue().

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

Member Data Documentation

◆ m_blackboardVariables

std::map<std::string, float> Olympe::RuntimeEnvironment::m_blackboardVariables
private

Blackboard key -> value.

Definition at line 96 of file RuntimeEnvironment.h.

Referenced by Clear(), GetBlackboardVariable(), HasBlackboardVariable(), and SetBlackboardVariable().

◆ m_dynamicPinValues

std::map<std::string, float> Olympe::RuntimeEnvironment::m_dynamicPinValues
private

Pin UUID -> value.

Definition at line 97 of file RuntimeEnvironment.h.

Referenced by Clear(), GetDynamicPinValue(), and SetDynamicPinValue().


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