Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Olympe::IAtomicTask Class Referenceabstract

Abstract interface for a single atomic unit of work. More...

#include <IAtomicTask.h>

+ Inheritance diagram for Olympe::IAtomicTask:

Public Types

using ParameterMap = std::unordered_map< std::string, TaskValue >
 Convenience alias for the parameter map passed to Execute().
 

Public Member Functions

virtual ~IAtomicTask ()=default
 
virtual TaskStatus Execute (const ParameterMap &params)=0
 Executes the atomic task for one frame.
 
virtual TaskStatus ExecuteWithContext (const AtomicTaskContext &ctx, const ParameterMap &params)
 Executes the atomic task for one frame with full runtime context.
 
virtual void Abort ()=0
 Aborts the task, releasing any in-progress state.
 

Detailed Description

Abstract interface for a single atomic unit of work.

Implement Execute() to perform the task logic and Abort() to release any resources or state when the task is interrupted before completion. Tasks receive their parameters as a map of TaskValue instances keyed by parameter name.

Example:

class Task_MyTask : public IAtomicTask {
public:
TaskStatus Execute(const ParameterMap& params) override { ... }
void Abort() override { ... }
};
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
Abstract interface for a single atomic unit of work.
Definition IAtomicTask.h:63
std::unordered_map< std::string, TaskValue > ParameterMap
Convenience alias for the parameter map passed to Execute().
Definition IAtomicTask.h:67
TaskStatus
Result code returned by IAtomicTask::Execute().
Definition IAtomicTask.h:38

Definition at line 63 of file IAtomicTask.h.

Member Typedef Documentation

◆ ParameterMap

using Olympe::IAtomicTask::ParameterMap = std::unordered_map<std::string, TaskValue>

Convenience alias for the parameter map passed to Execute().

Definition at line 67 of file IAtomicTask.h.

Constructor & Destructor Documentation

◆ ~IAtomicTask()

virtual Olympe::IAtomicTask::~IAtomicTask ( )
virtualdefault

Member Function Documentation

◆ Abort()

virtual void Olympe::IAtomicTask::Abort ( )
pure virtual

Aborts the task, releasing any in-progress state.

Called by the TaskSystem when execution is interrupted (e.g. a parent node is aborted or a new graph is bound while a task is Running). Concrete tasks must implement this to clean up timers, reservations, animations, or any other side-effects started in Execute().

Implemented in Olympe::Task_ChangeState, Olympe::Task_Flee, Olympe::Task_GotoPosition, Olympe::Task_RequestPathfinding, Olympe::Task_SetAnimation, Olympe::Task_Compare, Olympe::Task_SetVariable, Olympe::Task_Attack, Olympe::Task_Flee, Olympe::Task_MoveToLocation, Olympe::Task_PlayAnimation, Olympe::Task_SetSprite, Olympe::Task_ChangeState, Olympe::Task_GetDeltaTime, Olympe::Task_GetWorldInstance, Olympe::Task_SetPosition, Olympe::Task_LogMessage, and Olympe::Task_Wait.

◆ Execute()

virtual TaskStatus Olympe::IAtomicTask::Execute ( const ParameterMap params)
pure virtual

Executes the atomic task for one frame.

Parameters
paramsNamed parameters provided by the task graph node.
Returns
TaskStatus::Success, Failure, or Running. Returning Running causes the task to be ticked again next frame.

Implemented in Olympe::Task_ChangeState, Olympe::Task_Flee, Olympe::Task_GotoPosition, Olympe::Task_RequestPathfinding, Olympe::Task_SetAnimation, Olympe::Task_Compare, Olympe::Task_SetVariable, Olympe::Task_Attack, Olympe::Task_Flee, Olympe::Task_MoveToLocation, Olympe::Task_PlayAnimation, Olympe::Task_SetSprite, Olympe::Task_ChangeState, Olympe::Task_GetDeltaTime, Olympe::Task_GetWorldInstance, Olympe::Task_SetPosition, Olympe::Task_LogMessage, and Olympe::Task_Wait.

Referenced by ExecuteWithContext().

+ Here is the caller graph for this function:

◆ ExecuteWithContext()

virtual TaskStatus Olympe::IAtomicTask::ExecuteWithContext ( const AtomicTaskContext ctx,
const ParameterMap params 
)
inlinevirtual

Executes the atomic task for one frame with full runtime context.

New tasks should override this method to access the richer context (World pointer, LocalBlackboard, EntityID, dt, StateTimer). The default implementation simply forwards to Execute(params) so all existing tasks remain compatible without any changes.

Parameters
ctxRuntime context for this tick (Entity, World*, LocalBB, dt, StateTimer).
paramsNamed parameters provided by the task graph node.
Returns
TaskStatus::Success, Failure, or Running.

Reimplemented in Olympe::Task_ChangeState, Olympe::Task_Flee, Olympe::Task_GotoPosition, Olympe::Task_RequestPathfinding, Olympe::Task_SetAnimation, Olympe::Task_Compare, Olympe::Task_SetVariable, Olympe::Task_Attack, Olympe::Task_Flee, Olympe::Task_MoveToLocation, Olympe::Task_PlayAnimation, Olympe::Task_SetSprite, Olympe::Task_ChangeState, Olympe::Task_GetDeltaTime, Olympe::Task_GetWorldInstance, Olympe::Task_SetPosition, and Olympe::Task_Wait.

Definition at line 93 of file IAtomicTask.h.

References Execute(), and GetComponentTypeID_Static().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: