Shkyera Engine
Easy to use, game engine for Python
Loading...
Searching...
No Matches
shkyera::JobSystem::JobBuilder Class Reference

#include <JobSystem.hpp>

Public Member Functions

 JobBuilder (JobExecutor function)
 
 ~JobBuilder ()=default
 
 JobBuilder (const JobBuilder &)=delete
 
JobBuilderoperator= (const JobBuilder &)=delete
 
 JobBuilder (JobBuilder &&)=delete
 
JobBuilderoperator= (JobBuilder &&)=delete
 
JobBuilderdependsOn (JobHandle handle)
 
template<typename ResourceType >
JobBuilderreadResource ()
 
template<typename ResourceType >
JobBuilderwriteResource ()
 
JobBuilderreadResource (TypeID typeId)
 
JobBuilderwriteResource (TypeID typeId)
 
void useMainThread ()
 
JobHandle submit ()
 

Private Attributes

Job _job
 

Detailed Description

Builder class for constructing and configuring jobs.

Constructor & Destructor Documentation

◆ JobBuilder() [1/3]

shkyera::JobBuilder::JobBuilder ( JobExecutor  function)

Constructs a job builder with the given executor function. The function will be executed when the job runs.

Parameters
functionThe function to be executed by the job

◆ ~JobBuilder()

shkyera::JobSystem::JobBuilder::~JobBuilder ( )
default

◆ JobBuilder() [2/3]

shkyera::JobSystem::JobBuilder::JobBuilder ( const JobBuilder )
delete

◆ JobBuilder() [3/3]

shkyera::JobSystem::JobBuilder::JobBuilder ( JobBuilder &&  )
delete

Member Function Documentation

◆ dependsOn()

JobBuilder & shkyera::JobBuilder::dependsOn ( JobHandle  handle)

Adds a dependency to the job. The job will not execute until all its dependencies have completed.

Parameters
handleHandle of the job this job depends on
Returns
Reference to this builder for chaining

◆ operator=() [1/2]

JobBuilder & shkyera::JobSystem::JobBuilder::operator= ( const JobBuilder )
delete

◆ operator=() [2/2]

JobBuilder & shkyera::JobSystem::JobBuilder::operator= ( JobBuilder &&  )
delete

◆ readResource() [1/2]

template<typename ResourceType >
JobBuilder & shkyera::JobSystem::JobBuilder::readResource ( )
inline

Specifies a resource that the job needs to read. The job will not execute if any other job is currently writing to this resource.

Template Parameters
ResourceTypeType of the resource to read
Returns
Reference to this builder for chaining

◆ readResource() [2/2]

JobBuilder & shkyera::JobSystem::JobBuilder::readResource ( TypeID  typeId)
inline

Specifies a resource by ID that the job needs to read.

Parameters
typeIdID of the resource to read
Returns
Reference to this builder for chaining

◆ submit()

JobHandle shkyera::JobBuilder::submit ( )

Submits the configured job to the system.

Returns
Handle to the submitted job

◆ useMainThread()

void shkyera::JobSystem::JobBuilder::useMainThread ( )
inline

Forces the job to run on the main thread.

Returns
Reference to this builder for chaining

◆ writeResource() [1/2]

template<typename ResourceType >
JobBuilder & shkyera::JobSystem::JobBuilder::writeResource ( )
inline

Specifies a resource that the job needs to write. The job will not execute if any other job is currently reading or writing to this resource.

Template Parameters
ResourceTypeType of the resource to write
Returns
Reference to this builder for chaining

◆ writeResource() [2/2]

JobBuilder & shkyera::JobSystem::JobBuilder::writeResource ( TypeID  typeId)
inline

Specifies a resource by ID that the job needs to write. This is used for dynamic resource types that aren't known at compile time.

Parameters
typeIdID of the resource to write
Returns
Reference to this builder for chaining

Member Data Documentation

◆ _job

Job shkyera::JobSystem::JobBuilder::_job
private

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