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

Files

file  afw_environment.h
 Header for adaptive framework environment.
 

Data Structures

struct  afw_environment_default_register_additional_s
 Default register_additional object struct. More...
 
struct  afw_environment_registry_type_s
 
struct  afw_environment_conf_type_s
 Struct for afw environment conf type. More...
 

Macros

#define AFW_ENVIRONMENT_REGISTRY_TYPE_MAP(XX)
 Environment Core Registry Type Map. More...
 
#define AFW_ENVIRONMENT_Q_EXTENSION_INSTANCE    "afw_environment_extension_instance"
 environment extension instance quoted string.
 
#define AFW_ENVIRONMENT_DEFINE_EXTENSION_IMPL()
 Macro to put in each afw_extension implementation. More...
 
#define AFW_ENVIRONMENT_CREATE(xctx, argc, argv, environment_create_error)
 Call afw_environment_create() supplying version compiled with. More...
 
#define afw_environment_register_flag(flag_id, brief, description, included_by_flag_id, xctx)
 Register a flag. More...
 

Typedefs

typedef struct afw_environment_default_register_additional_s afw_environment_default_register_additional_t
 Default register_additional object struct.
 
typedef void(* afw_environment_conf_type_create_cede_p_t) (const afw_utf8_t *type, const afw_object_t *conf, const afw_utf8_t *source_location, const afw_pool_t *p, afw_xctx_t *xctx)
 Typedef for afw conf type create functions. More...
 
typedef void *(* afw_environment_auto_register_cb_t) (const afw_utf8_t *registry_type_id, const afw_utf8_t *key, afw_xctx_t *xctx)
 Auto register callback function. More...
 
typedef void(* afw_environment_register_additional_cb_t) (const afw_utf8_t *registry_type_id, int type_number, const afw_utf8_t *key, const void *value, const void *register_additional_param, const void **register_additional_use, afw_xctx_t *xctx)
 Additional register callback function. More...
 
typedef const afw_utf8_z_t *(* afw_environment_error_rv_decoder_z_t) (int rv, afw_utf8_z_t *wa, afw_size_t wa_size)
 Typedef for error rv decoder functions. More...
 
typedef afw_boolean_t(* afw_environment_foreach_cb_t) (int type_number, void *data, const afw_utf8_octet_t *key_s, afw_size_t key_len, void *value, const afw_pool_t *p, afw_xctx_t *xctx)
 Callback function typedef for afw_environment_foreach(). More...
 

Enumerations

enum  afw_environment_registry_type_enum_t { afw_environemnt_registry_type_max_core_type }
 Enum for the core registry types.
 

Functions

afw_xctx_tafw_environment_create (unsigned int version, int argc, const char *const *argv, const afw_error_t **environment_create_error)
 Create the Adaptive Framework core environment and return base xctx. More...
 
void afw_environment_release (afw_xctx_t *xctx)
 Create the Adaptive Framework core environment and return base xctx. More...
 
 afw_environment_registry_object_get_current (afw_xctx_t *xctx)
 Get current environment registry object. More...
 
void afw_environment_configure_with_object (const afw_object_t *conf, const afw_utf8_t *source_location, afw_xctx_t *xctx)
 Configure environment with a configuration entry. More...
 
void afw_environment_configure_with_object_list (const afw_list_t *entry_list, const afw_utf8_t *source_location, afw_xctx_t *xctx)
 Configure environment with list of configuration entries. More...
 
const afw_object_tafw_environment_create_environment_variables_object (afw_boolean_t preload_variables, afw_xctx_t *xctx)
 Create a readonly object for accessing environment variables. More...
 
const afw_extension_tafw_environment_load_extension (const afw_utf8_t *extension_id, const afw_utf8_t *module_path, const afw_object_t *properties, afw_xctx_t *xctx)
 Load and initialize environment extension. More...
 
void afw_environment_foreach (int type_number, afw_environment_foreach_cb_t callback, void *data, const afw_pool_t *p, afw_xctx_t *xctx)
 Call a callback function for each entry of a registry type. More...
 
int afw_environment_create_registry_type (const afw_utf8_t *registry_type_id, const afw_utf8_t *property_name, const afw_utf8_t *object_type_id, const afw_utf8_t *description, afw_boolean_t allow_reregister, afw_environment_auto_register_cb_t auto_register, afw_environment_register_additional_cb_t register_additional, void *register_additional_param, afw_xctx_t *xctx)
 Create a new registry type. More...
 
const afw_environment_registry_type_tafw_environment_get_registry_type_by_id (const afw_utf8_t *registry_type_id, afw_boolean_t load_extension, afw_xctx_t *xctx)
 Get the registry type associated with a registry type id. More...
 
const afw_environment_registry_type_tafw_environment_get_registry_type_by_number (int registry_type_number, afw_xctx_t *xctx)
 Get the registry type associated with a registry type number. More...
 
void afw_environment_registry_register (int type_number, const afw_utf8_t *key, const void *value, afw_xctx_t *xctx)
 Register a value by key for a registry type. More...
 
afw_boolean_t afw_environment_registry_key_exists (int type_number, const afw_utf8_t *key, afw_xctx_t *xctx)
 Check to see if a key exists. More...
 
void * afw_environment_registry_get (int type_number, const afw_utf8_t *key, afw_xctx_t *xctx)
 Get the value associated with a key for a registry type. More...
 
void * afw_environment_registry_get_without_xctx (const afw_environment_t *env, int type_number, const afw_utf8_t *key)
 Limited get the value associated with a key for a registry type. More...
 
const afw_environment_registry_type_tafw_environment_get_registry_type (const afw_utf8_t *property_name, afw_xctx_t *xctx)
 Get the registry type associated with property name. More...
 
void afw_environment_register_singleton (const afw_utf8_t *singleton_key, const void *void_ptr, afw_xctx_t *xctx)
 Register an singleton. More...
 
void * afw_environment_get_singleton (const afw_utf8_t *singleton_key, afw_xctx_t *xctx)
 Get the singleton value. More...
 
 afw_environment_register_adaptor_type (const afw_utf8_t *adaptor_type, const afw_adaptor_factory_t *adaptor_factory, afw_xctx_t *xctx)
 Register an adaptor factory. More...
 
const afw_adaptor_factory_tafw_environment_get_adaptor_type (const afw_utf8_t *adaptor_type, afw_xctx_t *xctx)
 Get the adaptor factory instance associated with adaptor type. More...
 
void afw_environment_register_adaptor_id (const afw_utf8_t *adaptor_id, const afw_adaptor_id_anchor_t *anchor, afw_xctx_t *xctx)
 Register an adaptor id anchor. More...
 
const afw_adaptor_id_anchor_tafw_environment_get_adaptor_id (const afw_utf8_t *adaptor_id, afw_xctx_t *xctx)
 Get the adaptor id anchor associated with adaptor id. More...
 
 afw_environment_register_authorization_handler_type (const afw_utf8_t *authorization_handler_type, const afw_authorization_handler_factory_t *authorization_handler_factory, afw_xctx_t *xctx)
 Register an authorization handler factory. More...
 
