载入中...
搜索中...
未找到
EffectDefinitionRuntime.cpp
浏览该文件的文档.
2#include <algorithm>
3#include <cmath>
4#include <iterator>
5#include <limits>
6#include <utility>
7#include "common/Value.h"
8#include "common/ValueRead.h"
10
11// EffectDefinitionRuntime.cpp
12namespace eve::effects {
13namespace {
14
17 const auto& logical = reference.id();
18 return registry.handle(std::string(logical.namespaceName()), std::string(logical.name()));
19}
20
21const eve::Value* field(const eve::Value::Object& object, const char* name) {
22 const auto it = object.find(name);
23 return it == object.end() ? nullptr : &it->second;
24}
25
26bool readString(const eve::Value::Object& object, const char* name, std::string& output) {
27 auto text = eve::readStringMember(object, name);
28 if (!text) return false;
29 output = std::move(text.value());
30 return true;
31}
32
33bool readInt(const eve::Value::Object& object, const char* name, int& output) {
34 const auto* value = field(object, name);
35 if (!value) return false;
36 auto parsed = eve::readIntValue(*value);
37 if (!parsed) return false;
38 output = parsed.value();
39 return true;
40}
41
42bool readUInt(const eve::Value::Object& object, const char* name, std::uint32_t& output) {
43 const auto* value = field(object, name);
44 if (!value) return false;
45 auto parsed = eve::readUInt32Value(*value);
46 if (!parsed) return false;
47 output = parsed.value();
48 return true;
49}
50
51bool readDouble(const eve::Value::Object& object, const char* name, double& output) {
52 const auto* value = field(object, name);
53 if (!value) return false;
54 auto parsed = eve::readNumericDoubleValue(*value);
55 if (!parsed) return false;
56 output = parsed.value();
57 return std::isfinite(output);
58}
59
60template <class Enum>
61bool readEnum(const eve::Value::Object& object, const char* name, const char* const* names, const Enum* values,
62 std::size_t count, Enum& output) {
63 const auto* value = field(object, name);
64 const auto* text = value ? value->getIf<std::string>() : nullptr;
65 if (!text) return false;
66 for (std::size_t i = 0; i < count; ++i) {
67 if (*text == names[i]) {
68 output = values[i];
69 return true;
70 }
71 }
72 return false;
73}
74
75template <class Enum>
76bool readOptionalEnum(const eve::Value::Object& object, const char* name, const char* const* names, const Enum* values,
77 std::size_t count, Enum& output) {
78 const auto* value = field(object, name);
79 if (value == nullptr) return true;
80 return readEnum(object, name, names, values, count, output);
81}
82
85 auto parsed = eve::Value::fromJson(definition.json);
86 if (!parsed) return eve::Result<EffectRuntimeState>::failure(parsed.status());
87 auto value = std::move(parsed).takeValue();
88 const auto* object = value.getIf<eve::Value::Object>();
89 if (!object)
91 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect definition payload must be an object",
92 "json", {}, "effects.definition_runtime"));
93
94 EffectRuntimeState state;
95 state.stackKey = std::string(reference.id().name());
96 if (const auto* value = field(*object, "stackKey")) {
97 const auto* text = value->getIf<std::string>();
98 if (!text)
100 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect stackKey must be a string",
101 "stackKey", {}, "effects.definition_runtime"));
102 state.stackKey = *text;
103 }
104 if (const auto* value = field(*object, "priority")) {
105 if (!readInt(*object, "priority", state.priority))
107 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect priority must be Int64",
108 "priority", {}, "effects.definition_runtime"));
109 }
110 if (const auto* value = field(*object, "duration")) {
111 (void)value;
112 if (!readDouble(*object, "duration", state.duration))
114 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect duration must be finite",
115 "duration", {}, "effects.definition_runtime"));
116 }
117 if (const auto* value = field(*object, "magnitude")) {
118 (void)value;
119 if (!readDouble(*object, "magnitude", state.magnitude))
121 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect magnitude must be finite",
122 "magnitude", {}, "effects.definition_runtime"));
123 }
124 if (const auto* value = field(*object, "stackCount")) {
125 (void)value;
126 if (!readUInt(*object, "stackCount", state.stackCount) || state.stackCount == 0)
128 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect stackCount must be positive",
129 "stackCount", {}, "effects.definition_runtime"));
130 }
131 if (const auto* value = field(*object, "maxStacks")) {
132 (void)value;
133 if (!readUInt(*object, "maxStacks", state.maxStacks))
135 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect maxStacks must be UInt32",
136 "maxStacks", {}, "effects.definition_runtime"));
137 }
138 if (state.maxStacks != 0 && state.stackCount > state.maxStacks)
140 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect stackCount exceeds maxStacks",
141 "stackCount", {}, "effects.definition_runtime"));
142 constexpr const char* stackModeNames[] = {"replace", "new_instance", "reuse", "accumulate"};
145 if (!readOptionalEnum(*object, "stackMode", stackModeNames, stackModeValues, std::size(stackModeNames),
146 state.policy.stackMode))
148 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect stackMode is invalid", "stackMode", {},
149 "effects.definition_runtime"));
150 constexpr const char* stackCountPolicyNames[] = {"keep", "increment", "set"};
151 constexpr StackCountPolicy stackCountPolicyValues[] = {StackCountPolicy::Keep, StackCountPolicy::Increment,
153 if (!readOptionalEnum(*object, "stackCountPolicy", stackCountPolicyNames, stackCountPolicyValues,
154 std::size(stackCountPolicyNames), state.policy.stackCount))
156 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect stackCountPolicy is invalid",
157 "stackCountPolicy", {}, "effects.definition_runtime"));
158 constexpr const char* durationPolicyNames[] = {"keep", "replace", "extend"};
159 constexpr DurationPolicy durationPolicyValues[] = {DurationPolicy::Keep, DurationPolicy::Replace,
161 if (!readOptionalEnum(*object, "durationPolicy", durationPolicyNames, durationPolicyValues,
162 std::size(durationPolicyNames), state.policy.duration))
164 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect durationPolicy is invalid",
165 "durationPolicy", {}, "effects.definition_runtime"));
166 constexpr const char* magnitudePolicyNames[] = {"keep", "replace", "add", "max"};
167 constexpr MagnitudePolicy magnitudePolicyValues[] = {MagnitudePolicy::Keep, MagnitudePolicy::Replace,
169 if (!readOptionalEnum(*object, "magnitudePolicy", magnitudePolicyNames, magnitudePolicyValues,
170 std::size(magnitudePolicyNames), state.policy.magnitude))
172 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect magnitudePolicy is invalid",
173 "magnitudePolicy", {}, "effects.definition_runtime"));
174 constexpr const char* overflowPolicyNames[] = {"reject", "clamp", "replace_oldest"};
175 constexpr OverflowPolicy overflowPolicyValues[] = {OverflowPolicy::Reject, OverflowPolicy::Clamp,
177 if (!readOptionalEnum(*object, "overflowPolicy", overflowPolicyNames, overflowPolicyValues,
178 std::size(overflowPolicyNames), state.policy.overflow))
180 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect overflowPolicy is invalid",
181 "overflowPolicy", {}, "effects.definition_runtime"));
182 state.policy.maxStacks = state.maxStacks;
183 state.remaining = state.duration > 0.0 ? state.duration : -1.0;
184
185 if (const auto* value = field(*object, "tags")) {
186 const auto* array = value->getIf<eve::Value::Array>();
187 if (!array)
189 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect tags must be an array", "tags", {},
190 "effects.definition_runtime"));
191 for (const auto& item : *array) {
192 const auto* tag = item.getIf<std::string>();
193 if (!tag || tag->empty())
195 eve::DiagnosticCode::InvalidArgument, "effect tag must be a non-empty string", "tags", {},
196 "effects.definition_runtime"));
197 state.tags.push_back(*tag);
198 }
199 std::sort(state.tags.begin(), state.tags.end());
200 state.tags.erase(std::unique(state.tags.begin(), state.tags.end()), state.tags.end());
201 }
202 if (const auto* value = field(*object, "payload")) {
203 const auto* payload = value->getIf<eve::Value::Object>();
204 if (!payload)
206 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect payload must be an object",
207 "payload", {}, "effects.definition_runtime"));
208 for (const auto& [key, item] : *payload) {
209 auto json = item.toJson();
210 if (!json) return eve::Result<EffectRuntimeState>::failure(json.status());
211 auto stored = state.payload.setJson(key, std::move(json).takeValue());
212 if (!stored.ok())
214 eve::DiagnosticCode::InvalidArgument, "effect payload member could not be stored", "payload." + key,
215 {}, "effects.definition_runtime"));
216 }
217 }
218 return eve::Result<EffectRuntimeState>::success(std::move(state));
219}
220
224 auto definition = registry.resolveHandle(handle);
225 if (!definition) return eve::Result<EffectRuntimeState>::failure(definition.status());
226 return parseState(definition.value().get(), reference);
227}
228
229} // namespace
230
232 eve::DefinitionRef definition, std::string subject,
235 if (!definition.id().isValid())
237 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect definition reference is invalid", {},
238 {}, "effects.definition_runtime"));
239 if (subject.empty())
241 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect subject must not be empty", "subject",
242 {}, "effects.definition_runtime"));
243 auto handle = currentHandle(registry, definition);
245 auto state = resolveState(registry, definition, handle.value());
248 instanceId, std::move(definition), handle.value().generation, std::move(state).takeValue());
249 if (!runtime) return eve::Result<EffectDefinitionRuntime>::failure(runtime.status());
251 registry, std::move(runtime).takeValue(), std::move(subject), std::move(source), policy));
252}
253
255 return runtime_.identity();
256}
257
258const EffectRuntimeState& EffectDefinitionRuntime::state() const noexcept { return runtime_.state(); }
259
260EffectRuntimeState& EffectDefinitionRuntime::state() noexcept { return runtime_.state(); }
261
263 return runtime_.identity().definitionHandle();
264}
265
266void EffectDefinitionRuntime::setActive(bool active) noexcept { runtime_.setActive(active); }
267
268bool EffectDefinitionRuntime::isActive() const noexcept { return runtime_.isActive(); }
269
271 if (effect == nullptr)
273 "effect runtime cannot project to a null instance",
274 "effect", {}, "effects.definition_runtime"));
275 EffectInstance candidate = *effect;
276 candidate.id = identity().instanceId.format();
277 candidate.subject = subject_;
278 candidate.type = identity().definition.id().name();
279 candidate.source = source_;
280 candidate.stackKey = state().stackKey;
281 candidate.priority = state().priority;
282 candidate.duration = state().duration;
283 candidate.remaining = state().remaining;
284 candidate.magnitude = state().magnitude;
285 candidate.stackCount = state().stackCount;
286 candidate.policy = state().policy;
287 candidate.payload = state().payload;
288 candidate.tags = state().tags;
290 candidate.definitionIdentity = identity();
291 candidate.reloadPolicy = policy_;
292 using std::swap;
293 swap(*effect, candidate);
295}
296
298 if (registry_ == nullptr)
300 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect definition registry is not bound",
301 "registry", {}, "effects.definition_runtime"));
302 auto next = currentHandle(*registry_, identity().definition);
303 if (!next) return eve::Result<eve::definition::ReloadOutcome>::failure(next.status());
304 auto defaults = resolveState(*registry_, identity().definition, next.value());
306 EffectRuntimeState defaultState = std::move(defaults).takeValue();
307 auto rebuild = [defaultState](const EffectRuntimeState& oldState, const eve::definition::InstanceIdentity&,
309 EffectRuntimeState rebuilt = defaultState;
310 if (oldState.remaining >= 0.0)
311 rebuilt.remaining = rebuilt.duration > 0.0 ? std::min(oldState.remaining, rebuilt.duration) : -1.0;
312 rebuilt.stackCount =
313 rebuilt.maxStacks == 0 ? oldState.stackCount : std::min(oldState.stackCount, rebuilt.maxStacks);
314 if (rebuilt.stackCount == 0) rebuilt.stackCount = 1;
315 return eve::Result<EffectRuntimeState>::success(std::move(rebuilt));
316 };
317 auto result = runtime_.reload(next.value(), policy, defaultState, std::move(rebuild));
318 if (result.ok()) policy_ = policy;
319 return result;
320}
321
322} // namespace eve::effects
323
324// EffectTypes.cpp
325namespace eve::effects {
326// namespace
327
328void EffectPayload::setString(const std::string& key, const std::string& value) {
329 if (!key.empty()) values_[key] = eve::Value(value);
330}
331
332void EffectPayload::setNumber(const std::string& key, double value) {
333 if (key.empty() || !std::isfinite(value)) return;
334 values_[key] = eve::Value(value);
335}
336
337void EffectPayload::setBool(const std::string& key, bool value) {
338 if (!key.empty()) values_[key] = eve::Value(value);
339}
340
341void EffectPayload::setNull(const std::string& key) {
342 if (!key.empty()) values_[key] = eve::Value();
343}
344
345eve::Result<void> EffectPayload::setJson(const std::string& key, const std::string& json) {
346 if (key.empty())
348 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect payload key must not be empty"));
349 auto parsed = eve::Value::fromJson(json);
350 if (!parsed.ok()) return eve::Result<void>::failure(parsed.status());
351 values_[key] = std::move(parsed).takeValue();
353}
354
355bool EffectPayload::has(const std::string& key) const { return values_.contains(key); }
356
358 if (key.empty())
360 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect payload key must not be empty"));
361 const bool removed = values_.erase(key) != 0;
363}
364
365std::string EffectPayload::getJson(const std::string& key) const {
366 const auto it = values_.find(key);
367 if (it == values_.end()) return {};
368 auto result = it->second.toJson();
369 if (!result) return {};
370 return std::move(result).takeValue();
371}
372
373std::string EffectPayload::toJson() const {
374 auto result = eve::Value(values_).toJson();
375 if (!result) return {};
376 return std::move(result).takeValue();
377}
378
379const eve::Value::Object& EffectPayload::object() const noexcept { return values_; }
380
381void EffectPayload::clear() { values_.clear(); }
382
384 if (id.empty())
386 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect definition id must not be empty"));
387 if (!std::isfinite(duration))
389 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect definition duration must be finite"));
390 if (!std::isfinite(period) || period < 0.0)
392 eve::DiagnosticCode::InvalidArgument, "effect definition period must be finite and non-negative"));
393 if (!std::isfinite(magnitude))
395 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect definition magnitude must be finite"));
396 if (stackCount == 0)
398 "effect definition stack count must be positive"));
402 "effect definition stack count exceeds its maximum"));
403 }
405}
406
408 if (tag.empty())
410 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "effect tag must not be empty"));
411 const auto it = std::lower_bound(tags.begin(), tags.end(), tag);
413 tags.insert(it, tag);
415}
416
418 const auto it = std::lower_bound(tags.begin(), tags.end(), tag);
420 tags.erase(it);
422}
423
424bool EffectInstance::hasTag(const std::string& tag) const { return std::binary_search(tags.begin(), tags.end(), tag); }
425
426int EffectInstance::tagCount() const { return static_cast<int>(tags.size()); }
427
428std::string EffectInstance::tagAt(int index) const {
429 return index < 0 || static_cast<std::size_t>(index) >= tags.size() ? std::string{}
430 : tags[static_cast<std::size_t>(index)];
431}
432
433std::string policyName(StackPolicy policy) {
434 switch (policy) {
435 case StackPolicy::Replace: return "replace";
436 case StackPolicy::Stack: return "stack";
437 case StackPolicy::Refresh: return "refresh";
438 }
439 return "unknown";
440}
441
442bool parsePolicy(const std::string& name, StackPolicy& policy) {
443 if (name == "replace")
444 policy = StackPolicy::Replace;
445 else if (name == "stack")
446 policy = StackPolicy::Stack;
447 else if (name == "refresh")
448 policy = StackPolicy::Refresh;
449 else
450 return false;
451 return true;
452}
453
455 switch (kind) {
456 case EffectEventKind::Applied: return "applied";
457 case EffectEventKind::Refreshed: return "refreshed";
458 case EffectEventKind::Stacked: return "stacked";
459 case EffectEventKind::Periodic: return "periodic";
460 case EffectEventKind::Expired: return "expired";
461 case EffectEventKind::Removed: return "removed";
462 }
463 return "unknown";
464}
465
466} // namespace eve::effects
Value::Object payload
bool & active
int subject
Definition AnimSmr.cpp:163
std::string output
AuthorityStoreHandleRef reference
Definition Authority.cpp:24
std::vector< Value > defaults
Definition ECS.cpp:49
SQObjectPtr key
Definition ECS.cpp:155
std::string name
Definition ECS.cpp:154
Strongly typed effect definition/runtime adapter.
Definition, policy, instance and lifecycle value types for effects.
int instanceId
std::vector< std::uint8_t > stored
Definition Evpack.cpp:171
Poco::JSON::Object::Ptr result
const std::string * tag
std::unique_ptr< ParticleEffect > effect
PrimitiveHandle handle
std::set< std::string > values
const eve::script::BindingContractRegistry & registry
Object::Ptr value
int removed
std::string text
std::string_view source
std::string kind
int count
uint32_t index
Owning, renderer-independent dynamic values.
Stable definition reference backed by LogicalId.
Definition ResourceRef.h:85
const LogicalId & id() const noexcept
Return the stable logical definition identity.
Definition ResourceRef.h:97
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
std::string_view name() const noexcept
Returns the name component as a view into this object.
Definition Identity.cpp:64
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:185
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
Result< std::string > toJson() const
Serialize this value as deterministic compact JSON.
Definition Value.cpp:187
static Result< Value > fromJson(std::string_view json)
Parse one strict JSON value into an owning Value.
Definition Value.cpp:177
std::map< std::string, Value > Object
Definition Value.h:34
std::vector< Value > Array
Definition Value.h:33
static eve::Result< RuntimeInstance > create(eve::PersistentId instanceId, eve::DefinitionRef definition, eve::Generation definitionGeneration, State state, bool active=true)
Construct a runtime instance after validating its identity.
Deterministic registry of topic-neutral, versioned JSON definitions.
Definition Definitions.h:58
Id128 public API.
Definition Identity.h:111
std::string format() const
Formats the ID in lower-case canonical UUID text.
Definition Identity.h:172
static constexpr Id128 fromUuid(const Id128< OtherTag > &value) noexcept
Re-tags an existing UUID at an explicit domain boundary.
Definition Identity.h:135
Binds a typed effect runtime to a generation-qualified definition.
eve::Result< eve::definition::ReloadOutcome > reload(eve::definition::ReloadPolicy policy)
Resolve the registry's current generation and execute a policy.
bool isActive() const noexcept
Return whether the effect is active for reload policy decisions.
static eve::Result< EffectDefinitionRuntime > create(eve::definitions::DefinitionRegistry &registry, eve::DefinitionRef definition, std::string subject, std::string source, eve::PersistentId instanceId, eve::definition::ReloadPolicy policy=eve::definition::ReloadPolicy::KeepInstanceValues)
Create a typed effect runtime from a registry definition.
const eve::definition::InstanceIdentity & identity() const noexcept
Borrow the unified instance identity.
eve::Result< void > applyTo(EffectInstance *effect) const
Atomically project the typed runtime into an EffectInstance.
const EffectRuntimeState & state() const noexcept
Borrow the strongly typed effect runtime state.
void setActive(bool active) noexcept
Mark this effect active/inactive for RejectWhileActive.
eve::definition::DefinitionHandle definitionHandle() const noexcept
Borrow the current generation-qualified definition handle.
std::string toJson() const
Serializes all fields as a deterministic JSON object.
bool has(const std::string &key) const
Returns whether a field exists.
void setBool(const std::string &key, bool value)
Sets a JSON boolean field.
void setString(const std::string &key, const std::string &value)
Sets a JSON string field.
void setNull(const std::string &key)
Sets a JSON null field.
eve::Result< void > setJson(const std::string &key, const std::string &json)
Parses JSON text and stores its typed Value at the field.
const eve::Value::Object & object() const noexcept
Returns the read-only canonical Value object owned by this payload.
std::string getJson(const std::string &key) const
Serializes a field's typed Value to JSON text, or returns empty when absent/invalid.
eve::Result< void > erase(const std::string &key)
Removes a field; an absent field is an explicit NoOp result.
void setNumber(const std::string &key, double value)
Sets a JSON number field.
const Value * field(const Value &value, const char *key)
Borrow an optional object field.
ReloadPolicy
Policy used when a live definition is replaced.
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
bool readString(const eve::Value::Object &object, const char *name, std::string &output)
Result< int > readIntValue(const Value &value)
Read an Int64 value as a range-checked native int without numeric coercion.
Definition Value.cpp:41
Result< std::string > readStringMember(const Value::Object &object, std::string_view name)
Read a required string field, including an empty string, as an owning value.
Definition Value.cpp:25
Result< std::uint32_t > readUInt32Value(const Value &value)
Read an Int64 as a range-checked UInt32 without numeric coercion.
Definition Value.cpp:65
Result< double > readNumericDoubleValue(const Value &value)
Read an Int64 or Double as a double without imposing a finite-value policy.
Definition Value.cpp:74
A generation-qualified reference to one definition incarnation.
Canonical identity carried by every typed runtime instance.
One immutable view of a registered versioned JSON definition.
Definition Definitions.h:31
double period
Period in seconds for domain executor settlement; zero disables periodic ticks.
eve::Result< void > validate() const
Validates definition fields without changing any state.
One owned runtime effect fact.
eve::EffectId identity
UUID-backed identity for persistence/event boundaries; nil in the legacy facade.
std::string tagAt(int index) const
Returns a tag by lexical index, or an empty string.
EffectPolicy policy
Typed application policy projected from the current definition.
eve::Result< void > removeTag(const std::string &tag)
Removes a tag; an absent tag is an explicit NoOp result.
eve::Result< void > addTag(const std::string &tag)
Adds a tag while retaining deterministic lexical order.
eve::definition::InstanceIdentity definitionIdentity
Canonical definition link used by the typed definition adapter.
bool hasTag(const std::string &tag) const
Returns whether this effect has a tag.
eve::definition::ReloadPolicy reloadPolicy
int tagCount() const
Returns the number of tags.
std::vector< std::string > tags
StackCountPolicy stackCount
Definition EffectTypes.h:55
Typed mutable lifecycle values for one effect instance.