Open 3D Engine GridMate API Reference  2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
GridMate::ReplicaTask Class Referenceabstract

#include <ReplicaTask.h>

Inherited by GridMate::ReplicaDestroyPeerTask, GridMate::ReplicaMarshalTaskBase, and GridMate::ReplicaUpdateTaskBase.

Classes

struct  RunContext
 

Public Types

enum  TaskStatus { Done, Repeat }
 
typedef AZ::u64 PriorityType
 

Public Member Functions

virtual TaskStatus Run (const RunContext &context)=0
 
void Cancel ()
 
bool IsCancelled () const
 
unsigned int GetAge () const
 
void SetAge (unsigned int age)
 
ReplicaPtr GetReplica () const
 
void SetPriority (PriorityType priority)
 
PriorityType GetPriority () const
 

Static Public Attributes

static const unsigned int k_ageScale = 10
 

Protected Attributes

ReplicaPtr m_replica
 

Detailed Description

Base class for the all tasks in task system. Every subclassed class should implement GetPriority() and Run() methods to be able to be queued and executed from within TaskSystem.

Member Function Documentation

◆ Cancel()

void GridMate::ReplicaTask::Cancel ( )
inline

This method sets cancelled state on the task. The task will not be executed and will be deleted on next TaskManager's tick. The task will be deleted upon completion when it's cancelled while executing.

◆ GetAge()

unsigned int GridMate::ReplicaTask::GetAge ( ) const
inline

Returns 'age' of the task. Age indicates for how many frame ticks this task was postponed.

◆ GetPriority()

PriorityType GridMate::ReplicaTask::GetPriority ( ) const
inline

Returns a cached priority for a task

◆ GetReplica()

ReplicaPtr GridMate::ReplicaTask::GetReplica ( ) const
inline

Returns replica associated with the task, nullptr if task is not bound to any replica

◆ IsCancelled()

bool GridMate::ReplicaTask::IsCancelled ( ) const
inline

Indicates whether the task is cancelled.

Returns
true if cancelled, false otherwise

◆ Run()

virtual TaskStatus GridMate::ReplicaTask::Run ( const RunContext context)
pure virtual

Called when task is executed

Parameters
contextexecution context, provides access to ReplicaManager and TaskManager
Returns
TaskStatus::Done if task is completed, TaskStatus::Repeat if task needs to be repeated next tick.

Implemented in GridMate::ReplicaDestroyPeerTask, GridMate::ReplicaMarshalZombieTask, GridMate::ReplicaUpdateDestroyedProxyTask, GridMate::ReplicaMarshalTask, and GridMate::ReplicaUpdateTask.

◆ SetAge()

void GridMate::ReplicaTask::SetAge ( unsigned int  age)
inline

Setter for age. Typically age is only modified by task manager.

◆ SetPriority()

void GridMate::ReplicaTask::SetPriority ( PriorityType  priority)
inline

Saves priority in a task.


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