![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
#include <EditorAutosaveManager.h>
Public Member Functions | |
| EditorAutosaveManager ()=default | |
| ~EditorAutosaveManager () | |
| void | Init (std::function< void()> saveFn, float debounceSec=1.5f, float periodicIntervalSec=60.0f) |
| Set the timing parameters and an optional legacy save callback. | |
| void | ScheduleSave (double nowSec) |
| Notify the manager that a change occurred (legacy overload). | |
| void | ScheduleSave (double nowSec, std::function< std::string()> serializeFn, std::string filePath, std::string fallbackPrefix="GameData/AI/autosave_") |
| Notify the manager that a change occurred (per-save lambda overload). | |
| void | Tick (double nowSec) |
| Must be called once per frame to advance timers and launch saves. | |
| void | Flush () |
| Block until any running async save finishes. | |
Private Member Functions | |
| void | LaunchAsync () |
| void | LaunchAsyncWrite (std::string data, std::string path) |
Private Attributes | |
| std::function< void()> | m_saveFn |
| std::function< std::string()> | m_pendingSerializeFn |
| std::string | m_pendingFilePath |
| std::string | m_pendingFallbackPrefix |
| int | m_fallbackCounter = 0 |
| float | m_debounceSec = 1.5f |
| float | m_periodicIntervalSec = 60.0f |
| double | m_debounceDeadline = -1.0 |
| double | m_lastSaveTime = -1.0 |
| bool | m_dirty = false |
| std::future< void > | m_future |
Definition at line 42 of file EditorAutosaveManager.h.
|
default |
|
inline |
Definition at line 46 of file EditorAutosaveManager.h.
References Flush().
Here is the call graph for this function:| void Olympe::EditorAutosaveManager::Flush | ( | ) |
Block until any running async save finishes.
Call from Shutdown() or destructor.
Definition at line 105 of file EditorAutosaveManager.cpp.
References m_future.
Referenced by Olympe::BehaviorTreeDebugWindow::Shutdown(), Olympe::NodeGraphPanel::Shutdown(), and ~EditorAutosaveManager().
Here is the caller graph for this function:| void Olympe::EditorAutosaveManager::Init | ( | std::function< void()> | saveFn, |
| float | debounceSec = 1.5f, |
||
| float | periodicIntervalSec = 60.0f |
||
| ) |
Set the timing parameters and an optional legacy save callback.
| saveFn | Legacy callable executed on a background thread. Pass nullptr when using the per-save lambda overload. |
| debounceSec | Seconds to wait after the last ScheduleSave() before saving. |
| periodicIntervalSec | Maximum seconds between forced flushes (0 = disabled). |
Definition at line 13 of file EditorAutosaveManager.cpp.
References GetComponentTypeID_Static(), m_debounceSec, m_periodicIntervalSec, and m_saveFn.
Referenced by Olympe::BehaviorTreeDebugWindow::Initialize(), and Olympe::NodeGraphPanel::Initialize().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 113 of file EditorAutosaveManager.cpp.
References GetComponentTypeID_Static(), m_future, and m_saveFn.
Referenced by Tick().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 134 of file EditorAutosaveManager.cpp.
References GetComponentTypeID_Static(), and m_future.
Referenced by Tick().
Here is the call graph for this function:
Here is the caller graph for this function:Notify the manager that a change occurred (legacy overload).
Resets the debounce timer; uses the saveFn supplied to Init().
| nowSec | Current time in seconds (e.g. ImGui::GetTime()). |
Definition at line 22 of file EditorAutosaveManager.cpp.
References GetComponentTypeID_Static(), m_debounceDeadline, m_debounceSec, and m_dirty.
Referenced by Olympe::NodeGraphPanel::RenderGraph().
Here is the call graph for this function:
Here is the caller graph for this function:| void Olympe::EditorAutosaveManager::ScheduleSave | ( | double | nowSec, |
| std::function< std::string()> | serializeFn, | ||
| std::string | filePath, | ||
| std::string | fallbackPrefix = "GameData/AI/autosave_" |
||
| ) |
Notify the manager that a change occurred (per-save lambda overload).
Serialization runs on the calling (UI) thread inside Tick() just before the background write is launched.
| nowSec | Current time in seconds (e.g. ImGui::GetTime()). |
| serializeFn | Called on the UI thread to produce the data to write. Return an empty string to skip writing. |
| filePath | Destination path. If empty, the fallback path is used. |
| fallbackPrefix | Prefix for the fallback filename when filePath is empty. A monotonically-increasing counter is appended. Defaults to "GameData/AI/autosave_". |
Definition at line 28 of file EditorAutosaveManager.cpp.
References GetComponentTypeID_Static(), m_debounceDeadline, m_debounceSec, m_dirty, m_pendingFallbackPrefix, m_pendingFilePath, and m_pendingSerializeFn.
Here is the call graph for this function:Must be called once per frame to advance timers and launch saves.
Must be called on the UI thread so that the per-save serializer runs on the correct thread.
| nowSec | Current time in seconds (e.g. ImGui::GetTime()). |
Definition at line 40 of file EditorAutosaveManager.cpp.
References GetComponentTypeID_Static(), LaunchAsync(), LaunchAsyncWrite(), m_debounceDeadline, m_dirty, m_fallbackCounter, m_future, m_lastSaveTime, m_pendingFallbackPrefix, m_pendingFilePath, m_pendingSerializeFn, m_periodicIntervalSec, and m_saveFn.
Referenced by Olympe::NodeGraphPanel::RenderContent().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 114 of file EditorAutosaveManager.h.
Referenced by ScheduleSave(), ScheduleSave(), and Tick().
Definition at line 111 of file EditorAutosaveManager.h.
Referenced by Init(), ScheduleSave(), and ScheduleSave().
Definition at line 117 of file EditorAutosaveManager.h.
Referenced by ScheduleSave(), ScheduleSave(), and Tick().
|
private |
Definition at line 109 of file EditorAutosaveManager.h.
Referenced by Tick().
|
private |
Definition at line 119 of file EditorAutosaveManager.h.
Referenced by Flush(), LaunchAsync(), LaunchAsyncWrite(), and Tick().
|
private |
Definition at line 115 of file EditorAutosaveManager.h.
Referenced by Tick().
|
private |
Definition at line 108 of file EditorAutosaveManager.h.
Referenced by ScheduleSave(), and Tick().
|
private |
Definition at line 107 of file EditorAutosaveManager.h.
Referenced by ScheduleSave(), and Tick().
|
private |
Definition at line 106 of file EditorAutosaveManager.h.
Referenced by ScheduleSave(), and Tick().
|
private |
Definition at line 112 of file EditorAutosaveManager.h.
|
private |
Definition at line 103 of file EditorAutosaveManager.h.
Referenced by Init(), LaunchAsync(), and Tick().