41 #ifndef _doublebufferedresource_h
42 #define _doublebufferedresource_h
88 }
catch(std::exception& e){
90 {
delete ResourceA; ResourceA=0; }
92 {
delete ResourceB; ResourceB=0; }
106 { std::swap(ResourceA,ResourceB); }
111 {
return ResourceA; }
116 {
return ResourceB; }
121 {
return *ResourceA; }
126 {
return *ResourceB; }
149 std::vector<ConvertiblePointer> ThreadResources;
161 template <
typename DBR>
163 {
return *((DBR*)(this->ThreadResources[ResourceID])); }
168 Logger& GetUsableLogger();
179 Whole GetLastFrameTime()
const;
182 Whole GetLastPauseTime()
const;
185 MaxInt GetCurrentFrameStart()
const;
188 void SwapAllBufferedResources();
std::stringstream Logger
In case we ever replace the stringstream with another class, this will allow us to swap it out...
static const Whole DBRInvalid
Double buffered resources are identified by a Whole which is their type ID, This number identifies an...
DoubleBufferedResource(T *Current, T *Buffer)
A constructor that takes ownership of the the resources passed.
All the definitions for datatypes as well as some basic conversion functions are defined here...
DoubleBufferedResource< std::stringstream > DoubleBufferedLogger
A better default name for the Default Logger instance.
DoubleBufferedResource()
A Constructor that creates default versions of the resources.
void SwapUsableAndCommitable()
Make the buffered resource the active and vice versa.
static const Whole DBRLogger
Double buffered resources are identified by a Whole which is their type ID, This number identifies lo...
A thread specific collection of double-buffered and algorithm specific resources. ...
T & GetCommittable()
Get a reference to the resource that can be committed.
Use this to change the default resource type.
static const Whole DBRUser
Double buffered resources are identified by a Whole which is their type ID, All System Type IDs will ...
ThreadSpecificStorage Type
A single point at which all the thread specific resources can be changed.
This is central object in this algorithm, it is responsible for spawning threads and managing the ord...
A thread specific resource that uses double buffering to avoid multithreaded synchronization mechanis...
T * GetCommittablePointer() const
Get a pointer to the resource that can be committed.
~DoubleBufferedResource()
Destructor, this deletes both the resources managed. Regardless of how it got a hold of the pointers...
T * GetUsablePointer() const
Get a pointer to the resource that can be used.
long long MaxInt
A large integer type suitable for compile time math and long term microsecond time keeping...
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
T & GetUsable()
Get a reference to the resource that can be used.
DBR & GetResource(const Whole &ResourceID)
Get a Specific kind of double buffered resource.