base::Global Class Reference

Global class collects globals as members to determine their order of construction. More...

#include <base_global.hh>

List of all members.

Public Member Functions

 Global (void)

Public Attributes

bool mExiting
bool mTesting
Streams mStreams
Thread mThread
Random mRandom
bool mAssertAbort


Detailed Description

Global class collects globals as members to determine their order of construction.

Design philosophy is to minimize globals but make them explicit by putting them in a "global" namespace and using the qualifier "global::". The Singleton pattern or otherwise hiding globals is detrimental to thread-safety.

Global construction/destruction order: Some globals may depend on other globals being constructed first. C++ doesn't define the order which separate global variables are constructed. But the order of constructing class members is defined as the order in which they're declared (destruction order is defined as the reverse).

Global class vs. conventional singletons: Singleton disadvantages: tedious to write, obscure the fact they're globals. Singleton advantages: are initialized after load-time, solve run-time dependencies. Global class advantages: searchable, the order of initializing class members is defined. World::GetEdge(); // obscure global global::mWorld.GetEdge(); // obvious global


Constructor & Destructor Documentation

base::Global::Global ( void   )  [inline]


Member Data Documentation

bool base::Global::mExiting

bool base::Global::mTesting

Streams base::Global::mStreams

Thread base::Global::mThread

Random base::Global::mRandom

bool base::Global::mAssertAbort


The documentation for this class was generated from the following file: Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:19 2007