const afw_authorization_handler_factory_tafw_environment_get_authorization_handler_type (const afw_utf8_t *authorization_handler_type, afw_xctx_t *xctx)
 Get the authorization_handler factory instance associated with authorization handler type. More...
 
void afw_environment_register_authorization_handler_id (const afw_utf8_t *authorization_handler_id, const afw_authorization_handler_id_anchor_t *anchor, afw_xctx_t *xctx)
 Register an authorization handler id anchor. More...
 
const afw_authorization_handler_id_anchor_tafw_environment_get_authorization_handler_id (const afw_utf8_t *authorization_handler_id, afw_xctx_t *xctx)
 Get the authorization handler id anchor associated with authorization handler id. More...
 
void afw_environment_create_and_register_conf_type (const afw_utf8_t *conf_type_id, afw_environment_conf_type_create_cede_p_t create, const afw_utf8_t *title, const afw_utf8_t *description, const afw_utf8_t *id_property_name, const afw_utf8_t *id_registry_type_id, const afw_utf8_t *id_runtime_object_type_id, const afw_utf8_t *subtype_property_name, const afw_utf8_t *subtype_registry_type_id, const afw_utf8_t *subtype_runtime_object_type_id, afw_boolean_t is_unique, afw_xctx_t *xctx)
 Create and register a configuration (conf) type. More...
 
const afw_environment_conf_type_tafw_environment_get_conf_type (const afw_utf8_t *type, afw_xctx_t *xctx)
 Get the conf_type associated with type. More...
 
const afw_object_tafw_environment_prepare_conf_type_properties (const afw_object_t *properties, afw_xctx_t *xctx)
 Prepare properties for a conf type. More...
 
void afw_environment_register_content_type (const afw_utf8_t *type, const afw_content_type_t *content_type, afw_xctx_t *xctx)
 Register an content type. More...
 
const afw_content_type_tafw_environment_get_content_type (const afw_utf8_t *type, afw_xctx_t *xctx)
 Get the afw_content_type struct associated with a content type. More...
 
void afw_environment_register_context_type (const afw_utf8_t *context_type_id, const afw_object_t *context_type_object, afw_xctx_t *xctx)
 Register an context type. More...
 
const afw_object_tafw_environment_get_context_type (const afw_utf8_t *context_type_id, afw_xctx_t *xctx)
 Get the afw_environment_context_type struct associated with a context type. More...
 
void afw_environment_register_data_type (const afw_utf8_t *data_type_id, const afw_data_type_t *data_type, afw_xctx_t *xctx)
 Register a data type. More...
 
void afw_environment_register_data_types (const afw_data_type_t *const *data_types, afw_xctx_t *xctx)
 Register a NULL terminated list of data types. More...
 
const afw_data_type_tafw_environment_get_data_type (const afw_utf8_t *type, afw_xctx_t *xctx)
 Get the data_type associated with configuration entry type. More...
 
void afw_environment_register_error_rv_decoder (const afw_utf8_t *rv_source_id, afw_environment_error_rv_decoder_z_t rv_decoder, afw_xctx_t *xctx)
 Register an error rv decoder. More...
 
afw_environment_error_rv_decoder_z_t afw_environment_get_error_rv_decoder (const afw_utf8_t *rv_source_id, afw_xctx_t *xctx)
 Get the error rv decoder function associated with rv_source_id. More...
 
const afw_flag_tafw_environment_get_flag (const afw_utf8_t *flag_id, afw_xctx_t *xctx)
 Get the flag instance associated with flag_id. More...
 
void afw_environment_register_function (const afw_utf8_t *function_id, const afw_value_function_definition_t *function, afw_xctx_t *xctx)
 Register a function. More...
 
void afw_environment_register_functions (const afw_value_function_definition_t **functions, afw_xctx_t *xctx)
 Register a NULL terminated list of functions. More...
 
const afw_value_function_definition_tafw_environment_get_function (const afw_utf8_t *function_id, afw_xctx_t *xctx)
 Get the function instance associated with function id. More...
 
const afw_value_function_definition_tafw_environment_get_qualified_function (const afw_utf8_t *qualifier, const afw_utf8_t *name, afw_xctx_t *xctx)
 Get the qualified function instance. More...
 
const afw_value_function_definition_tafw_environment_registry_get_data_type_method (const afw_data_type_t *data_type, afw_integer_t dataTypeMethodNumber, afw_xctx_t *xctx)
 Get the function associated with a data type method. More...
 
void afw_environment_register_lock (const afw_utf8_t *lock_id, const afw_lock_t *lock, afw_xctx_t *xctx)
 Register an lock. More...
 
const afw_lock_tafw_environment_get_lock (const afw_utf8_t *log_type, afw_xctx_t *xctx)
 Get the lock instance associated a lock id. More...
 
void afw_environment_register_log_type (const afw_utf8_t *log_type, const afw_log_factory_t *log_factory, afw_xctx_t *xctx)
 Register an log factory. More...
 
const afw_log_factory_tafw_environment_get_log_type (const afw_utf8_t *log_type, afw_xctx_t *xctx)
 Get the log factory instance associated with log type. More...
 
void afw_environment_register_log (const afw_utf8_t *log_id, const afw_log_t *log, afw_xctx_t *xctx)
 Register a log. More...
 
const afw_log_tafw_environment_get_log (const afw_utf8_t *log_id, afw_xctx_t *xctx)
 Get the log instance associated with log id. More...
 
void afw_environment_register_policy_combining_algorithm (const afw_utf8_t *policy_combining_algorithm_id, const afw_value_function_definition_t *function, afw_xctx_t *xctx)
 Register a policy combining algorithm function. More...
 
const afw_value_function_definition_tafw_environment_get_policy_combining_algorithm (const afw_utf8_t *policy_combining_algorithm_id, afw_xctx_t *xctx)
 Get the function instance associated with a policy combining algorithm id. More...
 
void afw_environment_register_request_handler_type (const afw_utf8_t *handler_type, const afw_request_handler_factory_t *request_handler_factory, afw_xctx_t *xctx)
 Register a request_handler factory. More...
 
const afw_request_handler_factory_tafw_environment_get_request_handler_type (const afw_utf8_t *handler_type, afw_xctx_t *xctx)
 Get the request_handler factory instance associated with handler type. More...
 
void afw_environment_register_rule_combining_algorithm (const afw_utf8_t *rule_combining_algorithm_id, const afw_value_function_definition_t *function, afw_xctx_t *xctx)
 Register a rule combining algorithm function. More...
 
const afw_value_function_definition_tafw_environment_get_rule_combining_algorithm (const afw_utf8_t *rule_combining_algorithm_id, afw_xctx_t *xctx)
 Get the function instance associated with a rule combining algorithm id. More...
 
void afw_environment_register_runtime_custom (const afw_utf8_t *object_type_id, const afw_runtime_custom_t *custom, afw_xctx_t *xctx)
 Register afw_runtime_custom_t for a custom handled runtime object type. More...
 
const afw_runtime_custom_tafw_environment_get_runtime_custom (const afw_utf8_t *object_type_id, afw_xctx_t *xctx)
 Get afw_runtime_custom_t for a custom handled runtime object type. More...
 
