ZFFramework
Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions
ZFCoreGlobalInitializer.h File Reference

global initializer step More...

#include "ZFLevel.h"
#include "ZFCoreStaticRegister.h"
#include "ZFCoreArray.h"

Go to the source code of this file.

Macros

#define ZFFrameworkInitFinishCallbacks
 called when ZFFrameworkInit finished
 
#define ZFFrameworkCleanupPrepareCallbacks
 called when ZFFrameworkInit finished
 
#define ZFTOKEN_ZFFrameworkStateNotAvailable
 string tokens
 
#define ZFTOKEN_ZFFrameworkStateInitProcessing
 string tokens
 
#define ZFTOKEN_ZFFrameworkStateAvailable
 string tokens
 
#define ZFTOKEN_ZFFrameworkStateCleanupProcessing
 string tokens
 
#define ZF_GLOBAL_INITIALIZER_INIT_WITH_LEVEL(Name, ZFLevel_)
 code block that will be executed when app start and stop
 
#define ZF_GLOBAL_INITIALIZER_INIT(Name)
 see ZF_GLOBAL_INITIALIZER_INIT_WITH_LEVEL
 
#define ZF_GLOBAL_INITIALIZER_DESTROY(Name)
 see ZF_GLOBAL_INITIALIZER_INIT_WITH_LEVEL
 
#define ZF_GLOBAL_INITIALIZER_END(Name)
 see ZF_GLOBAL_INITIALIZER_INIT_WITH_LEVEL
 
#define ZF_GLOBAL_INITIALIZER_INSTANCE(Name)
 access the instance of the initializer
 
#define ZF_GLOBAL_INITIALIZER_CLASS(Name)
 the class holder of the global initializer
 

Typedefs

typedef void(* ZFFrameworkStateChangeCallback) (void)
 see ZFFrameworkInit
 

Enumerations

enum  ZFFrameworkState { ZFFrameworkStateNotAvailable , ZFFrameworkStateInitProcessing , ZFFrameworkStateAvailable , ZFFrameworkStateCleanupProcessing }
 state for ZFFramework More...
 

Functions

void ZFFrameworkInit (void)
 must be called in main thread before any access of ZFFramework member
 
void ZFFrameworkCleanup (void)
 see ZFFrameworkInit
 
void ZFFrameworkAssertInit (void)
 assert fail and output log if ZFFramework not initialized
 
ZFFrameworkState ZFFrameworkStateCheck (void)
 get current state of ZFFramework
 
ZFFrameworkState ZFFrameworkStateCheck (ZFLevel level)
 get current state of ZFFramework of specified level
 

Detailed Description

global initializer step

Macro Definition Documentation

◆ ZF_GLOBAL_INITIALIZER_INIT_WITH_LEVEL

#define ZF_GLOBAL_INITIALIZER_INIT_WITH_LEVEL ( Name,
ZFLevel_ )

code block that will be executed when app start and stop

usage:

// in a *.cpp file
: data('c') // you can init member here
{
// code that will be executed when app start
}
// code that will be executed when app stop
}
private:
zfchar data; // you can add member here
private:
void func() {} // you can add function here
#define ZF_GLOBAL_INITIALIZER_INIT(Name)
see ZF_GLOBAL_INITIALIZER_INIT_WITH_LEVEL
Definition ZFCoreGlobalInitializer.h:164
#define ZF_GLOBAL_INITIALIZER_DESTROY(Name)
see ZF_GLOBAL_INITIALIZER_INIT_WITH_LEVEL
Definition ZFCoreGlobalInitializer.h:173
#define ZF_GLOBAL_INITIALIZER_END(Name)
see ZF_GLOBAL_INITIALIZER_INIT_WITH_LEVEL
Definition ZFCoreGlobalInitializer.h:187
_ZFT_t_zfchar zfchar
char wrapper
Definition ZFCoreTypeDef_CharType.h:17


Warning
if you have more than one initializer with same level, the execute order of the code block is not ensured
init and destroy step is not one time, they'll be called each time ZFFrameworkInit/ZFFrameworkCleanup is called
Note
see ZF_STATIC_REGISTER_INIT for recommended usage

Enumeration Type Documentation

◆ ZFFrameworkState

state for ZFFramework

Enumerator
ZFFrameworkStateNotAvailable 

not available

ZFFrameworkStateInitProcessing 

during init step (ZFFrameworkInit)

ZFFrameworkStateAvailable 

available, init finished

ZFFrameworkStateCleanupProcessing 

during cleanup step (ZFFrameworkCleanup)

Function Documentation

◆ ZFFrameworkInit()

void ZFFrameworkInit ( void )
extern

must be called in main thread before any access of ZFFramework member

usually, this would been done by implementation of ZFFramework

ADVANCED:
if you want to dynamically load other libs written in ZFFramework after ZFFramework's main lib initialized: