Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_flag.h
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Adaptive Framework Software Flag Header
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
9 #ifndef __AFW_FLAG_H__
10 #define __AFW_FLAG_H__
11 
12 #include "afw_interface.h"
13 
28 
29 #define AFW_FLAG_INITIAL_ALLOCATED_COUNT 64
30 
32 struct afw_flag_s {
33 
34  /*
35  * flagid_ always be first because of
36  * afw_runtime_value_accessor_applicable_flags.
37  */
40 
43 
46 
49 
52 
55 
58 
60  const afw_utf8_t *brief;
61 
64 
67 
70 
73 
74 };
75 
76 
77 
84 #define afw_flag_is_active(flag_index, xctx) \
85 ((flag_index) < (xctx)->flags_count && (xctx)->flags[flag_index])
86 
87 
88 
97  const afw_utf8_t *flag_id,
98  afw_xctx_t *xctx);
99 
100 
101 
108 AFW_DECLARE(const afw_flag_t *)
110  afw_size_t flag_index,
111  afw_xctx_t *xctx);
112 
113 
114 
123  const afw_utf8_t *flag_id,
124  afw_xctx_t *xctx);
125 
126 
127 
138 AFW_DECLARE(void)
140  const afw_utf8_t *flag_id,
141  afw_boolean_t set_to,
142  afw_xctx_t *xctx);
143 
144 
145 
156 AFW_DECLARE(void)
158  const afw_list_t *default_flag_ids,
159  afw_xctx_t *xctx);
160 
161 
162 
169 AFW_DECLARE(void)
171  const afw_utf8_t *flag_id,
172  afw_boolean_t set_to,
173  afw_xctx_t *xctx);
174 
175 
176 
182 AFW_DECLARE(void)
184  const afw_utf8_t * const *flag_ids,
185  afw_xctx_t *xctx);
186 
187 
188 
198 AFW_DECLARE(void)
200  const afw_utf8_t *flag_id,
201  const afw_utf8_t *brief,
202  const afw_utf8_t *description,
203  const afw_utf8_t *included_by_flag_id,
204  afw_xctx_t *xctx);
205 
206 
207 
214 AFW_DECLARE(void)
216  const afw_utf8_t *flag_id,
217  const afw_utf8_t *included_by_flag_id,
218  afw_xctx_t *xctx);
219 
220 
226 afw_flag_internal_early_register_core(afw_xctx_t *xctx);
227 
228 
229 AFW_END_DECLARES
230 
233 #endif /* __AFW_TRACE_H__ */
#define AFW_BEGIN_DECLARES
#define AFW_DECLARE_INTERNAL(type)
Declare an internal function for /src/afw/ source*.h files.
#define AFW_DECLARE(type)
Declare a public afw function.
Interfaceafw_interface header.
_Bool afw_boolean_t
Definition: afw_common.h:373
apr_size_t afw_size_t
size_t.
Definition: afw_common.h:151
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.
Definition: afw_flag.c:565
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.
Definition: afw_flag.c:717
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.
Definition: afw_flag.c:797
const afw_flag_t * afw_flag_get_by_index(afw_size_t flag_index, afw_xctx_t *xctx)
Get flag by index.
Definition: afw_flag.c:534
void afw_flag_set_default_flag_ids(const afw_list_t *default_flag_ids, afw_xctx_t *xctx)
Set a new default flags list.
Definition: afw_flag.c:823
void afw_flag_set(const afw_utf8_t *flag_id, afw_boolean_t set_to, afw_xctx_t *xctx)
Set a flag in xctx.
Definition: afw_flag.c:780
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.
Definition: afw_flag.c:579
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.
Definition: afw_flag.c:546
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.
Definition: afw_flag.c:688
Struct used for a registered flag.
Definition: afw_flag.h:32
const afw_object_t * object
runtime object for this flag.
Definition: afw_flag.h:45
const afw_value_list_t * included_by_value
list value of all flags that include this flag.
Definition: afw_flag.h:66
const afw_value_t * flag_id_value
sting value of objectId of this flag.
Definition: afw_flag.h:42
const afw_boolean_t * applicable_flags
Applicable flags indexed by associated flag_index.
Definition: afw_flag.h:57
const afw_utf8_t * description
Description of this flag.
Definition: afw_flag.h:63
const afw_utf8_t * flag_id
objectId of this flag.
Definition: afw_flag.h:39
const afw_utf8_t * brief
Brief predicate about this flag.
Definition: afw_flag.h:60
const afw_flag_t * parent
Pointer to direct parent afw_flag_t.
Definition: afw_flag.h:72
afw_size_t flag_index
Index of this flag in flags array.
Definition: afw_flag.h:51
const afw_value_list_t * includes_value
list value of all other flags this flag includes.
Definition: afw_flag.h:69
afw_size_t applicable_flags_count_allocated
Count of applicable_flags.
Definition: afw_flag.h:54
const afw_value_t * object_value
object value for runtime object.
Definition: afw_flag.h:48
Interface afw_list public struct.
Interface afw_object public struct.
NFC normalized UTF-8 string.
Definition: afw_common.h:545
struct for data type list values.
Interface afw_value public struct.
Interface afw_xctx public struct.