void afw_environment_register_runtime_object_map_inf (const afw_utf8_t *object_type_id, const afw_object_inf_t *inf, afw_xctx_t *xctx)
 Register a runtime object map interface. More...
 
const afw_object_inf_tafw_environment_get_runtime_object_map_inf (const afw_utf8_t *object_type_id, afw_xctx_t *xctx)
 Get the interface associated with a runtime object map. More...
 
void afw_environment_register_runtime_value_accessor (const afw_utf8_t *accessor_name, afw_runtime_value_accessor_t function, afw_xctx_t *xctx)
 Register a runtime value accessor function. More...
 
afw_runtime_value_accessor_t afw_environment_get_runtime_value_accessor (const afw_utf8_t *accessor_name, afw_xctx_t *xctx)
 Get the interface associated with a runtime object map. More...
 
void afw_environment_register_service (const afw_utf8_t *service_id, afw_service_t *service, afw_xctx_t *xctx)
 Register a service. More...
 
afw_service_tafw_environment_get_service (const afw_utf8_t *service_id, afw_xctx_t *xctx)
 Get the service instance associated with service_id. More...
 
void afw_environment_register_service_type (const afw_utf8_t *service_type_id, const afw_service_type_t *service_type, afw_xctx_t *xctx)
 Register a service type. More...
 
const afw_service_type_tafw_environment_get_service_type (const afw_utf8_t *service_type_id, afw_xctx_t *xctx)
 Get the service type instance associated with service_type_id. More...
 
void afw_environment_register_value_inf (const afw_utf8_t *value_inf_id, const afw_value_inf_t *value_inf, afw_xctx_t *xctx)
 Register a value inf. More...
 
const afw_value_inf_tafw_environment_get_value_inf (const afw_utf8_t *value_inf_id, afw_xctx_t *xctx)
 Get the value inf associated with a value inf id. More...
 
void afw_environment_set_debug_fd (FILE *fd, afw_xctx_t *xctx)
 Override fd used for debug. More...
 
void afw_environment_set_stderr_fd (FILE *fd, afw_xctx_t *xctx)
 Override fd used for stderr. More...
 
void afw_environment_set_stdout_fd (FILE *fd, afw_xctx_t *xctx)
 Override fd used for stdout. More...
 

Detailed Description

Adaptive Framework Environment

Macro Definition Documentation

◆ AFW_ENVIRONMENT_CREATE

#define AFW_ENVIRONMENT_CREATE (   xctx,
  argc,
  argv,
  environment_create_error 
)
Value:
AFW_VERSION_ABORT_IF_NOT_COMPATIBLE("AFW_ENVIRONMENT_CREATE()"); \
xctx = afw_environment_create(AFW_VERSION_HEX, argc, argv, \
environment_create_error)
afw_xctx_t * afw_environment_create(unsigned int version, int argc, const char *const *argv, const afw_error_t **environment_create_error)
Create the Adaptive Framework core environment and return base xctx.
#define AFW_VERSION_ABORT_IF_NOT_COMPATIBLE(id_z)
Abort if AFW core is not compatible with the version compiled against.
Definition: afw_version.h:119

Call afw_environment_create() supplying version compiled with.

Parameters
xctxset to base xctx or NULL if returned_error points to an error.
argc
argv
returned_errorplace if error occurs while creating environment.
parent_pParent pool or NULL if there is not one.

This macro calls AFW_VERSION_ABORT_IF_NOT_COMPATIBLE() to check for compatibility. If you want to handle this situation differently, use AFW_VERSION_CHECK before AFW_ENVIRONMENT_CREATE().

Definition at line 519 of file afw_environment.h.

◆ AFW_ENVIRONMENT_DEFINE_EXTENSION_IMPL

#define AFW_ENVIRONMENT_DEFINE_EXTENSION_IMPL ( )
Value:
static const afw_extension_t \
impl_extension = \
{ \
&impl_afw_extension_inf, \
AFW_UTF8_LITERAL(AFW_IMPLEMENTATION_ID), \
AFW_UTF8_LITERAL(AFW_IMPLEMENTATION_VERSION), \
AFW_UTF8_LITERAL(AFW_VERSION_STRING), \
AFW_VERSION_HEX \
}; \
\
AFW_DEFINE_DSO(const afw_extension_t *) \
afw_environment_extension_instance = &impl_extension
#define AFW_IMPLEMENTATION_ID
Interface afw_extension public struct.
Definition: afw_interface.h:55

Macro to put in each afw_extension implementation.

Put this after #include "afw_extension_impl_declares.h" in an implementation of the afw_extension interface. It provides the symbol used by afw_environment_load_extension() to determine the extensions id and version information.

Definition at line 277 of file afw_environment.h.

◆ afw_environment_register_flag

#define afw_environment_register_flag (   flag_id,
  brief,
  description,
  included_by_flag_id,
  xctx 
)
Value:
flag_id, brief, description, included_by_flag_id, xctx)
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

Register a flag.

Parameters
flag_id.
brief.
description.
included_by_flag_idor NULL (afw_flag_add_included_by() adds more)
log_priorityto be used if this flag triggers a log message.
xctxof caller.

Definition at line 1300 of file afw_environment.h.

◆ AFW_ENVIRONMENT_REGISTRY_TYPE_MAP

#define AFW_ENVIRONMENT_REGISTRY_TYPE_MAP (   XX)

Environment Core Registry Type Map.

Parameters
idof registry type
register_additionalcustom callback function or NULL
allow_reregistertrue/false
property_namein AdaptiveEnvironmentRegistry
object_type_idin afw adaptor of registered keys of this registry type
descriptionof this registry type

There must be and afw_s_ with each name in map.

The register_additional function must be defined as a static function in afw_environment.c. If register_additional is NULL, a afw_environment_registry_entry_t is created and a runtime object of the specified object_type_id is set.

These are just the core registry type. Other types can be created by calling afw_environment_create_registry_type() in an extension.

Definition at line 48 of file afw_environment.h.

Typedef Documentation

◆ afw_environment_auto_register_cb_t

typedef void*(* afw_environment_auto_register_cb_t) (const afw_utf8_t *registry_type_id, const afw_utf8_t *key, afw_xctx_t *xctx)

Auto register callback function.

Parameters
registry_type_id
key
xctxof caller.

A function of this type can be specified on afw_environment_create_registry_type() as auto_register parameter.

Definition at line 321 of file afw_environment.h.

◆ afw_environment_conf_type_create_cede_p_t

typedef void(* afw_environment_conf_type_create_cede_p_t) (const afw_utf8_t *type, const afw_object_t *conf, const afw_utf8_t *source_location, const afw_pool_t *p, afw_xctx_t *xctx)

Typedef for afw conf type create functions.

Parameters
typeof conf (same as "conf" property in conf).
confobject.
source_locationindicating the source of conf.
pceded to handler.
xctxof caller.

The p should be a multithreaded pool whose control is ceded to the thing being created. For example, for type=adaptor, the adaptor should destroy this pool when the adaptor's use count goes to zero.

