diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-12 22:45:12 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-12 22:45:12 +0100 |
commit | 23196be83778973d9688cc5d465e4e4a16476568 (patch) | |
tree | 91dee3b2c2e05d3b529cf537d12a7faf7ec21dc1 /src/crepe/manager/ComponentManager.h | |
parent | 297d621987c224db26eadfb9bde9235741387496 (diff) |
add documentation
Diffstat (limited to 'src/crepe/manager/ComponentManager.h')
-rw-r--r-- | src/crepe/manager/ComponentManager.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/crepe/manager/ComponentManager.h b/src/crepe/manager/ComponentManager.h index 457a196..c3a5b4a 100644 --- a/src/crepe/manager/ComponentManager.h +++ b/src/crepe/manager/ComponentManager.h @@ -142,19 +142,39 @@ public: template <typename T> RefVector<T> get_components_by_tag(const std::string & tag) const; + //! Snapshot of single component (including path in \c components) struct SnapshotComponent { + //! \c components path std::type_index type; + //! \c components path game_object_id_t id; + //! \c components path size_t index; + //! Actual component snapshot std::unique_ptr<Component> component; }; + //! Snapshot of the entire component manager state struct Snapshot { + //! All components + std::vector<SnapshotComponent> components; // TODO: some kind of hash code that ensures components exist in all the same places as // this snapshot - std::vector<SnapshotComponent> components; }; + /** + * \name ReplayManager (Memento) functions + * \{ + */ + /** + * \brief Save a snapshot of the component manager state + * \returns Deep copy of the component manager's internal state + */ Snapshot save(); - void restore(const Snapshot &); + /** + * \brief Restore component manager from a snapshot + * \param snapshot Snapshot to restore from (as returned by \c save()) + */ + void restore(const Snapshot & snapshot); + //! \} private: /** |