Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_runtime.h
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Adaptive Framework Runtime Header
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
9 #ifndef __AFW_RUNTIME_H__
10 #define __AFW_RUNTIME_H__
11 
12 #include "afw_interface.h"
13 
15 
32 afw_runtime_inf_const_embedded_untyped_object;
33 
35 afw_runtime_inf_const_meta_object_inf;
36 
37 /*
38  * @brief Custom handling information for a runtime object type.
39  *
40  * This is registered using afw_environment_register_runtime_custom() and
41  * retrieved using afw_environment_get_runtime_custom().
42  */
44 
47 
50 
51 };
52 
53 
55 
62 
69 
78 
90 };
91 
92 
100 
102  const afw_utf8_t *name;
103 
109 
117 
125  union {
126  const afw_data_type_t *data_type;
127  const afw_utf8_t *unresolved_data_type_id;
128  };
129 
135 
140  union {
141  const afw_data_type_t *data_type_parameter_data_type;
142  const afw_utf8_t *unresolved_data_type_parameter_data_type_id;
143  };
144 
152 
160  afw_runtime_value_accessor_t accessor;
161 
162 };
163 
164 
165 
167  const afw_utf8_t *object_type_id;
168  afw_size_t property_count;
169  const afw_runtime_object_map_property_t *properties;
170 };
171 
172 
177 
179  void * internal;
180 };
181 
182 
184 
187 
190 
191 };
192 
193 
196 
199 
202 
205 };
206 
207 
208 
210  const afw_utf8_t *name;
211  const afw_value_t *value;
212 };
213 
214 
215 
217 
220 
223 
225  const void *array;
226 };
227 
228 
229 
231 
234 
237 
239  const afw_utf8_t *path;
240 
243 
246 
247 };
248 
249 
250 
252 
254  const afw_runtime_unresolved_property_t * (*properties);
255 
258 
261 };
262 
263 
264 
267 
270 
273 
276 
279 
285 
288 
290 
291 
292 
295 
298 
300  const union {
301  afw_boolean_t boolean;
302  afw_double_t number;
303  afw_integer_t integer;
306  const afw_utf8_z_t *string;
307  };
308 };
309 
310 
311 
314 
317 
320 
321 };
322 
323 
324 
337 AFW_DECLARE(const afw_object_t *)
339  const afw_object_inf_t *inf,
340  const afw_utf8_t *object_id,
341  void * internal,
342  const afw_pool_t *p,
343  afw_xctx_t *xctx);
344 
345 
346 
353 AFW_DECLARE(void)
355  const afw_object_t *object, afw_boolean_t overwrite,
356  afw_xctx_t *xctx);
357 
358 
359 
366 AFW_DECLARE(void)
368  const afw_object_t * const * objects, afw_boolean_t overwrite,
369  afw_xctx_t *xctx);
370 
371 
379 typedef const afw_object_t *
380 (*afw_runtime_object_wrapper_p_cb_t)(
381  void *data,
382  const afw_pool_t *p,
383  afw_xctx_t *xctx);
384 
385 
386 
396 AFW_DECLARE(void)
398  const afw_utf8_t *object_type_id,
399  const afw_utf8_t *object_id,
401  void *data,
402  afw_boolean_t overwrite,
403  afw_xctx_t *xctx);
404 
405 
406 
419 AFW_DECLARE(void)
421  const afw_utf8_t *object_type_id,
422  const afw_utf8_t *object_id,
423  void *internal,
424  afw_boolean_t overwrite,
425  afw_xctx_t *xctx);
426 
427 
428 
441 AFW_DECLARE(void)
443  const afw_object_inf_t *inf,
444  const afw_utf8_t *object_id,
445  void * internal,
446  afw_boolean_t overwrite,
447  afw_xctx_t *xctx);
448 
449 
450 
458 AFW_DECLARE(void)
460  const afw_runtime_unresolved_const_object_t * const * unresolved,
461  afw_boolean_t overwrite, afw_xctx_t *xctx);
462 
463 
464 
478 AFW_DECLARE(void)
480  const afw_utf8_t *object_type_id,
481  void *context, afw_object_cb_t callback,
482  afw_xctx_t *xctx);
483 
484 
485 
492 
493 
494 
503  afw_xctx_t *xctx);
504 
505 
506 
513 AFW_DECLARE(const afw_object_t *)
515  const afw_utf8_t *object_type_id, const afw_utf8_t *object_id,
516  afw_xctx_t *xctx);
517 
518 
531 AFW_DECLARE(const afw_object_t *)
533  const afw_utf8_t *object_type_id,
534  const afw_utf8_t *object_id,
535  void * internal,
536  const afw_pool_t *p,
537  afw_xctx_t *xctx);
538 
539 
540 
549 AFW_DECLARE(void)
551  const afw_utf8_t *object_type_id,
552  const afw_utf8_t *object_id,
553  afw_xctx_t *xctx);
554 
555 
562 AFW_DECLARE(void)
564  const afw_object_t *object, afw_boolean_t overwrite,
565  afw_xctx_t *xctx);
566 
567 
568 
575 AFW_DECLARE(void)
577  const afw_object_t * const * objects, afw_boolean_t overwrite,
578  afw_xctx_t *xctx);
579 
580 
581 
590 AFW_DECLARE(void)
592  const afw_object_inf_t * const * inf,
593  afw_xctx_t *xctx
594 );
595 
596 
597 
606 AFW_DECLARE(void)
608  const afw_interface_implementation_rti_t * const * rti,
609  afw_xctx_t *xctx
610 );
611 
612 
613 
621 AFW_DECLARE(const afw_object_t *)
623  const afw_runtime_unresolved_const_object_t *unresolved,
624  const afw_pool_t *p,
625  afw_xctx_t *xctx);
626 
627 #define AFW_RUNTIME_OBJECT_RTI(label_, meta_) \
628  \
629 static const afw_interface_implementation_rti_t \
630 label_ = { \
631  AFW_UTF8_LITERAL("afw_object"), \
632  AFW_UTF8_LITERAL(__FILE__), \
633  AFW_UTF8_LITERAL("afw_runtime"), \
634  &meta_ \
635 }; \
636 
637 
638 #define AFW_RUNTIME_OBJECT_INF(inf_, meta_) \
639  \
640 AFW_DEFINE_CONST_DATA(afw_object_inf_t) \
641 inf_ = { \
642  { \
643  AFW_UTF8_LITERAL("afw_object"), \
644  AFW_UTF8_LITERAL(__FILE__), \
645  AFW_UTF8_LITERAL("afw_runtime"), \
646  &meta_ \
647  }, \
648  afw_runtime_object_release, \
649  afw_runtime_object_add_reference, \
650  afw_runtime_object_get_count, \
651  afw_runtime_object_get_meta, \
652  afw_runtime_object_get_property, \
653  afw_runtime_object_get_property_meta, \
654  afw_runtime_object_get_next_own_property, \
655  afw_runtime_object_get_next_property_meta, \
656  afw_runtime_object_has_property, \
657  afw_runtime_object_get_setter \
658 } \
659 
660 
664 void
666  const afw_object_t * instance,
667  afw_xctx_t *xctx);
668 
669 
670 
674 void
676  const afw_object_t * instance,
677  afw_xctx_t *xctx);
678 
679 
680 
686  const afw_object_t * instance,
687  afw_xctx_t * xctx);
688 
689 
690 
694 const afw_utf8_t *
696  const afw_object_t * instance,
697  afw_xctx_t *xctx);
698 
699 
700 
704 const afw_value_t *
706  const afw_object_t *instance,
707  const afw_pool_t *p,
708  afw_xctx_t *xctx);
709 
710 
711 
715 const afw_value_t *
717  const afw_object_t *instance,
718  const afw_utf8_t *property_name,
719  afw_xctx_t *xctx);
720 
721 
722 
726 const afw_value_t *
728  const afw_object_t *instance,
729  const afw_utf8_t *property_name,
730  const afw_pool_t *p,
731  afw_xctx_t *xctx);
732 
733 
734 
738 const afw_value_t *
740  const afw_object_t * instance,
741  const afw_iterator_t * * iterator,
742  const afw_utf8_t * * property_name,
743  afw_xctx_t *xctx);
744 
745 
746 
750 const afw_value_t *
752  const afw_object_t *instance,
753  const afw_iterator_t **iterator,
754  const afw_utf8_t **property_name,
755  const afw_pool_t *p,
756  afw_xctx_t *xctx);
757 
758 
759 
765  const afw_object_t * instance,
766  const afw_utf8_t * property_name,
767  afw_xctx_t *xctx);
768 
769 
770 
774 const afw_object_setter_t *
776  const afw_object_t * instance,
777  afw_xctx_t *xctx);
778 
779 
780 AFW_END_DECLARES
781 
784 #endif /* __AFW_RUNTIME_H__ */
#define AFW_BEGIN_DECLARES
#define AFW_DECLARE(type)
Declare a public afw function.
Interfaceafw_interface header.
AFW_DECLARE_CONST_DATA(afw_utf8_t) afw_s_200
afw_utf8_t for string 200
void(* afw_adaptor_session_retrieve_objects_t)(const afw_adaptor_session_t *instance, const afw_adaptor_impl_request_t *impl_request, const afw_utf8_t *object_type_id, const afw_query_criteria_t *criteria, void *context, afw_object_cb_t callback, const afw_object_t *adaptor_type_specific, const afw_pool_t *p, afw_xctx_t *xctx)
void(* afw_adaptor_session_get_object_t)(const afw_adaptor_session_t *instance, const afw_adaptor_impl_request_t *impl_request, const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, void *context, afw_object_cb_t callback, const afw_object_t *adaptor_type_specific, const afw_pool_t *p, afw_xctx_t *xctx)
afw_boolean_t(* afw_object_cb_t)(const afw_object_t *object, void *context, afw_xctx_t *xctx)
Typedef for afw_adaptor_session_object callback.
Definition: afw_common.h:1176
double afw_double_t
Normal AFW number is double.
Definition: afw_common.h:202
struct afw_iterator_s afw_iterator_t
_Bool afw_boolean_t
Definition: afw_common.h:373
afw_utf8_octet_t afw_utf8_z_t
NFC normalized UTF-8 null terminated string.
Definition: afw_common.h:523
apr_size_t afw_size_t
size_t.
Definition: afw_common.h:151
apr_int64_t afw_integer_t
typedef for big signed int.
Definition: afw_common.h:321
void afw_runtime_object_release(const afw_object_t *instance, afw_xctx_t *xctx)
Method release for runtime object.
Definition: afw_runtime.c:1315
void afw_runtime_env_resolve_and_set_const_objects(const afw_runtime_unresolved_const_object_t *const *unresolved, afw_boolean_t overwrite, afw_xctx_t *xctx)
Resolve and set a NULL terminated list of object pointers in the xctx's runtime objects.
Definition: afw_runtime.c:750
afw_size_t afw_runtime_object_get_count(const afw_object_t *instance, afw_xctx_t *xctx)
Method get_count for runtime object.
Definition: afw_runtime.c:1341
const afw_object_t * afw_runtime_object_create_indirect(const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, void *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create an indirect runtime object.
Definition: afw_runtime.c:481
const afw_object_t *(* afw_runtime_object_wrapper_p_cb_t)(void *data, const afw_pool_t *p, afw_xctx_t *xctx)
Typedef used for afw_runtime_env_set_object_cb_wrapper() cb.
Definition: afw_runtime.h:380
void afw_runtime_env_create_and_set_indirect_object(const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, void *internal, afw_boolean_t overwrite, afw_xctx_t *xctx)
Create and set an indirect runtime object.
Definition: afw_runtime.c:528
const afw_utf8_t * afw_runtime_object_get_object_type_id(const afw_object_t *instance, afw_xctx_t *xctx)
Method get_object_type_id for runtime object.
Definition: afw_runtime.c:1359
void afw_runtime_xctx_set_objects(const afw_object_t *const *objects, afw_boolean_t overwrite, afw_xctx_t *xctx)
Set a list of object pointers in the xctx's runtime objects.
Definition: afw_runtime.c:344
afw_boolean_t afw_runtime_object_has_property(const afw_object_t *instance, const afw_utf8_t *property_name, afw_xctx_t *xctx)
Method has_property for runtime object.
Definition: afw_runtime.c:1562
const afw_value_t * afw_runtime_object_get_meta(const afw_object_t *instance, const afw_pool_t *p, afw_xctx_t *xctx)
Method get_meta for runtime object.
Definition: afw_runtime.c:1431
const afw_adaptor_session_t * afw_runtime_get_internal_session(afw_xctx_t *xctx)
Get an internal session for runtime objects.
Definition: afw_runtime.c:961
void afw_runtime_env_set_object(const afw_object_t *object, afw_boolean_t overwrite, afw_xctx_t *xctx)
Set an object pointer in the environment's runtime objects.
Definition: afw_runtime.c:210
const afw_value_t * afw_runtime_object_get_next_own_property(const afw_object_t *instance, const afw_iterator_t **iterator, const afw_utf8_t **property_name, afw_xctx_t *xctx)
Method get_next_property for runtime object.
Definition: afw_runtime.c:1462
void afw_runtime_remove_object(const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, afw_xctx_t *xctx)
Remove object by object type id and object id.
Definition: afw_runtime.c:262
const afw_object_t * afw_runtime_get_object(const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, afw_xctx_t *xctx)
Get a runtime object.
Definition: afw_runtime.c:853
const afw_object_t * afw_runtime_resolve_const_object(const afw_runtime_unresolved_const_object_t *unresolved, const afw_pool_t *p, afw_xctx_t *xctx)
Resolve a runtime const object.
Definition: afw_runtime.c:701
void afw_runtime_object_add_reference(const afw_object_t *instance, afw_xctx_t *xctx)
Method add_reference for runtime object.
Definition: afw_runtime.c:1328
enum afw_runtime_unresolved_primitive_type_e afw_runtime_unresolved_primitive_type_t
Runtime unresolved primitive value.
const afw_object_t * afw_runtime_object_create_indirect_using_inf(const afw_object_inf_t *inf, const afw_utf8_t *object_id, void *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create an indirect runtime object.
Definition: afw_runtime.c:449
const afw_object_setter_t * afw_runtime_object_get_setter(const afw_object_t *instance, afw_xctx_t *xctx)
Method get_setter for runtime object.
Definition: afw_runtime.c:1579
void afw_runtime_xctx_set_object(const afw_object_t *object, afw_boolean_t overwrite, afw_xctx_t *xctx)
Set an object pointer in the xctx's runtime objects.
Definition: afw_runtime.c:292
void afw_runtime_env_create_and_set_indirect_object_using_inf(const afw_object_inf_t *inf, const afw_utf8_t *object_id, void *internal, afw_boolean_t overwrite, afw_xctx_t *xctx)
Create and set an indirect runtime object.
Definition: afw_runtime.c:507
void afw_runtime_register_object_map_infs(const afw_object_inf_t *const *inf, afw_xctx_t *xctx)
Register runtime object map interfaces.
Definition: afw_runtime.c:356
const afw_value_t * afw_runtime_object_get_next_property_meta(const afw_object_t *instance, const afw_iterator_t **iterator, const afw_utf8_t **property_name, const afw_pool_t *p, afw_xctx_t *xctx)
Method get_next_property_meta for runtime object.
Definition: afw_runtime.c:1546
void afw_runtime_foreach(const afw_utf8_t *object_type_id, void *context, afw_object_cb_t callback, afw_xctx_t *xctx)
Call a callback for each runtime object.
Definition: afw_runtime.c:900
afw_runtime_unresolved_primitive_type_e
Runtime unresolved primitive value.
Definition: afw_runtime.h:266
const afw_adaptor_factory_t * afw_runtime_get_adaptor_factory()
Get singleton factory for runtime adaptor.
Definition: afw_runtime.c:915
void afw_runtime_env_set_object_cb_wrapper(const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, afw_runtime_object_wrapper_p_cb_t callback, void *data, afw_boolean_t overwrite, afw_xctx_t *xctx)
Set environment object accessed via callback.
Definition: afw_runtime.c:240
const afw_value_t * afw_runtime_object_get_property(const afw_object_t *instance, const afw_utf8_t *property_name, afw_xctx_t *xctx)
Method get_property for runtime object.
Definition: afw_runtime.c:1376
const afw_value_t * afw_runtime_object_get_property_meta(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_pool_t *p, afw_xctx_t *xctx)
Method get_property_meta for runtime object.
Definition: afw_runtime.c:1446
void afw_runtime_resolve_and_register_object_map_infs(const afw_interface_implementation_rti_t *const *rti, afw_xctx_t *xctx)
Create and register runtime object map interfaces.
Definition: afw_runtime.c:373
void afw_runtime_env_set_objects(const afw_object_t *const *objects, afw_boolean_t overwrite, afw_xctx_t *xctx)
Set a list of object pointers in the environment's runtime objects.
Definition: afw_runtime.c:228
@ afw_runtime_unresolved_primitive_type_list
Definition: afw_runtime.h:278
@ afw_runtime_unresolved_primitive_type_string
value points to afw_utf8_z_t.
Definition: afw_runtime.h:287
@ afw_runtime_unresolved_primitive_type_object
Definition: afw_runtime.h:284
@ afw_runtime_unresolved_primitive_type_integer
Definition: afw_runtime.h:275
@ afw_runtime_unresolved_primitive_type_number
Definition: afw_runtime.h:272
@ afw_runtime_unresolved_primitive_type_boolean
Definition: afw_runtime.h:269
Interface afw_adaptor_factory public struct.
Interface afw_adaptor_session public struct.
Interface afw_data_type public struct.
Interface Implementation Run Time Information.
Interface afw_object_inf_s struct.
Interface afw_object public struct.
Interface afw_object_setter public struct.
Interface afw_pool public struct.
const afw_runtime_property_t *const * properties
Definition: afw_runtime.h:189
meta instance with single parent path.
Definition: afw_runtime.h:195
const afw_runtime_const_object_instance_t * object
Definition: afw_runtime.h:201
const afw_value_list_t * parent_paths
Definition: afw_runtime.h:204
afw_adaptor_session_get_object_t get_object
The session get_object method.
Definition: afw_runtime.h:49
afw_adaptor_session_retrieve_objects_t retrieve_objects
The session retrieve_objects method.
Definition: afw_runtime.h:46
Struct for runtime objects.
Definition: afw_runtime.h:174
Struct for runtime object map property.
Definition: afw_runtime.h:99
afw_size_t offset
Offset of internal property value in internal object struct.
Definition: afw_runtime.h:108
const afw_utf8_t * accessor_name
Name of registered runtime value accessor function.
Definition: afw_runtime.h:151
afw_runtime_value_accessor_t accessor
Accessor function or NULL.
Definition: afw_runtime.h:160
const afw_utf8_t * name
Property name.
Definition: afw_runtime.h:102
afw_size_t count_offset
Offset of bag value count afw_size_t for bag values or -1.
Definition: afw_runtime.h:116
const afw_utf8_t * object_type_id
Object Type Id.
Definition: afw_runtime.h:61
size_t properties_offset
Runtime properties offset in internal.
Definition: afw_runtime.h:77
const afw_runtime_object_map_t * property_map
Map of property offsets in internal or NULL.
Definition: afw_runtime.h:68
afw_boolean_t indirect
Internal is indirect.
Definition: afw_runtime.h:89
const afw_runtime_unresolved_property_t *const * properties
Definition: afw_runtime.h:242
Runtime unresolved property.
Definition: afw_runtime.h:313
const afw_utf8_z_t * name
Property name.
Definition: afw_runtime.h:316
afw_runtime_unresolved_value_t value
Unresolved value.
Definition: afw_runtime.h:319
Runtime unresolved value.
Definition: afw_runtime.h:294
afw_runtime_unresolved_primitive_type_t type
Primitive type of value.
Definition: afw_runtime.h:297
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.