Definition at line 305 of file afw_environment.h.

◆ afw_environment_error_rv_decoder_z_t

typedef const afw_utf8_z_t*(* afw_environment_error_rv_decoder_z_t) (int rv, afw_utf8_z_t *wa, afw_size_t wa_size)

Typedef for error rv decoder functions.

Parameters
rvto decode.
wawork area that can be used to build return value.
wa_sizework area size.

IMPORTANT Implementation of this function must not do anything that might throw an error or change xctx->error or a recursive error producing a stack overflow will occur.

Definition at line 439 of file afw_environment.h.

◆ afw_environment_foreach_cb_t

typedef afw_boolean_t(* afw_environment_foreach_cb_t) (int type_number, void *data, const afw_utf8_octet_t *key_s, afw_size_t key_len, void *value, const afw_pool_t *p, afw_xctx_t *xctx)

Callback function typedef for afw_environment_foreach().

Parameters
type_numberis registry type number.
datapassed to call of afw_environment_foreach().
key_sis key->s.
key_lenis key->len.
valueto cast as appropriate for type_number.
pto use.
xctxof caller.
Returns
true if the callback function requests that it not be called again.

The purpose of returning true from a callback function is to short circuit the foreach when the callback has determined that it is "complete". Unless the callback has a special purpose like this, it should always return false so that it will continue to called until the end.

Definition at line 648 of file afw_environment.h.

◆ afw_environment_register_additional_cb_t

typedef void(* afw_environment_register_additional_cb_t) (const afw_utf8_t *registry_type_id, int type_number, const afw_utf8_t *key, const void *value, const void *register_additional_param, const void **register_additional_use, afw_xctx_t *xctx)

Additional register callback function.

Parameters
registry_type_id
key
xctxof caller.

A function of this type can be specified on afw_environment_create_registry_type() as register_additional parameter.

Definition at line 337 of file afw_environment.h.

Function Documentation

◆ afw_environment_configure_with_object()

void afw_environment_configure_with_object ( const afw_object_t conf,
const afw_utf8_t source_location,
afw_xctx_t xctx 
)

Configure environment with a configuration entry.

Parameters
confobject.
source_locationto associate with this entry.
xctxMUST be base xctx.

Parameter source_location default to the path of the entry object.

Definition at line 21 of file afw_environment_configuration.c.

◆ afw_environment_configure_with_object_list()

void afw_environment_configure_with_object_list ( const afw_list_t entry_list,
const afw_utf8_t source_location,
afw_xctx_t xctx 
)

Configure environment with list of configuration entries.

Parameters
entry_listconfiguration entry list.
source_locationto associate with this list of entries.
xctxMUST be base xctx.

Parameter entry_list must contain mutable objects and persist for life of environment.

Parameter source_location default to "Configuration".

Definition at line 65 of file afw_environment_configuration.c.

◆ afw_environment_create()

afw_xctx_t* afw_environment_create ( unsigned int  version,
int  argc,
const char *const *  argv,
const afw_error_t **  environment_create_error 
)

Create the Adaptive Framework core environment and return base xctx.

Parameters
versionof Adaptive Framework core caller is compiled against.
argc
argv
returned_errorplace if error occurs while creating environment.
Returns
base xctx or NULL if returned_error points to an error.

Call this function once in an Adaptive Framework application to initialize the Adaptive Framework environment and create the initial base xctx. All core capabilities will be registered. See afw_environment_register_core.c for more detail.

The following are important snippets for an Adaptive Framework application that establishes an Adaptive Framework core environment and insures that it will be released.

int main(int argc, char * const * argv) { ... Only used on afw_environment_create() call ... const afw_error_t *create_error;

... xctx returned from AFW_ENVIRONMENT_CREATE() call ... afw_xctx_t *xctx;

... Create Adaptive Framework environment using helper macro ... AFW_ENVIRONMENT_CREATE(xctx, argc, argv, &create_error); if (!xctx) { afw_error_print(xctx->env->stderr_fd, create_error); return -1; }

... Body of app protected by AFW_TRY ... AFW_TRY { ... Adaptive Framework application code ... ... Use break to leave AFW_TRY, not goto or return. }

... Catch other errors that need special handling ...

... Print any other errors. ... AFW_CATCH_UNHANDLED{ afw_error_print(xctx->env->stderr_fd, AFW_ERROR_THROWN); rv = -1; }

... Makes sure environment is released ... AFW_FINALLY { afw_environment_release(xctx);

... Special case: xctx is gone, so return before AFW_ENDTRY. ... return rv; }

AFW_ENDTRY; }

Todo:
FIXME: Commented out apr_terminate() since it free's error memory.

Definition at line 222 of file afw_environment.c.

◆ afw_environment_create_and_register_conf_type()

void afw_environment_create_and_register_conf_type ( const afw_utf8_t conf_type_id,
afw_environment_conf_type_create_cede_p_t  create,
const afw_utf8_t title,
const afw_utf8_t description,
const afw_utf8_t id_property_name,
const afw_utf8_t id_registry_type_id,
const afw_utf8_t id_runtime_object_type_id,
const afw_utf8_t subtype_property_name,
const afw_utf8_t subtype_registry_type_id,
const afw_utf8_t subtype_runtime_object_type_id,
afw_boolean_t  is_unique,
afw_xctx_t xctx 
)

Create and register a configuration (conf) type.

Parameters
conf_type_idof configuration tpe.
createfunction to call. @parm id_property_name for instances of this conf type. @parm id_registry_type_id for instances of this conf type. @parm id_runtime_object_type_id for instances of this conf type. @parm subtype_property_name for instances of this conf type. @parm subtype_registry_type_id for instances of this conf type. @parm subtype_runtime_object_type_id for instances of this conf type
related_object_type_id
id_property_nameof the id property for this type or NULL.
subtype_property_nameof the subtype property for this type or NULL.
titleof configuration type.
descriptionof configuration type.
is_uniqueindicate this type can only occur once.
xctxof caller.

For adaptor, id_property_name is "adaptorId' and subtype_property_name is "adaptor_type".

If related_object_type_id is not NULL, the uri of the related object will be /afw/<related_object_type_id>/<id_property_name value>

Definition at line 867 of file afw_environment.c.

◆ afw_environment_create_environment_variables_object()

const afw_object_t* afw_environment_create_environment_variables_object ( afw_boolean_t  preload_variables,
afw_xctx_t xctx 
)

Create a readonly object for accessing environment variables.

Parameters
preload_variablesshould be true if using threads or false otherwise.
xctxof caller.
Returns
object instance.

If not using threads, preload_variables false is better since the property associated with each environment variable is only create if accessed. If threads are being using, make sure preload_variables is true because the object is not threadsafe otherwise.

Definition at line 76 of file afw_environment_variables_object.c.

◆ afw_environment_create_registry_type()

int afw_environment_create_registry_type ( const afw_utf8_t registry_type_id,
const afw_utf8_t property_name,
const afw_utf8_t object_type_id,
const afw_utf8_t description,
afw_boolean_t  allow_reregister,
afw_environment_auto_register_cb_t  auto_register,
afw_environment_register_additional_cb_t  register_additional,
void *  register_additional_param,
afw_xctx_t xctx 
)

