Class UZagalaSpecDefaultExecutionChainer#

Inheritance Relationships#

Base Types#

Class Documentation#

class UZagalaSpecDefaultExecutionChainer : public UZagalaSpecDefaultChainLink, public IZagalaSpecExecutionChainer#

Concrete implementation of IZagalaSpecExecutionChainer, IZagalaSpecBroadcaster and IZagalaSpecSubscriber.

Manages a list of IZagalaSpecChainLink objects and drives their execution sequentially. Subscribes itself to each link’s broadcaster so it can advance or fail the chain.

Broadcaster methods are forwarded to an internal UZagalaSpecDefaultBroadcaster so callers can subscribe to the chainer’s own success/failure outcome. This implementation is also a chain link itself, so chains of chains are supported, although discouraged.

IZagalaSpecExecutionChainer

virtual void AddLink(UObject *Link) override#

Adds a link to the chain.

The object must implement both IZagalaSpecChainLink and IZagalaSpecBroadcaster; objects that do not satisfy both requirements are silently rejected with a warning.

Parameters:

Link – The UObject implementing IZagalaSpecChainLink and IZagalaSpecBroadcaster to append to the chain.

virtual void AddLinkFromClass(TSubclassOf<UObject> LinkClass) override#

Creates an instance of the given class and adds it to the chain.

The class must implement both IZagalaSpecChainLink and IZagalaSpecBroadcaster; classes that do not satisfy both requirements are silently rejected with a warning.

Parameters:

LinkClass – The class to instantiate and append to the chain.

virtual void StartChain(const TScriptInterface<IZagalaSpecTaggedDataCacher> &AssignedCacher) override#

Starts the chain execution sequentially, passing the supplied cacher to each link.

Only the first link is started immediately; each subsequent link starts when the preceding one succeeds.

Parameters:

AssignedCacher – The tagged data cacher passed to each link’s Execute() call.

virtual const TArray<TObjectPtr<UObject>> &GetLinks() const override#

Returns the ordered list of links registered with this chainer.

For C++ callers; use GetLinks_BP() from Blueprint.

Returns:

A const reference to the ordered link array.

Returns the ordered list of links registered with this chainer.

Blueprint-compatible variant of GetLinks().

Returns:

A copy of the ordered link array.

virtual void RemoveLinks() override#

Unsubscribes from each link’s broadcaster and removes all links from the chain.

After this call, the link array is empty and the chainer will no longer receive success or failure events from any previously-added link.

IZagalaSpecSubscriber

virtual void HandleSuccessReceived_Implementation() override#

Called when the broadcaster reports a successful outcome.

virtual void HandleFailureReceived_Implementation(const FString &Reason) override#

Called when the broadcaster reports a failure.

Parameters:

Reason – A human-readable description of why the operation failed.

virtual void Execute(const TScriptInterface<IZagalaSpecTaggedDataCacher> &AssignedCacher) override#

Executes this link’s work using the supplied context.

Parameters:

AssignedCacher – The tagged data cacher this link will read from and write to.

Public Functions

template<typename LinkClass>
inline void AddLinkT()#

Creates a new LinkClass instance and appends it to the chain.

Protected Functions

virtual void InternalExecute_Implementation(const TScriptInterface<IZagalaSpecTaggedDataCacher> &AssignedCacher) override#

Satisfies IZagalaSpecChainLink; chain execution is driven by StartChain() and link callbacks instead.

Overridden to suppress the base class auto-failure behaviour.

virtual void InternalTeardown_Implementation() override#

Propagates Teardown() to all child links and resets bookkeeping state.

Protected Attributes

TArray<TObjectPtr<UObject>> Links#

Links executed sequentially by this chain.

TScriptInterface<IZagalaSpecTaggedDataCacher> ChainAssignedCacher#

Cacher passed to StartChain() and forwarded to each link.

int32 CurrentLinkIndex#

Index of the link currently executing.

int32 SucceededLinksCount#

Number of links that have succeeded in the current run.