载入中...
搜索中...
未找到
EffectTypes.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
14#include "common/Identity.h"
15#include "common/Result.h"
16#include "common/Time.h"
17#include "common/Value.h"
19
20#include <cstdint>
21#include <ostream>
22#include <string>
23#include <vector>
24
25namespace eve::effects {
26
29
32
35
38
41
44
61
64public:
66 void setString(const std::string& key, const std::string& value);
68 void setNumber(const std::string& key, double value);
70 void setBool(const std::string& key, bool value);
72 void setNull(const std::string& key);
74 [[nodiscard]] eve::Result<void> setJson(const std::string& key, const std::string& json);
76 bool has(const std::string& key) const;
78 [[nodiscard]] eve::Result<void> erase(const std::string& key);
80 std::string getJson(const std::string& key) const;
82 std::string toJson() const;
84 const eve::Value::Object& object() const noexcept;
86 void clear();
87
88private:
89 eve::Value::Object values_;
90};
91
101 std::string id;
102 std::string stackKey;
103 int priority = 0;
104 double duration = 0.0;
106 double period = 0.0;
107 double magnitude = 0.0;
108 std::uint32_t stackCount = 1;
111 std::vector<std::string> tags;
112
118 [[nodiscard]] eve::Result<void> validate() const;
119};
120
128 std::string id;
129 std::string subject;
130 std::string type;
131 std::string source;
132 std::string stackKey;
133 int priority = 0;
134 double duration = 0.0;
135 double remaining = -1.0;
137 double period = 0.0;
139 double periodElapsed = 0.0;
140 double magnitude = 0.0;
141 std::uint32_t stackCount = 1;
143 std::vector<std::string> tags;
156
158 [[nodiscard]] eve::Result<void> addTag(const std::string& tag);
160 [[nodiscard]] eve::Result<void> removeTag(const std::string& tag);
162 bool hasTag(const std::string& tag) const;
164 int tagCount() const;
166 std::string tagAt(int index) const;
167};
168
171
174 std::string instanceId;
175 std::uint64_t containerGeneration = 0;
176
178 [[nodiscard]] bool isValid() const noexcept { return !instanceId.empty() && containerGeneration != 0; }
179};
180
183
198
201 std::string effectId;
202 std::string subject;
203 std::string source;
204 double magnitude = 0.0;
205 std::uint32_t stackCount = 1;
206 std::vector<std::string> tags;
209};
210
213 std::uint32_t expired = 0;
214 double elapsedSeconds = 0.0;
216 std::vector<EffectPeriodicTick> periodicTicks;
219};
220
222std::string policyName(StackPolicy policy);
224bool parsePolicy(const std::string& name, StackPolicy& policy);
227
229inline std::ostream& operator<<(std::ostream& stream, EffectEventKind kind) { return stream << eventKindName(kind); }
230
231} // namespace eve::effects
double value
float duration
int priority
Common identity and hot-reload contract for typed runtime instances.
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
std::uint32_t key
Strong identity values shared by persistence, content and logical-name APIs.
TokenKind kind
std::string name
const std::string * tag
Move-only, checked operation results for the common layer.
Json object
Common time values and an injectable deterministic simulation clock.
uint32_t index
Owning, renderer-independent dynamic values.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
std::map< std::string, Value > Object
Definition Value.h:34
Id128 public API.
Definition Identity.h:112
static constexpr StrongUint64 zero() noexcept
Returns the zero value for this strong type.
Deterministic JSON-compatible payload carried by a definition or instance.
Definition EffectTypes.h:63
ReloadPolicy
Policy used when a live definition is replaced.
@ KeepInstanceValues
Replace the definition generation and preserve all instance values.
StackPolicy
Compatibility policy used by the original effects facade.
Definition EffectTypes.h:28
bool parsePolicy(const std::string &name, StackPolicy &policy)
Parses a lowercase legacy stack policy name.
StackMode
Determines whether a matching application replaces, reuses, or creates an instance.
Definition EffectTypes.h:31
std::string eventKindName(EffectEventKind kind)
Returns the stable lowercase name of an event kind.
OverflowPolicy
Determines what happens when a stack-count limit would be exceeded.
Definition EffectTypes.h:43
std::string policyName(StackPolicy policy)
Returns the stable lowercase name of a legacy stack policy.
DurationPolicy
Determines how an application changes an existing remaining duration.
Definition EffectTypes.h:37
StackCountPolicy
Determines how an application changes an existing stack count.
Definition EffectTypes.h:34
EffectEventKind
Lifecycle event kind emitted by an effect container.
MagnitudePolicy
Determines how an application changes an existing magnitude value.
Definition EffectTypes.h:40
std::ostream & operator<<(std::ostream &stream, EffectEventKind kind)
Writes the stable lifecycle-event spelling to a stream.
Canonical identity carried by every typed runtime instance.
Immutable-by-convention template used to create effect instances.
std::vector< std::string > tags
Deterministically sequenced effect lifecycle event.
eve::SimulationTick tick
Scheduler tick at which the lifecycle event was committed.
eve::EffectId effectIdentity
UUID-backed effect identity; the string field remains a compatibility projection.
Generation-qualified local reference to a canonical effect instance.
bool isValid() const noexcept
Whether this handle contains a local instance id and generation.
std::uint64_t containerGeneration
One owned runtime effect fact.
eve::EffectId identity
UUID-backed identity for persistence/event boundaries; nil in the legacy facade.
EffectPolicy policy
Typed application policy projected from the current definition.
eve::definition::InstanceIdentity definitionIdentity
Canonical definition link used by the typed definition adapter.
std::vector< std::string > tags
One periodic trigger handed to a domain executor for settlement.
std::vector< std::string > tags
Independent policy dimensions used when applying an effect definition.
Definition EffectTypes.h:53
StackCountPolicy stackCount
Definition EffectTypes.h:55
MagnitudePolicy magnitude
Definition EffectTypes.h:57
Summary returned by the lifecycle executor after one simulation step.
eve::SimulationTick tick
Scheduler tick that produced this summary.
std::vector< EffectPeriodicTick > periodicTicks
Periodic triggers in deterministic container order.