dnai::interfaces::ILoadingClass Class Referenceabstract

You can use this class in order to display the loading status or call a callback before, after each step or/and after all step. More...

#include <iloadingclass.h>

Inheritance diagram for dnai::interfaces::ILoadingClass:
Inheritance graph
Collaboration diagram for dnai::interfaces::ILoadingClass:
Collaboration graph

Public Types

enum  Status { UNDEFINED = 0, RUNNING, READY }
 Possible status of ILoading class. More...
 

Public Member Functions

float statusPercent () const
 Return the current status in percentage. More...
 
Status status () const
 Return the current status. More...
 
void registerBeforeStart (const std::function< void()> &func)
 Register a callback wich will be called before starting loading. More...
 
void registerReady (const std::function< void()> &func)
 Register a callback wich will be called after object was loaded. More...
 
void registerUpdateStatus (const std::function< void(float)> &func)
 Register a callback wich will be called each step of the loading. This function pass loading percentage at the callback function. More...
 
virtual ~ILoadingClass ()=default
 
void load ()
 Call this function in order to load the current object. More...
 

Protected Member Functions

 ILoadingClass ()
 
virtual std::queue< std::function< void()> > init ()=0
 You need to implement this function in order to define the loading steps. More...
 
void execAllEvent ()
 Execute all register callback of the current state. More...
 

Private Attributes

float m_statusPercent
 
Status m_status
 
std::map< Status, std::queue< std::function< void()> > > m_registeredEvents
 

Detailed Description

You can use this class in order to display the loading status or call a callback before, after each step or/and after all step.

Member Enumeration Documentation

Possible status of ILoading class.

Enumerator
UNDEFINED 
RUNNING 
READY 

Constructor & Destructor Documentation

dnai::interfaces::ILoadingClass::ILoadingClass ( )
inlineprotected
virtual dnai::interfaces::ILoadingClass::~ILoadingClass ( )
virtualdefault

Member Function Documentation

void dnai::interfaces::ILoadingClass::execAllEvent ( )
inlineprotected

Execute all register callback of the current state.

virtual std::queue<std::function<void()> > dnai::interfaces::ILoadingClass::init ( )
protectedpure virtual

You need to implement this function in order to define the loading steps.

Returns

Implemented in dnai::App.

void dnai::interfaces::ILoadingClass::load ( )
inline

Call this function in order to load the current object.

void dnai::interfaces::ILoadingClass::registerBeforeStart ( const std::function< void()> &  func)
inline

Register a callback wich will be called before starting loading.

Parameters
func
void dnai::interfaces::ILoadingClass::registerReady ( const std::function< void()> &  func)
inline

Register a callback wich will be called after object was loaded.

Parameters
func
void dnai::interfaces::ILoadingClass::registerUpdateStatus ( const std::function< void(float)> &  func)
inline

Register a callback wich will be called each step of the loading. This function pass loading percentage at the callback function.

Parameters
func
Status dnai::interfaces::ILoadingClass::status ( ) const
inline

Return the current status.

Returns
Status
float dnai::interfaces::ILoadingClass::statusPercent ( ) const
inline

Return the current status in percentage.

Returns
float

Member Data Documentation

std::map<Status, std::queue<std::function<void()> > > dnai::interfaces::ILoadingClass::m_registeredEvents
private
Status dnai::interfaces::ILoadingClass::m_status
private
float dnai::interfaces::ILoadingClass::m_statusPercent
private

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