Class UZagalaSpecContext#
Defined in File ZagalaSpecContext.h
Inheritance Relationships#
Base Types#
public UObjectpublic IZagalaSpecExecutionContext(Class IZagalaSpecExecutionContext)public IZagalaSpecStateQuerier(Class IZagalaSpecStateQuerier)public IZagalaSpecBroadcaster(Class IZagalaSpecBroadcaster)
Class Documentation#
-
class UZagalaSpecContext : public UObject, public IZagalaSpecExecutionContext, public IZagalaSpecStateQuerier, public IZagalaSpecBroadcaster#
Context is where a scenario is developed as a collection of expectations that can be executed.
It acts as a container for expectations and provides methods to fulfill them. The context drives its expectations through internal UZagalaSpecDefaultExecutionChainer and notifies its IZagalaSpecSubscriber subscribers (see IZagalaSpecBroadcaster::AddSubscriber) when it succeeds or fails. Extensions hook into the context lifecycle, running before each expectation pass and controlling whether additional passes are required.
Context flow is as follows (in the specified reading order):
(Setup) Setup is done in extensions. Setup is done in expectations.
(Develop) Clear data cache. 2.a: Execute is done in extensions. Execute is done in expectations. Teardown is done in expectations.
Any iteration controller (extension that implements that interface) has pending iteration?
YES: Clear data cache. Update iterations. Go back to 2.a.
NO: Teardown is done in extensions. Clear data cache.
If any step fails, teardown is done in chains.
IZagalaSpecExecutionContext
-
virtual void Setup(const TArray<TObjectPtr<UObject>> &ConfigExtensions = {}, const TArray<TObjectPtr<UObject>> &ConfigExpectations = {}) override#
Sets up the runtime extensions and expectations from the given config arrays.
- Parameters:
ConfigExtensions – The configured context extension steps.
ConfigExpectations – The configured expectation steps.
-
virtual void Develop(TOptional<TObjectPtr<UObject>> OptionalParameters = {}) override#
Develops the context by executing its runtime extensions and expectations, which are empty if no call to Setup() has been made yet.
- Parameters:
OptionalParameters – Optional parameters object for the development pass; unused by UZagalaSpecContext.
IZagalaSpecStateQuerier
-
virtual const TObjectPtr<UZagalaSpecExecutionState> GetExecutionState() const override#
Retrieves the current execution state.
- Returns:
The execution state object of the implementor.
IZagalaSpecBroadcaster
Subscribers receive HandleSuccessReceived when the context succeeds and HandleFailureReceived when it fails.
-
virtual void BroadcastSuccess() override#
Fires a success event, notifying all registered subscribers.
-
virtual void BroadcastFailure(const FString &Reason) override#
Fires a failure event, notifying all registered subscribers with a reason.
- Parameters:
Reason – A human-readable description of why the operation failed.
-
virtual void AddSubscriber(UObject *Subscriber) override#
Registers a subscriber to receive future broadcast events.
The object must implement IZagalaSpecSubscriber; non-implementing objects are silently ignored.
- Parameters:
Subscriber – The UObject implementing IZagalaSpecSubscriber to register.
-
virtual void RemoveSubscriber(UObject *Subscriber) override#
Unregisters a previously added subscriber from all broadcast events.
- Parameters:
Subscriber – The UObject to remove from event notifications.
Public Functions
-
UZagalaSpecContext(const FObjectInitializer &ObjectInitializer = FObjectInitializer::Get())#
-
virtual void PostInitProperties() override#
Protected Functions
-
void NonCdoSetup()#
Called once after construction (non-CDO path) to subscribe to sub-objects events.
-
void ClearCachedData()#
Removes all tagged data entries from the cache.
-
void InsertStepsIntoChain(const TArray<TObjectPtr<UObject>> &Steps, UZagalaSpecDefaultExecutionChainer *Chain)#
Inserts steps into the given execution chain.
Config steps are expanded into execution steps; execution steps are set up before being added.
- Parameters:
Steps – The configured step objects to insert. Invalid entries are skipped.
Chain – The execution chain that receives the steps.
-
virtual void HandleSuccess()#
Handles the successful completion of the context.
-
virtual void HandleFailure(const FString &Reason)#
Handles the failure of the context.
- Parameters:
Reason – The reason for the failure.
Protected Attributes
-
TObjectPtr<UZagalaSpecTaggedDataCache> DataCache#
Tagged-data cache shared by the extension and expectation chains; reset on each Develop().
-
TObjectPtr<UZagalaSpecDefaultExecutionChainer> ExtensionChain#
Chain that drives sequential execution of context extensions.
Accessible to subclasses.
-
TObjectPtr<UZagalaSpecDefaultExecutionChainer> ExpectationChain#
Chain that drives sequential execution of expectations.
Accessible to subclasses.