Create a new registry type.

Parameters
registry_type_idname.
property_nameis a unique name for this type associated with key.
descriptionof registry type.
object_type_idof objects in afw adaptor for entries of this type.
allow_reregisterof a key by replacing value.
auto_registeris function to call if key is not already registered.
register_additionalfunction pointer or NULL. Required if
register_additional_paramor NULL.
xctxof caller.
Returns
Number associated with registry type.

Create a new registry type and return its number.

Todo:
FIXME: Need to lock/protect this update.

Definition at line 451 of file afw_environment.c.

◆ afw_environment_foreach()

void afw_environment_foreach ( int  type_number,
afw_environment_foreach_cb_t  callback,
void *  data,
const afw_pool_t p,
afw_xctx_t xctx 
)

Call a callback function for each entry of a registry type.

Parameters
type_numberis registry type number.
callbackfunction.
datato pass to callback.
pto pass to callback.
xctxof caller.

Definition at line 824 of file afw_environment.c.

◆ afw_environment_get_adaptor_id()

const afw_adaptor_id_anchor_t* afw_environment_get_adaptor_id ( const afw_utf8_t adaptor_id,
afw_xctx_t xctx 
)

Get the adaptor id anchor associated with adaptor id.

Parameters
adaptor_id.
xctxof caller.
Returns
Associated adaptor id anchor or NULL if not found.

Definition at line 919 of file afw_environment.h.

◆ afw_environment_get_adaptor_type()

const afw_adaptor_factory_t* afw_environment_get_adaptor_type ( const afw_utf8_t adaptor_type,
afw_xctx_t xctx 
)

Get the adaptor factory instance associated with adaptor type.

Parameters
adaptor_typeof adaptor factory instance.
xctxof caller.
Returns
Associated instance or NULL if not found.

Definition at line 881 of file afw_environment.h.

◆ afw_environment_get_authorization_handler_id()

const afw_authorization_handler_id_anchor_t* afw_environment_get_authorization_handler_id ( const afw_utf8_t authorization_handler_id,
afw_xctx_t xctx 
)

Get the authorization handler id anchor associated with authorization handler id.

Parameters
authorization_handler_id.
xctxof caller.
Returns
Associated authorization handler id anchor or NULL if not found.

Definition at line 999 of file afw_environment.h.

◆ afw_environment_get_authorization_handler_type()

const afw_authorization_handler_factory_t* afw_environment_get_authorization_handler_type ( const afw_utf8_t authorization_handler_type,
afw_xctx_t xctx 
)

Get the authorization_handler factory instance associated with authorization handler type.

Parameters
authorization_handler_typeof authorization handler factory instance.
xctxof caller.
Returns
Associated instance or NULL if not found.

Definition at line 957 of file afw_environment.h.

◆ afw_environment_get_conf_type()

const afw_environment_conf_type_t* afw_environment_get_conf_type ( const afw_utf8_t type,
afw_xctx_t xctx 
)

Get the conf_type associated with type.

Parameters
typeis conf type.
xctxof caller.
Returns
Associated afw_environment_conf_type_t or NULL if not found.

Definition at line 1059 of file afw_environment.h.

◆ afw_environment_get_content_type()

const afw_content_type_t* afw_environment_get_content_type ( const afw_utf8_t type,
afw_xctx_t xctx 
)

Get the afw_content_type struct associated with a content type.

Parameters
typeconfiguration entry type.
xctxof caller.
Returns
Pointer to associated afw_content_type_t struct or NULL if not found.

Definition at line 1156 of file afw_environment.h.

◆ afw_environment_get_context_type()

const afw_object_t* afw_environment_get_context_type ( const afw_utf8_t context_type_id,
afw_xctx_t xctx 
)

Get the afw_environment_context_type struct associated with a context type.

Parameters
context_type_id.
xctxof caller.
Returns
context_type_object.

Definition at line 1196 of file afw_environment.h.

◆ afw_environment_get_data_type()

const afw_data_type_t* afw_environment_get_data_type ( const afw_utf8_t type,
afw_xctx_t xctx 
)

Get the data_type associated with configuration entry type.

Parameters
typeconfiguration entry type.
xctxof caller.
Returns
Associated instance or NULL if not found.

Definition at line 1241 of file afw_environment.h.

◆ afw_environment_get_error_rv_decoder()

afw_environment_error_rv_decoder_z_t afw_environment_get_error_rv_decoder ( const afw_utf8_t rv_source_id,
afw_xctx_t xctx 
)

Get the error rv decoder function associated with rv_source_id.

Parameters
rv_source_idsee rv_source_id_z in afw_error_t.
xctxof caller.
Returns
Decoder function or NULL if not found.

Definition at line 1280 of file afw_environment.h.

◆ afw_environment_get_flag()

const afw_flag_t* afw_environment_get_flag ( const afw_utf8_t flag_id,
afw_xctx_t xctx 
)

Get the flag instance associated with flag_id.

Parameters
flag_idof flag.
xctxof caller.
Returns
associated instance or NULL if not found.

Definition at line 1314 of file afw_environment.h.

◆ afw_environment_get_function()

const afw_value_function_definition_t* afw_environment_get_function ( const afw_utf8_t function_id,
afw_xctx_t xctx 
)

Get the function instance associated with function id.

Parameters
function_idof function instance.
xctxof caller.
Returns
Associated instance or NULL if not found.

Definition at line 1361 of file afw_environment.h.

◆ afw_environment_get_lock()

const afw_lock_t* afw_environment_get_lock ( const afw_utf8_t log_type,
afw_xctx_t xctx 
)

Get the lock instance associated a lock id.

Parameters
lock_idof the lock.
xctxof caller.
Returns
Associated lock or NULL if not found.

Definition at line 1427 of file afw_environment.h.

◆ afw_environment_get_log()

const afw_log_t* afw_environment_get_log ( const afw_utf8_t log_id,
afw_xctx_t xctx 
)

Get the log instance associated with log id.

Parameters
log_idof log instance.
xctxof caller.
Returns
Associated instance or NULL if not found.

Definition at line 1508 of file afw_environment.h.

◆ afw_environment_get_log_type()

const afw_log_factory_t* afw_environment_get_log_type ( const afw_utf8_t log_type,
afw_xctx_t xctx 
)

Get the log factory instance associated with log type.

Parameters
log_typeof log factory instance.
xctxof caller.
Returns
Associated instance or NULL if not found.

Definition at line 1466 of file afw_environment.h.

◆ afw_environment_get_policy_combining_algorithm()

const afw_value_function_definition_t* afw_environment_get_policy_combining_algorithm ( const afw_utf8_t policy_combining_algorithm_id,
afw_xctx_t xctx 
)

Get the function instance associated with a policy combining algorithm id.

Parameters
policy_combining_algorithm_idof function instance.
xctxof caller.
Returns
Associated struct or NULL if not found.

Definition at line 1549 of file afw_environment.h.

