Lib
QOLを高める
Public Member Functions | Protected Member Functions | List of all members
yappy::framework::scene::AsyncLoadScene Class Referenceabstract

Scene class with an async loading task. More...

#include <framework.h>

Inheritance diagram for yappy::framework::scene::AsyncLoadScene:
yappy::framework::scene::SceneBase yappy::util::noncopyable

Public Member Functions

 AsyncLoadScene ()=default
 Constructor (default). More...
 
virtual ~AsyncLoadScene () override
 Destructor. More...
 
virtual void update () final override
 Check the state of sub thread and then call updateOnMainThread(). More...
 
- Public Member Functions inherited from yappy::framework::scene::SceneBase
 SceneBase ()=default
 Constructor (default). More...
 
virtual ~SceneBase ()=default
 Virtual Destructor (default). More...
 
virtual void render ()=0
 Rendering. More...
 

Protected Member Functions

virtual void loadOnSubThread (std::atomic_bool &cancel)=0
 User-defined async task. More...
 
virtual void updateOnMainThread ()=0
 Called in update() More...
 
void startLoadThread ()
 Starts async load task on another thread. More...
 
bool isLoading () const
 Poll the state of the async task. updateLoadStatus() is needed. More...
 

Detailed Description

Scene class with an async loading task.

Definition at line 93 of file framework.h.

Constructor & Destructor Documentation

yappy::framework::scene::AsyncLoadScene::AsyncLoadScene ( )
default

Constructor (default).

yappy::framework::scene::AsyncLoadScene::~AsyncLoadScene ( )
overridevirtual

Destructor.

If async task is being processed, sets cancel flag to true and blocks until task function will return.

Definition at line 55 of file framework.cpp.

Member Function Documentation

bool yappy::framework::scene::AsyncLoadScene::isLoading ( ) const
protected

Poll the state of the async task. updateLoadStatus() is needed.

Definition at line 100 of file framework.cpp.

virtual void yappy::framework::scene::AsyncLoadScene::loadOnSubThread ( std::atomic_bool &  cancel)
protectedpure virtual

User-defined async task.

This function will run on a separated thread and can take a long time to complete. If this class object is destructed while running, cancel flag which is passed by parameter will set to be true.

Parameters
[in]cancelCancel signal.
void yappy::framework::scene::AsyncLoadScene::startLoadThread ( )
protected

Starts async load task on another thread.

Precondition
Async task is not running. (isLoading() returns false.)

Definition at line 68 of file framework.cpp.

void yappy::framework::scene::AsyncLoadScene::update ( )
finaloverridevirtual

Check the state of sub thread and then call updateOnMainThread().

Implements yappy::framework::scene::SceneBase.

Definition at line 62 of file framework.cpp.

virtual void yappy::framework::scene::AsyncLoadScene::updateOnMainThread ( )
protectedpure virtual

Called in update()


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