Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | List of all members
Mezzanine::Threading::ThreadSpecificStorage Class Reference

A thread specific collection of double-buffered and algorithm specific resources. More...

#include <doublebufferedresource.h>

Public Member Functions

 ThreadSpecificStorage (FrameScheduler *Scheduler_)
 A constructor that automatically creates the resources it supports.
 
virtual ~ThreadSpecificStorage ()
 Deletes all the resources.
 
MaxInt GetCurrentFrameStart () const
 When did this frame start? More...
 
FrameSchedulerGetFrameScheduler ()
 Get a pointer to the FrameScheduler that owns this resource. More...
 
Whole GetLastFrameTime () const
 How long was the previous frame? More...
 
Whole GetLastPauseTime () const
 How long was the pause, if any, last frame? More...
 
template<typename DBR >
DBR & GetResource (const Whole &ResourceID)
 Get a Specific kind of double buffered resource. More...
 
LoggerGetUsableLogger ()
 Get the usable logger for this thread specific resource. More...
 
void SwapAllBufferedResources ()
 The commitable and usable version of every double buffered resource for this thread specific storage will be swapped.
 

Detailed Description

A thread specific collection of double-buffered and algorithm specific resources.

This class is intended to be expanded via derived classes if it is to return extra resource types

Definition at line 145 of file doublebufferedresource.h.

Member Function Documentation

MaxInt Mezzanine::Threading::ThreadSpecificStorage::GetCurrentFrameStart ( ) const

When did this frame start?

Returns
A MaxInt with the timestamp corresponding to when this frame started.

Definition at line 73 of file doublebufferedresource.cpp.

FrameScheduler * Mezzanine::Threading::ThreadSpecificStorage::GetFrameScheduler ( )

Get a pointer to the FrameScheduler that owns this resource.

This is not required very often by application code, but is used in places in this scheduler library. This is primarily used to gain access to commitable parts of double buffered resources. This pointer does not confer ownership.

Returns
A pointer to the FrameScheduler that owns this resource.

Definition at line 64 of file doublebufferedresource.cpp.

Whole Mezzanine::Threading::ThreadSpecificStorage::GetLastFrameTime ( ) const

How long was the previous frame?

Returns
A Whole containing the duration of the last frame.

Definition at line 67 of file doublebufferedresource.cpp.

Whole Mezzanine::Threading::ThreadSpecificStorage::GetLastPauseTime ( ) const

How long was the pause, if any, last frame?

Returns
A whole containing the duration of the last pause.

Definition at line 70 of file doublebufferedresource.cpp.

template<typename DBR >
DBR& Mezzanine::Threading::ThreadSpecificStorage::GetResource ( const Whole ResourceID)
inline

Get a Specific kind of double buffered resource.

Parameters
ResourceIDThe ID the resource provided.
Returns
A reference to the resource if it exists, or undefined behavior and maybe an exception if it doesn't.

Definition at line 162 of file doublebufferedresource.h.

Logger & Mezzanine::Threading::ThreadSpecificStorage::GetUsableLogger ( )

Get the usable logger for this thread specific resource.

Returns
A reference to the logger.
Note
A function like this should be provided for any other resources added to derived versions of this class. This encourages getting resources for this thread, and not providing a method to get the commitable resource gently discourages doing it unless its really required.

Definition at line 61 of file doublebufferedresource.cpp.


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