HoverRace  2.0
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
HoverRace::Util::Loader Class Reference

Queue of resource loaders. More...

#include <Loader.h>

Public Types

using finishedLoadingSignal_t = boost::signals2::signal< void()>
 

Public Member Functions

 Loader ()
 
 ~Loader ()
 
template<class Fn >
void AddLoader (const std::string &s, Fn fn)
 Add a new named loader. More...
 
template<class Fn >
void AddLoader (Fn fn)
 Add a new unnamed loader. More...
 
void FireFinishedLoadingSignal ()
 
finishedLoadingSignal_tGetFinishedLoadingSignal ()
 Fired when all resources have been loaded and the loading scene is shutting down. More...
 
bool IsEmpty () const
 
bool LoadNext ()
 Load the next item. More...
 

Private Types

using loader_t = std::pair< std::string, std::function< void()>>
 

Private Attributes

finishedLoadingSignal_t finishedLoadingSignal
 
std::queue< loader_tloaders
 

Detailed Description

Queue of resource loaders.

Author
Michael Imamura

Member Typedef Documentation

using HoverRace::Util::Loader::finishedLoadingSignal_t = boost::signals2::signal<void()>
using HoverRace::Util::Loader::loader_t = std::pair<std::string, std::function<void()>>
private

Constructor & Destructor Documentation

HoverRace::Util::Loader::Loader ( )
inline
HoverRace::Util::Loader::~Loader ( )
inline

Member Function Documentation

template<class Fn >
void HoverRace::Util::Loader::AddLoader ( const std::string &  s,
Fn  fn 
)
inline

Add a new named loader.

The loader name is used for logging purposes only.

Parameters
sThe name of the loader.
fnThe loader function.
template<class Fn >
void HoverRace::Util::Loader::AddLoader ( Fn  fn)
inline

Add a new unnamed loader.

Parameters
fnThe loader function.
void HoverRace::Util::Loader::FireFinishedLoadingSignal ( )
inline
finishedLoadingSignal_t& HoverRace::Util::Loader::GetFinishedLoadingSignal ( )
inline

Fired when all resources have been loaded and the loading scene is shutting down.

Returns
The finished loading signal.
bool HoverRace::Util::Loader::IsEmpty ( ) const
inline
bool HoverRace::Util::Loader::LoadNext ( )
inline

Load the next item.

If all of the loaders have been executed, then the finishedLoadingSignal will *not* be fired automatically, since the owner of the loader may want to perform some actions before notifying the listeners.

Returns
true if there are any loaders remaining, false if all loaders have executed.

Member Data Documentation

finishedLoadingSignal_t HoverRace::Util::Loader::finishedLoadingSignal
private
std::queue<loader_t> HoverRace::Util::Loader::loaders
private

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