Sierra Toolkit
Version of the Day
|
Class Bootstrap serves as a bootstrapping mechanism for products in the sierra toolkit and elsewhere. More...
#include <Bootstrap.hpp>
Public Types | |
typedef void(* | FunctionPtr) () |
Public Member Functions | |
Bootstrap (void(*f)()) | |
Creates a new Bootstrap instance. More... | |
Static Public Member Functions | |
static void | bootstrap () |
Member function bootstrap runs through the stored bootstrap function pointers and executes each function. | |
Class Bootstrap serves as a bootstrapping mechanism for products in the sierra toolkit and elsewhere.
Often, it is convenient to have a product perform registrations and other operations when linked into an application. One method of accomplishing this is to utilize a static object whose constructor perform these operations. However, static constructions are executed prior to main and in non-deterministc order. The later is particularly problematic if the constructor results in the usage of another static object which may not have been constructed yet.
So, the Bootstrap class creates a stack of callback functions that are executed, by main(), when Bootstrap::bootstrap() is called. These functions are still executed in a non-deterministic order, but all static constructions have occurred.
Definition at line 35 of file Bootstrap.hpp.
stk_classic::Bootstrap::Bootstrap | ( | void(*)() | f | ) |
Creates a new Bootstrap instance.
The instance serves only to insert the specified function pointer to the bootstrap function list. If the bootstrapper has already been executed, the function is added to the list and executed immediately.
Definition at line 29 of file Bootstrap.cpp.