Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
EntityBlackboard.h
Go to the documentation of this file.
1/**
2 * @file EntityBlackboard.h
3 * @brief Per-entity instance of global blackboard
4 * @author Olympe Engine
5 * @date 2026-03-26
6 *
7 * @details Extends LocalBlackboard with global variable storage and scope-aware access.
8 * C++14 compliant — no std::optional, structured bindings, std::filesystem.
9 */
10
11#ifndef OLYMPE_ENTITY_BLACKBOARD_H
12#define OLYMPE_ENTITY_BLACKBOARD_H
13
14#pragma once
15
16#include <string>
17#include <unordered_map>
18#include <vector>
19#include <cstdint>
20
21#include "TaskGraphTypes.h"
22#include "LocalBlackboard.h"
23#include "../json_helper.h"
24
25namespace Olympe {
26
27// Forward declaration
28class GlobalTemplateBlackboard;
29
31public:
32
35
37 const std::unordered_map<std::string, TaskValue>* globalOverrides = nullptr);
38
39 void Reset();
40 void Clear();
41
42 TaskValue GetValueScoped(const std::string& varName) const;
43 void SetValueScoped(const std::string& varName, const TaskValue& value);
44
45 TaskValue GetGlobalValue(const std::string& globalKey) const;
46 void SetGlobalValue(const std::string& globalKey, const TaskValue& value);
47
48 TaskValue GetLocalValue(const std::string& localKey) const;
49 void SetLocalValue(const std::string& localKey, const TaskValue& value);
50
51 bool HasVariableScoped(const std::string& varName) const;
52 bool HasGlobalVariable(const std::string& globalKey) const;
53 bool HasLocalVariable(const std::string& localKey) const;
54
55 size_t GetTotalVariableCount() const;
56 size_t GetGlobalVariableCount() const;
57 size_t GetLocalVariableCount() const;
58
59 uint32_t GetEntityID() const;
60
61 std::string DebugSummary() const;
62 void DebugPrint() const;
63
65 bool ImportGlobalsFromJson(const json& data);
66
67protected:
68
70 std::unordered_map<std::string, TaskValue> m_globalVars;
71 std::unordered_map<std::string, VariableType> m_globalTypes;
72
73private:
74
75 static void ParseScopedName(const std::string& scopedName,
76 std::string& outPrefix,
77 std::string& outName);
78
79};
80
81} // namespace Olympe
82
83#endif // OLYMPE_ENTITY_BLACKBOARD_H
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
Runtime key-value store for task graph variables.
Core enumerations and TaskValue type-safe variant for the Atomic Task System.
TaskValue GetValueScoped(const std::string &varName) const
void Initialize(const TaskGraphTemplate &tmpl, const std::unordered_map< std::string, TaskValue > *globalOverrides=nullptr)
TaskValue GetLocalValue(const std::string &localKey) const
bool HasVariableScoped(const std::string &varName) const
std::string DebugSummary() const
void SetLocalValue(const std::string &localKey, const TaskValue &value)
std::unordered_map< std::string, VariableType > m_globalTypes
void SetValueScoped(const std::string &varName, const TaskValue &value)
TaskValue GetGlobalValue(const std::string &globalKey) const
size_t GetGlobalVariableCount() const
bool ImportGlobalsFromJson(const json &data)
std::unordered_map< std::string, TaskValue > m_globalVars
static void ParseScopedName(const std::string &scopedName, std::string &outPrefix, std::string &outName)
bool HasGlobalVariable(const std::string &globalKey) const
bool HasLocalVariable(const std::string &localKey) const
void SetGlobalValue(const std::string &globalKey, const TaskValue &value)
Simple map-based blackboard for task graph runtime state.
Immutable, shareable task graph asset.
C++14-compliant type-safe value container for task parameters.
< Provides AssetID and INVALID_ASSET_ID
nlohmann::json json