◆ afw_environment_get_qualified_function()

const afw_value_function_definition_t* afw_environment_get_qualified_function ( const afw_utf8_t qualifier,
const afw_utf8_t name,
afw_xctx_t xctx 
)

Get the qualified function instance.

Parameters
qualifieror NULL.
nameof function/method.
xctxof caller.
Returns
Associated instance or NULL if not found.

Definition at line 1462 of file afw_environment.c.

◆ afw_environment_get_registry_type()

const afw_environment_registry_type_t* afw_environment_get_registry_type ( const afw_utf8_t property_name,
afw_xctx_t xctx 
)

Get the registry type associated with property name.

Parameters
property_nameassociated with registry type.
xctxof caller.
Returns
pointer to afw_environment_registry_type_t.

Gets the registry type number assigned to a registry type name.

Definition at line 806 of file afw_environment.h.

◆ afw_environment_get_registry_type_by_id()

const afw_environment_registry_type_t* afw_environment_get_registry_type_by_id ( const afw_utf8_t registry_type_id,
afw_boolean_t  load_extension,
afw_xctx_t xctx 
)

Get the registry type associated with a registry type id.

Parameters
registry_type_id.
load_extensionif needed.
xctxof caller.
Returns
pointer to afw_environment_registry_type_t.

Gets the registry type number assigned to a registry type name.

Definition at line 513 of file afw_environment.c.

◆ afw_environment_get_registry_type_by_number()

const afw_environment_registry_type_t* afw_environment_get_registry_type_by_number ( int  registry_type_number,
afw_xctx_t xctx 
)

Get the registry type associated with a registry type number.

Parameters
registry_type_number.
xctxof caller.
Returns
pointer to afw_environment_registry_type_t.

Gets the registry type number assigned to a registry type name.

Definition at line 549 of file afw_environment.c.

◆ afw_environment_get_request_handler_type()

const afw_request_handler_factory_t* afw_environment_get_request_handler_type ( const afw_utf8_t handler_type,
afw_xctx_t xctx 
)

Get the request_handler factory instance associated with handler type.

Parameters
request_handler_typeof request_handler factory instance.
xctxof caller.
Returns
Associated instance or NULL if not found.

Definition at line 1591 of file afw_environment.h.

◆ afw_environment_get_rule_combining_algorithm()

const afw_value_function_definition_t* afw_environment_get_rule_combining_algorithm ( const afw_utf8_t rule_combining_algorithm_id,
afw_xctx_t xctx 
)

Get the function instance associated with a rule combining algorithm id.

Parameters
rule_combining_algorithm_idof function instance.
xctxof caller.
Returns
Associated struct or NULL if not found.

Definition at line 1633 of file afw_environment.h.

◆ afw_environment_get_runtime_custom()

const afw_runtime_custom_t* afw_environment_get_runtime_custom ( const afw_utf8_t object_type_id,
afw_xctx_t xctx 
)

Get afw_runtime_custom_t for a custom handled runtime object type.

Parameters
object_type_idof the afw object type.
xctxof caller.
Returns
Associated afw_runtime_custom_t pointer or NULL if not found.

Definition at line 1673 of file afw_environment.h.

◆ afw_environment_get_runtime_object_map_inf()

const afw_object_inf_t* afw_environment_get_runtime_object_map_inf ( const afw_utf8_t object_type_id,
afw_xctx_t xctx 
)

Get the interface associated with a runtime object map.

Parameters
object_type_idused to identify interface.
xctxof caller.
Returns
Associated interface pointer or NULL if not found.

Definition at line 1713 of file afw_environment.h.

◆ afw_environment_get_runtime_value_accessor()

afw_runtime_value_accessor_t afw_environment_get_runtime_value_accessor ( const afw_utf8_t accessor_name,
afw_xctx_t xctx 
)

Get the interface associated with a runtime object map.

Parameters
accessor_nameused to identify accessor.
xctxof caller.
Returns
Associated function.

Definition at line 1751 of file afw_environment.h.

◆ afw_environment_get_service()

afw_service_t* afw_environment_get_service ( const afw_utf8_t service_id,
afw_xctx_t xctx 
)

Get the service instance associated with service_id.

Parameters
service_idof service instance.
xctxof caller.
Returns
associated instance or NULL if not found.

Definition at line 1790 of file afw_environment.h.

◆ afw_environment_get_service_type()

const afw_service_type_t* afw_environment_get_service_type ( const afw_utf8_t service_type_id,
afw_xctx_t xctx 
)

Get the service type instance associated with service_type_id.

Parameters
service_type_idof service type instance.
xctxof caller.
Returns
associated instance or NULL if not found.

Definition at line 1831 of file afw_environment.h.

◆ afw_environment_get_singleton()

void* afw_environment_get_singleton ( const afw_utf8_t singleton_key,
afw_xctx_t xctx 
)

Get the singleton value.

Parameters
singleton_keyused to identify the singleton.
xctxof caller.
Returns
Pointer to singleton value or NULL if not found.

Definition at line 848 of file afw_environment.h.

◆ afw_environment_get_value_inf()

const afw_value_inf_t* afw_environment_get_value_inf ( const afw_utf8_t value_inf_id,
afw_xctx_t xctx 
)

Get the value inf associated with a value inf id.

Parameters
value_inf_idof interface implementation.
xctxof caller.
Returns
Associated interface pointer or NULL if not found.

Definition at line 1872 of file afw_environment.h.

◆ afw_environment_load_extension()

const afw_extension_t* afw_environment_load_extension ( const afw_utf8_t extension_id,
const afw_utf8_t module_path,
const afw_object_t properties,
afw_xctx_t xctx 
)

Load and initialize environment extension.

Parameters
extension_idid of extension or NULL.
module_pathPath to extension dso or NULL.
propertiesobject.
xctxof caller.
extensioninterface

The properties object can supply extension_id with the "extensionId" property and module_path with the modulePath property. If either is supplied in the object as well as parameters, their values much match.

Either extension_id or module_path must be available.

If module_path is NULL and there is not a "modulePath" property in properties, the extension path must be registered for the extension_id.

After the DSO is loaded, the environment extension initialize method is called.

Extensions are normally loaded by afw_environment_configure_with_object_list().

If properties is not specified, one is created. The extensionId and modulePath properties are set. The path of the properties object is set to /afw/_AdaptiveExtension_/<extension_id> and set as a run time object.

Definition at line 922 of file afw_environment.c.

◆ afw_environment_prepare_conf_type_properties()

const afw_object_t* afw_environment_prepare_conf_type_properties ( const afw_object_t properties,
afw_xctx_t xctx 
)

Prepare properties for a conf type.

Parameters
propertiesto prepare.
xctxof caller.
Returns
processed properties.

This function should be called by the create function of the conf_type. It validates, normalizes, and compiles properties based on the appropriate object type.

The p of properties is used for the result.

The "type" parameter in properties is used to call afw_environment_get_conf_type() to get the conf_type.

The object type used is:

/afw/_AdaptiveObjectType_/_AdaptiveConf_<type>[_<subtype>]

Where:

<type> is the value of properties.type

