Setup
Prior to calling any other SDK function initialise the SDK. This must be done prior to any threads starting as it initialises global memory including error handling and logging. For convenience, initialisation also calls the init routines of underlying third-party libraries that are used.
In order
The application should first call ato_si_set() to describe itself to the SDK(s). For example:
ato_si_set(
"Your Organisation Name Here",
"ATO BASE Reference Client (C version)",
"0.6", buildtime, hash);
ATO_EXPORT int ato_si_set(const char *organisation, const char *product, const char *version, const char *timestamp, const char *source, const char *hash)
Set up the application information.
Initialise
The following initialises the base SDK. Note the "flag" parameter controls the underlying initialisation, although only ATO_BASE_INIT_ALL is currently supported.
ATO_EXPORT void ato_ctx_create(ato_Ctx **ctx, const char *id)
Create a context object for thread local storage - use ato_ctx_free() to free.
ATO_EXPORT int ato_base_init(ato_Ctx *ctx, unsigned short flag)
Initialise the SDK - see also ato_base_deinit().
#define ATO_ERR_OK
No error.
Definition: types.h:191
#define ATO_BASE_INIT_ALL
The ATO_BASE_INIT_... defines are used to control the initialisation that takes place.
Definition: types.h:158
struct _ato_Ctx ato_Ctx
The thread local context object.
Definition: types.h:91
Configuration
Some configuration may be done.
ATO_EXPORT ato_Log * ato_ctx_log_set(ato_Ctx *ctx, const char *id, const char *logindent, const char *logpath, const char *mode)
Set logging properties to control the behaviour of logging.
struct _ato_Log ato_Log
The log object.
Definition: log.h:57
Deinitialise
At the end of the program lifetime, and after all threads are finished, corresponding ctx free and deinitialization methods must be called.
ATO_EXPORT void ato_ctx_free(ato_Ctx *ctx)
Free the context object.
ATO_EXPORT void ato_base_deinit(void)
Deinitialise the SDK.
Note
ato_base_init() is an initialization routine that sets up global values common to multiple independent SDKs, and, as such it cannot easily be embedded within the init methods of the other SDKs. It should always be called separately and prior to any other SDK init method.