Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Files | Data Structures | Macros | Functions

Files

file  afw_flag.h
 Adaptive Framework Software Flag Header.
 

Data Structures

struct  afw_flag_s
 Struct used for a registered flag. More...
 

Macros

#define AFW_FLAG_INITIAL_ALLOCATED_COUNT   64
 
#define afw_flag_is_active(flag_index, xctx)   ((flag_index) < (xctx)->flags_count && (xctx)->flags[flag_index])
 Determine if flag for flag index is set in xctx. More...
 

Functions

afw_boolean_t afw_flag_by_id_is_active (const afw_utf8_t *flag_id, afw_xctx_t *xctx)
 Determine if flag for flag id is set in xctx. More...
 
const afw_flag_tafw_flag_get_by_index (afw_size_t flag_index, afw_xctx_t *xctx)
 Get flag by index. More...
 
afw_size_t afw_flag_get_index (const afw_utf8_t *flag_id, afw_xctx_t *xctx)
 Get the flag index for a flag id. More...
 
void afw_flag_set_default (const afw_utf8_t *flag_id, afw_boolean_t set_to, afw_xctx_t *xctx)
 Set the default value of a flag. More...
 
void afw_flag_set_default_flag_ids (const afw_list_t *default_flag_ids, afw_xctx_t *xctx)
 Set a new default flags list. More...
 
void afw_flag_set (const afw_utf8_t *flag_id, afw_boolean_t set_to, afw_xctx_t *xctx)
 Set a flag in xctx. More...
 
void afw_flag_set_to_defaults_plus_array (const afw_utf8_t *const *flag_ids, afw_xctx_t *xctx)
 Set xctx default flags plus one or more additional flags. More...
 
void afw_flag_environment_register_flag (const afw_utf8_t *flag_id, const afw_utf8_t *brief, const afw_utf8_t *description, const afw_utf8_t *included_by_flag_id, afw_xctx_t *xctx)
 Register a flag definition. More...
 
void afw_flag_add_included_by (const afw_utf8_t *flag_id, const afw_utf8_t *included_by_flag_id, afw_xctx_t *xctx)
 Add another include_by flag to a registered flag. More...
 
 afw_flag_internal_early_register_core (afw_xctx_t *xctx)
 

Detailed Description

Software flags.

Macro Definition Documentation

◆ afw_flag_is_active

#define afw_flag_is_active (   flag_index,
  xctx 
)    ((flag_index) < (xctx)->flags_count && (xctx)->flags[flag_index])

Determine if flag for flag index is set in xctx.

Parameters
flag_index
xctxof caller
Returns
true or false

Definition at line 84 of file afw_flag.h.

Function Documentation

◆ afw_flag_add_included_by()

void afw_flag_add_included_by ( const afw_utf8_t flag_id,
const afw_utf8_t included_by_flag_id,
afw_xctx_t xctx 
)

Add another include_by flag to a registered flag.

Parameters
flag_idof a registered flag.
included_by_flag_idof a registered flag.
xctxof caller.

Definition at line 688 of file afw_flag.c.

◆ afw_flag_by_id_is_active()

afw_boolean_t afw_flag_by_id_is_active ( const afw_utf8_t flag_id,
afw_xctx_t xctx 
)

Determine if flag for flag id is set in xctx.

Parameters
flag_id
xctxof caller
Returns
true or false

Definition at line 565 of file afw_flag.c.

◆ afw_flag_environment_register_flag()

void afw_flag_environment_register_flag ( const afw_utf8_t flag_id,
const afw_utf8_t brief,
const afw_utf8_t description,
const afw_utf8_t included_by_flag_id,
afw_xctx_t xctx 
)

Register a flag definition.

Parameters
flag_id.
brief.
description.
included_by_flag_id
log_priorityto be used if this flag triggers a log message.
xctxof caller.

Definition at line 579 of file afw_flag.c.

◆ afw_flag_get_by_index()

const afw_flag_t* afw_flag_get_by_index ( afw_size_t  flag_index,
afw_xctx_t xctx 
)

Get flag by index.

Parameters
flag_index
xctxof caller
Returns
flag struct or NULL if not found.

Definition at line 534 of file afw_flag.c.

◆ afw_flag_get_index()

afw_size_t afw_flag_get_index ( const afw_utf8_t flag_id,
afw_xctx_t xctx 
)

Get the flag index for a flag id.

Parameters
flag_id
xctxof caller
Returns
The flag index or throws error if not found.

Definition at line 546 of file afw_flag.c.

◆ afw_flag_set()

void afw_flag_set ( const afw_utf8_t flag_id,
afw_boolean_t  set_to,
afw_xctx_t xctx 
)

Set a flag in xctx.

Parameters
flag_index
set_totrue to set or false to unset
xctxof caller

Definition at line 780 of file afw_flag.c.

◆ afw_flag_set_default()

void afw_flag_set_default ( const afw_utf8_t flag_id,
afw_boolean_t  set_to,
afw_xctx_t xctx 
)

Set the default value of a flag.

Parameters
flag_idof flag to set as default. The flag must already be registered.
set_totrue to set or false to unset
xctxof caller.

This function only sets the flag as a default until the environment is refreshed. Add this flag to the defaultFlags property of the application conf to make it permanent.

Todo:
FIXME: Add authorization to set flag

Definition at line 717 of file afw_flag.c.

◆ afw_flag_set_default_flag_ids()

void afw_flag_set_default_flag_ids ( const afw_list_t default_flag_ids,
afw_xctx_t xctx 
)

Set a new default flags list.

Parameters
default_flag_idslist.
xctxof caller

The is normally called when the application conf is processed based on the defaultFlags parameter. The flagIds in the list do not have to already be defined. When a flag is registered this list is checked to determine flags that should be set.

Definition at line 823 of file afw_flag.c.

◆ afw_flag_set_to_defaults_plus_array()

void afw_flag_set_to_defaults_plus_array ( const afw_utf8_t *const *  flag_ids,
afw_xctx_t xctx 
)

Set xctx default flags plus one or more additional flags.

Parameters
flag_idsis NULL terminated array of flag ids.
xctxof caller

Definition at line 797 of file afw_flag.c.