载入中...
搜索中...
未找到
ConversationPersistence.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4#include "common/StateValue.h"
6
7#include <functional>
8#include <string>
9#include <unordered_map>
10#include <vector>
11
12namespace eve::dialogue {
13
16
19
22public:
23 using Resolver = std::function<const eve::dnut::SequenceAsset*(const std::string&)>;
24
32 [[nodiscard]] eve::Result<void> registerMigration(const std::string& assetId, int fromVersion,
33 const std::string& currentAssetId,
34 const std::string& nodeMap);
35
37 void clear() { rules_.clear(); }
38
40 [[nodiscard]] eve::Result<StateValue> migrate(const StateValue& state, const Resolver& resolve) const;
41
42private:
43 struct Rule {
44 std::string assetId;
45 int fromVersion = 0;
46 std::string currentAssetId;
47 std::unordered_map<std::string, std::string> nodes;
48 };
49 std::vector<Rule> rules_;
50};
51
52} // namespace eve::dialogue
#define EVENGINE_API_ORCHESTRATION
Definition Export.h:111
std::vector< BvhNode > nodes
Domain-neutral compiled sequence graph for `.dnut` sources.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
JSON-compatible state value tree used by state hot reload.
Definition StateValue.h:20
Explicit save migrations from an old asset version to its current version.
std::function< const eve::dnut::SequenceAsset *(const std::string &)> Resolver
void clear()
Remove all registered migrations.
eve::Result< std::string > conversationStateToJson(const StateValue &state)
Serialize a dialogue state tree as JSON.
eve::Result< StateValue > conversationStateFromJson(const std::string &json)
Parse a JSON dialogue state tree.
Immutable, parameterized and versioned compiled sequence.