![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Manages named blackboard variables for a graph. More...
#include <BlackboardSystem.h>
Public Member Functions | |
| BlackboardSystem ()=default | |
| ~BlackboardSystem ()=default | |
| bool | HasEntry (const std::string &name) const |
| Check if an entry exists. | |
| const BlackboardValue * | GetEntry (const std::string &name) const |
| Get a const pointer to an entry. | |
| bool | CreateEntry (const std::string &name, BlackboardType type, const BlackboardValue &initialValue) |
| Create a new entry. | |
| bool | RemoveEntry (const std::string &name) |
| Remove an entry. | |
| bool | RenameEntry (const std::string &oldName, const std::string &newName) |
| Rename an entry. | |
| bool | SetValue (const std::string &name, const BlackboardValue &value) |
| Update the value of an existing entry. | |
| const std::map< std::string, BlackboardValue > & | GetAll () const |
| Get all entries (for UI / serialization) | |
| json | ToJson () const |
| Serialize blackboard to JSON. | |
| void | FromJson (const json &j) |
| Deserialize blackboard from JSON. | |
Static Private Member Functions | |
| static std::string | TypeToString (BlackboardType t) |
| Convert a BlackboardType to its string representation. | |
| static BlackboardType | StringToType (const std::string &s) |
| Convert a string to BlackboardType (returns Int on unknown) | |
Private Attributes | |
| std::map< std::string, BlackboardValue > | m_entries |
Manages named blackboard variables for a graph.
Definition at line 62 of file BlackboardSystem.h.
|
default |
|
default |
| bool Olympe::NodeGraph::BlackboardSystem::CreateEntry | ( | const std::string & | name, |
| BlackboardType | type, | ||
| const BlackboardValue & | initialValue | ||
| ) |
Create a new entry.
| name | Variable name (must be unique) |
| type | Variable type |
| initialValue | Initial value |
Definition at line 37 of file BlackboardSystem.cpp.
References GetComponentTypeID_Static(), HasEntry(), m_entries, SYSTEM_LOG, Olympe::NodeGraph::BlackboardValue::type, and TypeToString().
Here is the call graph for this function:Deserialize blackboard from JSON.
| j | JSON array produced by ToJson() |
Definition at line 176 of file BlackboardSystem.cpp.
References JsonHelper::GetBool(), GetComponentTypeID_Static(), JsonHelper::GetFloat(), JsonHelper::GetInt(), JsonHelper::GetString(), m_entries, StringToType(), and Olympe::NodeGraph::BlackboardValue::type.
Here is the call graph for this function:| const std::map< std::string, BlackboardValue > & Olympe::NodeGraph::BlackboardSystem::GetAll | ( | ) | const |
Get all entries (for UI / serialization)
Definition at line 126 of file BlackboardSystem.cpp.
References m_entries.
| const BlackboardValue * Olympe::NodeGraph::BlackboardSystem::GetEntry | ( | const std::string & | name | ) | const |
Get a const pointer to an entry.
| name | Variable name |
Definition at line 23 of file BlackboardSystem.cpp.
References GetComponentTypeID_Static(), and m_entries.
Here is the call graph for this function:Check if an entry exists.
| name | Variable name |
Definition at line 18 of file BlackboardSystem.cpp.
References m_entries.
Referenced by CreateEntry(), and RenameEntry().
Here is the caller graph for this function:Remove an entry.
| name | Variable name |
Definition at line 61 of file BlackboardSystem.cpp.
References GetComponentTypeID_Static(), m_entries, and SYSTEM_LOG.
Here is the call graph for this function:| bool Olympe::NodeGraph::BlackboardSystem::RenameEntry | ( | const std::string & | oldName, |
| const std::string & | newName | ||
| ) |
Rename an entry.
| oldName | Current variable name |
| newName | New variable name |
Definition at line 74 of file BlackboardSystem.cpp.
References GetComponentTypeID_Static(), HasEntry(), m_entries, and SYSTEM_LOG.
Here is the call graph for this function:| bool Olympe::NodeGraph::BlackboardSystem::SetValue | ( | const std::string & | name, |
| const BlackboardValue & | value | ||
| ) |
Update the value of an existing entry.
| name | Variable name |
| value | New value (type must match the entry's type) |
Definition at line 103 of file BlackboardSystem.cpp.
References GetComponentTypeID_Static(), m_entries, SYSTEM_LOG, and Olympe::NodeGraph::BlackboardValue::type.
Here is the call graph for this function:
|
staticprivate |
Convert a string to BlackboardType (returns Int on unknown)
Definition at line 253 of file BlackboardSystem.cpp.
References GetComponentTypeID_Static().
Referenced by FromJson().
Here is the call graph for this function:
Here is the caller graph for this function:| json Olympe::NodeGraph::BlackboardSystem::ToJson | ( | ) | const |
Serialize blackboard to JSON.
Definition at line 135 of file BlackboardSystem.cpp.
References GetComponentTypeID_Static(), m_entries, and TypeToString().
Referenced by Olympe::NodeGraph::GraphDocument::ToJson().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Convert a BlackboardType to its string representation.
Definition at line 240 of file BlackboardSystem.cpp.
References GetComponentTypeID_Static().
Referenced by CreateEntry(), and ToJson().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 132 of file BlackboardSystem.h.
Referenced by CreateEntry(), FromJson(), GetAll(), GetEntry(), HasEntry(), RemoveEntry(), RenameEntry(), SetValue(), and ToJson().