[_<subtype>] is present if conf_type has a subtype_property_name, in which case, <subtype> will be the value of the subtype_property_name in properties.

The returned object will be an entity with a path of:

/afw/<object type>/<id>

Where:

<object type> is object type described above.

<id> is the value of the id_property_name for the conf_type from properties.

Several properties in the properties parameter object may be changed plus return in the result:

1) If sourceLocation is not already set in properties, one will be set in the properties that includes the available type, subtype, and id.

2) If a type expects an id but it is not provided, it will be set to the subtype in properties.

Other than these 2, the result will be a new object that may reuse values from properties, but will have validated, normalized, and compiled values.

Definition at line 156 of file afw_environment_configuration.c.

◆ afw_environment_register_adaptor_id()

void afw_environment_register_adaptor_id ( const afw_utf8_t adaptor_id,
const afw_adaptor_id_anchor_t anchor,
afw_xctx_t xctx 
)

Register an adaptor id anchor.

Parameters
adaptor_idbeing registered.
anchorinstance to register.
xctxof caller.

Definition at line 899 of file afw_environment.h.

◆ afw_environment_register_adaptor_type()

afw_environment_register_adaptor_type ( const afw_utf8_t adaptor_type,
const afw_adaptor_factory_t adaptor_factory,
afw_xctx_t xctx 
)

Register an adaptor factory.

Parameters
adaptor_typeused to identify adaptor factory being registered.
adaptor_factoryinstance to register.
xctxof caller.

This also registers flag trace:adaptor_type:<adaptor_type> where <adaptor_type> is the supplied adaptor_type.

Definition at line 1577 of file afw_environment.c.

◆ afw_environment_register_authorization_handler_id()

void afw_environment_register_authorization_handler_id ( const afw_utf8_t authorization_handler_id,
const afw_authorization_handler_id_anchor_t anchor,
afw_xctx_t xctx 
)

Register an authorization handler id anchor.

Parameters
authorization_handler_idbeing registered.
anchorinstance to register.
xctxof caller.

Definition at line 977 of file afw_environment.h.

◆ afw_environment_register_authorization_handler_type()

afw_environment_register_authorization_handler_type ( const afw_utf8_t authorization_handler_type,
const afw_authorization_handler_factory_t authorization_handler_factory,
afw_xctx_t xctx 
)

Register an authorization handler factory.

Parameters
authorization_handler_typeused to identify authorization handler factory being registered.
authorization_handler_factoryinstance to register.
xctxof caller.

This also registers flag trace:authorization_handler_type:<authorization_handler_type> where <authorization_handler_type> is the supplied authorization_handler_type.

Definition at line 1636 of file afw_environment.c.

◆ afw_environment_register_content_type()

void afw_environment_register_content_type ( const afw_utf8_t type,
const afw_content_type_t content_type,
afw_xctx_t xctx 
)

Register an content type.

Parameters
typecontent type
Contenttype struct.
xctxof caller.

Definition at line 1135 of file afw_environment.h.

◆ afw_environment_register_context_type()

void afw_environment_register_context_type ( const afw_utf8_t context_type_id,
const afw_object_t context_type_object,
afw_xctx_t xctx 
)

Register an context type.

Parameters
context_type_id.
contexttype object.
xctxof caller.

Definition at line 1174 of file afw_environment.h.

◆ afw_environment_register_data_type()

void afw_environment_register_data_type ( const afw_utf8_t data_type_id,
const afw_data_type_t data_type,
afw_xctx_t xctx 
)

Register a data type.

Parameters
data_type_idData type id.
data_typeData type instance.
xctxof caller.

Definition at line 1149 of file afw_environment.c.

◆ afw_environment_register_data_types()

void afw_environment_register_data_types ( const afw_data_type_t *const *  data_types,
afw_xctx_t xctx 
)

Register a NULL terminated list of data types.

Parameters
data_typesNULL terminated list of afw_data_type_t *.
xctxof caller.

Definition at line 1546 of file afw_environment.c.

◆ afw_environment_register_error_rv_decoder()

void afw_environment_register_error_rv_decoder ( const afw_utf8_t rv_source_id,
afw_environment_error_rv_decoder_z_t  rv_decoder,
afw_xctx_t xctx 
)

Register an error rv decoder.

Parameters
rv_source_idsee rv_source_id_z in afw_error_t.
rv_decoderfunction.
xctxof caller.

Definition at line 1259 of file afw_environment.h.

◆ afw_environment_register_function()

void afw_environment_register_function ( const afw_utf8_t function_id,
const afw_value_function_definition_t function,
afw_xctx_t xctx 
)

Register a function.

Parameters
function_idused to identify function being registered.
functioninstance to register.
xctxof caller.

If function->inf is NULL, a copy of the function will be created with with inf and data_type supplied.

Todo:
resolve parameters.
Todo:
FIXME: Add support for extensions to add data type methods.

Definition at line 1295 of file afw_environment.c.

◆ afw_environment_register_functions()

void afw_environment_register_functions ( const afw_value_function_definition_t **  functions,
afw_xctx_t xctx 
)

Register a NULL terminated list of functions.

Parameters
functionsNULL terminated list of afw_value_function_definition_t *.
xctxof caller.

Definition at line 1562 of file afw_environment.c.

◆ afw_environment_register_lock()

void afw_environment_register_lock ( const afw_utf8_t lock_id,
const afw_lock_t lock,
afw_xctx_t xctx 
)

Register an lock.

Parameters
lock_idof the lock.
lockinstance to register.
xctxof caller.

Definition at line 1407 of file afw_environment.h.

◆ afw_environment_register_log()

void afw_environment_register_log ( const afw_utf8_t log_id,
const afw_log_t log,
afw_xctx_t xctx 
)

Register a log.

Parameters
log_idused to identify log being registered.
loginstance to register.
xctxof caller.

If you want this log to be called for all environment log requests, call afw_log_add_to_environment() instead.

Definition at line 1487 of file afw_environment.h.

◆ afw_environment_register_log_type()

void afw_environment_register_log_type ( const afw_utf8_t log_type,
const afw_log_factory_t log_factory,
afw_xctx_t xctx 
)

Register an log factory.

Parameters
log_typeused to identify log factory being registered.
log_factoryinstance to register.
xctxof caller.

Definition at line 1445 of file afw_environment.h.

◆ afw_environment_register_policy_combining_algorithm()

void afw_environment_register_policy_combining_algorithm ( const afw_utf8_t policy_combining_algorithm_id,
const afw_value_function_definition_t function,
afw_xctx_t xctx 
)

Register a policy combining algorithm function.

Parameters
policy_combining_algorithm_idused to identify algorithm.
functionstruct to register.
xctxof caller.

Definition at line 1527 of file afw_environment.h.

◆ afw_environment_register_request_handler_type()

void afw_environment_register_request_handler_type ( const afw_utf8_t handler_type,
const afw_request_handler_factory_t request_handler_factory,
afw_xctx_t xctx 
)

Register a request_handler factory.

Parameters
handler_typeused to identify request_handler factory being registered.
request_handler_factoryinstance to register.
xctxof caller.

