Beatmup
Internal::Recycler Class Reference

A task to empty the recycle bin. More...

Inheritance diagram for Internal::Recycler:
Beatmup::AbstractTask Beatmup::Object

Public Member Functions

 Recycler (std::vector< RecycleBin::Item * > &items)
 
TaskDeviceRequirement getUsedDevices () const
 Communicates devices (CPU and/or GPU) the task is run on. More...
 
bool process (TaskThread &thread)
 Executes the task on CPU within a given thread. More...
 
bool processOnGPU (GraphicPipeline &gpu, TaskThread &thread)
 Executes the task on GPU. More...
 
- Public Member Functions inherited from Beatmup::AbstractTask
virtual void beforeProcessing (ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu)
 Instruction called before the task is executed. More...
 
virtual void afterProcessing (ThreadIndex threadCount, GraphicPipeline *gpu, bool aborted)
 Instruction called after the task is executed. More...
 
virtual ThreadIndex getMaxThreads () const
 Gives the upper limint on the number of threads the task may be performed by. More...
 
- Public Member Functions inherited from Beatmup::Object
virtual ~Object ()
 

Private Attributes

std::vector< RecycleBin::Item * > & items
 

Additional Inherited Members

- Public Types inherited from Beatmup::AbstractTask
enum class  TaskDeviceRequirement { CPU_ONLY , GPU_OR_CPU , GPU_ONLY }
 Specifies which device (CPU and/or GPU) is used to run the task. More...
 
- Static Public Member Functions inherited from Beatmup::AbstractTask
static ThreadIndex validThreadCount (int number)
 Valid thread count from a given integer value. More...
 

Detailed Description

A task to empty the recycle bin.

Definition at line 31 of file recycle_bin.cpp.

Constructor & Destructor Documentation

◆ Recycler()

Internal::Recycler::Recycler ( std::vector< RecycleBin::Item * > &  items)
inline

Definition at line 36 of file recycle_bin.cpp.

36 : items(items) {}
std::vector< RecycleBin::Item * > & items
Definition: recycle_bin.cpp:33

Member Function Documentation

◆ getUsedDevices()

TaskDeviceRequirement Internal::Recycler::getUsedDevices ( ) const
inlinevirtual

Communicates devices (CPU and/or GPU) the task is run on.

Reimplemented from Beatmup::AbstractTask.

Definition at line 39 of file recycle_bin.cpp.

39  {
41  }
@ GPU_OR_CPU
this task uses GPU if it is available, but CPU fallback is possible

◆ process()

bool Internal::Recycler::process ( TaskThread thread)
inlinevirtual

Executes the task on CPU within a given thread.

Generally called by multiple threads.

Parameters
threadassociated task execution context
Returns
true if the execution is finished correctly, false otherwise

Implements Beatmup::AbstractTask.

Definition at line 44 of file recycle_bin.cpp.

44  {
45  return true;
46  }

◆ processOnGPU()

bool Internal::Recycler::processOnGPU ( GraphicPipeline gpu,
TaskThread thread 
)
inlinevirtual

Executes the task on GPU.

Parameters
gpugraphic pipeline instance
threadassociated task execution context
Returns
true if the execution is finished correctly, false otherwise

Reimplemented from Beatmup::AbstractTask.

Definition at line 49 of file recycle_bin.cpp.

49  {
50  for (auto& item : items) {
51  RecycleBin::Item* deleting = item;
52  item = nullptr;
53  if (deleting)
54  delete deleting;
55  }
56  items.clear();
57  return true;
58  }
A wrapper for a GPU resource.
Definition: recycle_bin.h:39

Member Data Documentation

◆ items

std::vector<RecycleBin::Item*>& Internal::Recycler::items
private

Definition at line 33 of file recycle_bin.cpp.


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