|
Go to the source code of this file.
Classes | |
class | TfStaticData< T, Factory > |
Create or return a previously created object instance of global data. More... | |
Macros | |
#define | TF_MAKE_STATIC_DATA(Type, Name) |
Create a static data object, initializing it with code. | |
#define TF_MAKE_STATIC_DATA | ( | Type, | |
Name | |||
) |
Create a static data object, initializing it with code.
The macro takes two arguments. The first is the type of static data, the second is the name of the variable. The block of code following the macro will be invoked to initialize the static data when it is first used. See example usage:
If the type uses commas to separate template arguments you need to enclose the type in parentheses as shown in the last example.
If the data does not need to be mutated after initialization, you may specify a const type. The underlying data is non-const but the TfStaticData accessors only provide const access.
Note that this macro may only be used at namespace scope (not function scope).
Also note that in multithreaded code, it is possible for the provided code to be invoked more than once (with different target objects) for the same static data instance. This is fine as long as the initialization code does not have side-effects, but you should be aware of it.
Definition at line 181 of file staticData.h.