Definition at line 1569 of file afw_environment.h.

◆ afw_environment_register_rule_combining_algorithm()

void afw_environment_register_rule_combining_algorithm ( const afw_utf8_t rule_combining_algorithm_id,
const afw_value_function_definition_t function,
afw_xctx_t xctx 
)

Register a rule combining algorithm function.

Parameters
rule_combining_algorithm_idused to identify algorithm.
functionstruct to register.
xctxof caller.

Definition at line 1611 of file afw_environment.h.

◆ afw_environment_register_runtime_custom()

void afw_environment_register_runtime_custom ( const afw_utf8_t object_type_id,
const afw_runtime_custom_t custom,
afw_xctx_t xctx 
)

Register afw_runtime_custom_t for a custom handled runtime object type.

Parameters
object_type_idof the afw object type being registered.
customhandling information.
xctxof caller.

Definition at line 1653 of file afw_environment.h.

◆ afw_environment_register_runtime_object_map_inf()

void afw_environment_register_runtime_object_map_inf ( const afw_utf8_t object_type_id,
const afw_object_inf_t inf,
afw_xctx_t xctx 
)

Register a runtime object map interface.

Parameters
object_type_idused to identify interface being registered.
infpointer associated with object map.
xctxof caller.

Definition at line 1693 of file afw_environment.h.

◆ afw_environment_register_runtime_value_accessor()

void afw_environment_register_runtime_value_accessor ( const afw_utf8_t accessor_name,
afw_runtime_value_accessor_t  function,
afw_xctx_t xctx 
)

Register a runtime value accessor function.

Parameters
accessor_nameused to identify accessor being registered.
functionassociated with this accessor.
xctxof caller.

Definition at line 1731 of file afw_environment.h.

◆ afw_environment_register_service()

void afw_environment_register_service ( const afw_utf8_t service_id,
afw_service_t service,
afw_xctx_t xctx 
)

Register a service.

Parameters
service_idused to identify service being registered.
serviceinstance.
xctxof caller.

Definition at line 1770 of file afw_environment.h.

◆ afw_environment_register_service_type()

void afw_environment_register_service_type ( const afw_utf8_t service_type_id,
const afw_service_type_t service_type,
afw_xctx_t xctx 
)

Register a service type.

Parameters
service_type_idused to identify service type being registered.
service_typeinstance.
xctxof caller.

Definition at line 1809 of file afw_environment.h.

◆ afw_environment_register_singleton()

void afw_environment_register_singleton ( const afw_utf8_t singleton_key,
const void *  void_ptr,
afw_xctx_t xctx 
)

Register an singleton.

Parameters
singleton_keyused to identify the singleton being registered.
void_ptrvoid pointer to singleton value.
xctxof caller.

Singletons are useful for associating a name with a major struct or object that needs to be accessed across an AFW application.

Definition at line 828 of file afw_environment.h.

◆ afw_environment_register_value_inf()

void afw_environment_register_value_inf ( const afw_utf8_t value_inf_id,
const afw_value_inf_t value_inf,
afw_xctx_t xctx 
)

Register a value inf.

Parameters
value_inf_idused to identify the value inf being registered.
value_infpointer to value inf.
xctxof caller.

value_inf_id should be the same as inf->rti->implementation_id

Definition at line 1852 of file afw_environment.h.

◆ afw_environment_registry_get()

void* afw_environment_registry_get ( int  type_number,
const afw_utf8_t key,
afw_xctx_t xctx 
)

Get the value associated with a key for a registry type.

Parameters
type_numberregistry type number.
keyassociated with value.
xctxof caller.
Returns
value associated with key or NULL if not found.

Definition at line 742 of file afw_environment.c.

◆ afw_environment_registry_get_data_type_method()

const afw_value_function_definition_t* afw_environment_registry_get_data_type_method ( const afw_data_type_t data_type,
afw_integer_t  dataTypeMethodNumber,
afw_xctx_t xctx 
)

Get the function associated with a data type method.

Parameters
data_typeto check.
dataTypeMethodNumberto retrieve.
xctxof caller.
Returns
Associated function instance or NULL if not found.

Definition at line 1508 of file afw_environment.c.

◆ afw_environment_registry_get_without_xctx()

void* afw_environment_registry_get_without_xctx ( const afw_environment_t env,
int  type_number,
const afw_utf8_t key 
)

Limited get the value associated with a key for a registry type.

Parameters
envpointer to environment.
type_numberregistry type number.
keyassociated with value.
Returns
value associated with key or NULL if not found.

The is a limited version of afw_environment_registry_get() and should only be used when xctx is not available. It will return NULL on any error condition and will not check for extensions that might provide support for the type_number or do auto register.

◆ afw_environment_registry_key_exists()

afw_boolean_t afw_environment_registry_key_exists ( int  type_number,
const afw_utf8_t key,
afw_xctx_t xctx 
)

Check to see if a key exists.

Parameters
type_numberregistry type number.
keyassociated with value.
xctxof caller.
Returns
true or false

Definition at line 709 of file afw_environment.c.

◆ afw_environment_registry_object_get_current()

afw_environment_registry_object_get_current ( afw_xctx_t xctx)

Get current environment registry object.

Parameters
xctxof caller.
Returns
/afw/_AdaptiveEnvironmentRegistry_/current object.

Definition at line 52 of file afw_environment_registry_object.c.

◆ afw_environment_registry_register()

void afw_environment_registry_register ( int  type_number,
const afw_utf8_t key,
const void *  value,
afw_xctx_t xctx 
)

Register a value by key for a registry type.

Parameters
type_numberregistry type number.
keyto associate with value.
valueto associate with key.
xctxof caller.
Todo:
FIXME: Small leak if deleting key and then adding again.

Definition at line 574 of file afw_environment.c.

◆ afw_environment_release()

void afw_environment_release ( afw_xctx_t xctx)

Create the Adaptive Framework core environment and return base xctx.

Parameters
xctxreturned from afw_environment_create().
Todo:
FIXME: Causing exception because some things not cleaned up properly
Todo:
FIXME: afw_pool_destroy(xctx->env->p, xctx);
Todo:
FIXME: apr_terminate();

Definition at line 442 of file afw_environment.c.

◆ afw_environment_set_debug_fd()

void afw_environment_set_debug_fd ( FILE *  fd,
afw_xctx_t xctx 
)

Override fd used for debug.

Parameters
fdto use.
xctxof caller.

If not set, stderr is used.

Definition at line 1694 of file afw_environment.c.

◆ afw_environment_set_stderr_fd()

void afw_environment_set_stderr_fd ( FILE *  fd,
afw_xctx_t xctx 
)

Override fd used for stderr.

Parameters
fdto use.
xctxof caller.

If not set, stderr is used.

Definition at line 1704 of file afw_environment.c.

◆ afw_environment_set_stdout_fd()

void afw_environment_set_stdout_fd ( FILE *  fd,
afw_xctx_t xctx 
)

Override fd used for stdout.

Parameters
fdto use.
xctxof caller.

If not set, stdout is used.

Definition at line 1714 of file afw_environment.c.