![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Process-wide singleton blackboard storing TaskValue entries. More...
#include <GlobalBlackboard.h>
Public Member Functions | |
| TaskValue | GetVar (const std::string &key) const |
| Reads a variable by key. | |
| void | SetVar (const std::string &key, const TaskValue &value) |
| Writes or creates a variable. | |
| bool | IsDirty () const |
| Returns true if any variable has been modified since the last ClearDirty(). | |
| void | MarkDirty () |
| Marks the blackboard as modified (called automatically by SetVar). | |
| void | ClearDirty () |
| Clears the dirty flag (call after persisting). | |
| bool | HasVar (const std::string &key) const |
| Checks whether a variable exists. | |
| void | Clear () |
| Removes all variables (useful in tests / level transitions). | |
Static Public Member Functions | |
| static GlobalBlackboard & | Get () |
| Returns the singleton instance. | |
Private Member Functions | |
| GlobalBlackboard ()=default | |
| ~GlobalBlackboard ()=default | |
| GlobalBlackboard (const GlobalBlackboard &)=delete | |
| GlobalBlackboard & | operator= (const GlobalBlackboard &)=delete |
| GlobalBlackboard (GlobalBlackboard &&)=delete | |
| GlobalBlackboard & | operator= (GlobalBlackboard &&)=delete |
Private Attributes | |
| std::unordered_map< std::string, TaskValue > | m_store |
| bool | m_dirty = false |
Process-wide singleton blackboard storing TaskValue entries.
All VS graph nodes sharing the same process can read and write GlobalBlackboard variables using the "global:" scope prefix.
Example:
Definition at line 50 of file GlobalBlackboard.h.
|
privatedefault |
|
privatedefault |
|
privatedelete |
|
privatedelete |
|
inline |
Removes all variables (useful in tests / level transitions).
Definition at line 119 of file GlobalBlackboard.h.
|
inline |
Clears the dirty flag (call after persisting).
Definition at line 104 of file GlobalBlackboard.h.
References m_dirty.
|
inlinestatic |
Returns the singleton instance.
Definition at line 57 of file GlobalBlackboard.h.
References GetComponentTypeID_Static().
Referenced by Olympe::LocalBlackboard::GetValueScoped(), and Olympe::LocalBlackboard::SetValueScoped().
Here is the call graph for this function:
Here is the caller graph for this function:Reads a variable by key.
| key | Variable name (without "global:" prefix). |
Definition at line 69 of file GlobalBlackboard.h.
References GetComponentTypeID_Static(), and m_store.
Referenced by Olympe::LocalBlackboard::GetValueScoped().
Here is the call graph for this function:
Here is the caller graph for this function:Checks whether a variable exists.
| key | Variable name (without "global:" prefix). |
Definition at line 111 of file GlobalBlackboard.h.
References GetComponentTypeID_Static(), and m_store.
Here is the call graph for this function:
|
inline |
Returns true if any variable has been modified since the last ClearDirty().
Definition at line 94 of file GlobalBlackboard.h.
References m_dirty.
|
inline |
Marks the blackboard as modified (called automatically by SetVar).
Definition at line 99 of file GlobalBlackboard.h.
References m_dirty.
|
privatedelete |
|
privatedelete |
Writes or creates a variable.
| key | Variable name (without "global:" prefix). |
| value | Value to store. |
Definition at line 85 of file GlobalBlackboard.h.
References GetComponentTypeID_Static(), m_dirty, and m_store.
Referenced by Olympe::LocalBlackboard::SetValueScoped().
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 136 of file GlobalBlackboard.h.
Referenced by Clear(), ClearDirty(), IsDirty(), MarkDirty(), and SetVar().
|
private |