Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_model_internal.h
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Adaptive Framework model internal header
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
9 #ifndef __AFW_MODEL_INTERNAL_H__
10 #define __AFW_MODEL_INTERNAL_H__
11 
12 #include "afw_interface.h"
13 
31 
32 
33 #define AFW_MODEL_ON_MAP(XX) \
34 XX(_AdaptiveModelCurrentOnAddObject_) \
35 XX(_AdaptiveModelCurrentOnDeleteObject_) \
36 XX(_AdaptiveModelCurrentOnGetInitialObjectId_) \
37 XX(_AdaptiveModelCurrentOnGetInitialValue_) \
38 XX(_AdaptiveModelCurrentOnGetObject_) \
39 XX(_AdaptiveModelCurrentOnGetProperty_) \
40 XX(_AdaptiveModelCurrentOnModifyObject_) \
41 XX(_AdaptiveModelCurrentOnReplaceObject_) \
42 XX(_AdaptiveModelCurrentOnRetrieveObjects_) \
43 XX(_AdaptiveModelCurrentOnSetProperty_) \
44 
45 
46 typedef enum {
47 #define XX(id) \
48  afw_model_on_map_ ## id,
49  AFW_MODEL_ON_MAP(XX)
50 #undef XX
51  afw_model_on_map_count
52 } afw_model_on_map_enum_t;
53 
54 
55 
63 
64  /* Next 6 set in afw_model_internal_create_skeleton_context() */
65  const afw_pool_t *p;
67  const afw_adaptor_impl_request_t *impl_request;
68  const afw_context_cb_variable_t * const *current_variables;
69  const afw_model_object_type_t *model_object_type;
70  const afw_query_criteria_t *criteria;
71  const afw_object_t *adaptorTypeSpecific;
72  afw_runtime_object_indirect_t runtime_object_level;
73  afw_runtime_object_indirect_t runtime_property_level;
74  afw_boolean_t from_adaptor;
75  afw_boolean_t process_initial_values;
76 
77  const afw_object_t *object;
78  const afw_object_t *mapped_object;
79 
80  /* Object id from original request. */
81  const afw_utf8_t *object_id;
82 
83  /*
84  * Next two set in context by
85  * afw_model_internal_create_to_adaptor_skeleton_context().
86  */
87  const afw_utf8_t *mapped_object_type_id;
88  const afw_utf8_t *mapped_object_id;
89 
90  const afw_value_t *object_value;
91  const afw_value_t *adaptor_id_value;
92  const afw_value_t *object_type_id_value;
93  const afw_value_t *object_id_value;
94 
95  const afw_value_t *mapped_object_value;
96  const afw_value_t *mapped_object_type_id_value;
97  const afw_value_t *mapped_object_id_value;
98 
99  const afw_value_t *adaptorTypeSpecific_value; /* From adaptorTypeSpecific. */
100  const afw_value_t *mapObject_value; /* mapObject function. */
101  const afw_value_t *mapBackObject_value; /* mapBackObject function. */
102  const afw_value_t *queryCriteria_value; /* From criteria. */
103  const afw_value_t *returnObject_value; /* returnObject function. */
104  const afw_value_t *useDefaultProcessing_value;
105 
106 
109 
112 
115 
116  /* current:: property level. */
117  struct {
118 
119  const afw_model_property_type_t *model_property_type;
120 
121  const afw_value_t *property_name_value;
122  const afw_value_t *value;
123 
124  const afw_value_t *mapped_property_name_value;
125  const afw_value_t *mapped_value;
126 
127  } property_level;
128 
129 };
130 
131 
132 
142  afw_model_associative_array,
144 
145 
146 
147 struct afw_model_internal_s {
148 
150  const afw_pool_t *p;
151 
153  const afw_utf8_t *model_id;
154 
156  const afw_compile_shared_t *shared;
157 
159  const afw_model_t * AFW_ATOMIC next_model;
160 
162  apr_hash_t *object_types_ht;
163 
165  const afw_object_t *model_object;
166 
168  const afw_utf8_t *objectType_path;
169 
171  apr_hash_t *model_object_types;
172 
174  const afw_object_t *custom_variables;
175 
176 };
177 
178 
179 
182 
185 
188 
191 
194 
197 
200 
203 
206 
209 
212 
215 
218 
221 
224 
227 
230 
233 
236 
239 
242 
245 
248 
251 
254 
257 
260 
261 };
262 
263 
265 
268 
271 
274 
277 
280 
283 
286 
289 
292 
298 
301 
304 
307 
310 
313 
316 
319 
322 
325 
328 
331 
334 
335  /*
336  * @brief Extra boolean expression that can test for uniqueness.
337  *
338  * @fixme Concept??? Maybe???
339  *
340  * This is an optional additional uniqueness boolean test expression
341  * that can be used to test if a value is unique. If not specified,
342  * it up to the adaptor to determine if value is unique.
343  *
344  */
345  const afw_value_t *uniqueness_test;
346 };
347 
348 
350  afw_adaptor_t pub;
351 
352  const afw_utf8_t *model_location_adaptor_id;
353 
354  const afw_utf8_t *mapped_adaptor_id;
355 
356  const afw_utf8_t *model_id;
357 
360 
363 
364  const afw_value_t *mappedAdaptorId_value;
365 
366  const afw_value_t *mapBackObject_signature;
367 
368  const afw_value_t *mapObject_signature;
369 
370  const afw_value_t *returnObject_signature;
371 
372  /* Instance skeletons for runtime on* objects */
373  union {
374  afw_runtime_object_indirect_t instance_skeleton[1];
375  struct {
376 #define XX(id) \
377  afw_runtime_object_indirect_t instance_skeleton_ ## id;
378  AFW_MODEL_ON_MAP(XX)
379 #undef XX
380  };
381  };
382 };
383 
384 
388  const afw_adaptor_t *model_location_adaptor;
389  const afw_model_t *model;
390  afw_adaptor_object_type_cache_t object_type_cache;
391 };
392 
393 
394 /* Object callback context. */
396  const afw_pool_t *p;
398  const afw_adaptor_impl_request_t *impl_request;
399  void * original_context;
400  afw_object_cb_t original_callback;
401  const afw_model_object_type_t *model_object_type;
402  const afw_utf8_t *object_id;
403  const afw_query_criteria_t *criteria;
405 
406 
407 void
408 afw_model_internal_register_context_type_model(afw_xctx_t *xctx);
409 
410 /*
411  * This is used by add and replace to create basic mapped object. Each
412  * does further appropriated processing on returned object. ctx must be
413  * initialized before call.
414  */
418  afw_xctx_t *xctx);
419 
421 afw_model_internal_create_skeleton_context(
422  afw_runtime_object_indirect_t *runtime_object_level_skeleton,
423  const afw_context_cb_variable_t * const *current_variables,
425  const afw_adaptor_impl_request_t *impl_request,
426  const afw_model_object_type_t *model_object_type,
427  const afw_pool_t *p,
428  afw_xctx_t *xctx);
429 
430 
432 afw_model_internal_create_to_adaptor_skeleton_context(
434  afw_runtime_object_indirect_t *runtime_object_level_skeleton,
435  const afw_model_t *model,
436  const afw_adaptor_impl_request_t *impl_request,
437  const afw_utf8_t *object_type_id,
438  const afw_utf8_t *object_id,
439  afw_xctx_t *xctx);
440 
441 
443 afw_model_internal_complete_ctx_default_add_object(
445  afw_xctx_t *xctx);
446 
447 
449 afw_model_internal_complete_ctx_default_delete_object(
451  afw_xctx_t *xctx);
452 
453 
457  afw_xctx_t *xctx);
458 
459 
461 afw_model_internal_complete_ctx_default_replace_object(
463  afw_xctx_t *xctx);
464 
465 
467 afw_model_internal_context_current_property_to_mapped[];
468 
469 
471 afw_model_internal_context_current_add_object[];
472 
473 
475 afw_model_internal_context_current_delete_object[];
476 
477 
479 afw_model_internal_context_current_get_object[];
480 
481 
483 afw_model_internal_context_current_modify_object[];
484 
485 
487 afw_model_internal_context_current_replace_object[];
488 
489 
491 afw_model_internal_context_current_retrieve_objects[];
492 
493 
495 afw_model_internal_context_current_property_from_mapped[];
496 
497 
499 afw_model_internal_context_current_for_initial_object_id[];
500 
502 afw_model_internal_context_current_runtime_ctx[];
503 
504 
505 
521 afw_model_internal_convert_property(
522  const afw_model_object_type_t *object_type,
523  afw_model_adapt_t adapt_type,
524  const afw_utf8_t * *to_property_name,
525  const afw_value_t * *to_value,
526  const afw_utf8_t * from_property_name,
527  const afw_value_t * from_value,
528  const afw_object_t * const *variable_objects,
529  const afw_pool_t *p, afw_xctx_t *xctx);
530 
531 
545 afw_model_internal_convert_property_name(
546  const afw_model_object_type_t *object_type,
547  afw_model_adapt_t adapt_type,
548  const afw_utf8_t * *to_property_name,
549  const afw_utf8_t * from_property_name,
550  const afw_object_t * const *variable_objects,
551  const afw_pool_t *p, afw_xctx_t *xctx);
552 
553 
564  const afw_model_object_type_t *model_object_type,
565  const afw_query_criteria_t *criteria,
566  const afw_pool_t *p, afw_xctx_t *xctx);
567 
568 
569 
571 afw_model_internal_context_current_property_from_mapped[];
572 
574 afw_model_internal_context_current_property_to_mapped[];
575 
577 afw_model_internal_context_current_for_initial_object_id[];
578 
580 afw_model_internal_context_current_add_object[];
581 
583 afw_model_internal_context_current_delete_object[];
584 
586 afw_model_internal_context_current_modify_object[];
587 
589 afw_model_internal_context_current_replace_object[];
590 
591 /*
592  * This is an internal runtime context that includes all of the current::
593  * variable access functions. This one is not registered. The values
594  * in afw_model_internal_context_t *ctx is used to determine if a variable
595  * is present or not.
596  */
598 afw_model_internal_context_current_runtime_ctx[];
599 
600 AFW_END_DECLARES
601 
604 #endif /* __AFW_MODEL_INTERNAL_H__ */
#define AFW_DECLARE_INTERNAL_CONST_DATA(type)
Declare an internal variable for /src/afw/ source*.h files.
#define AFW_BEGIN_DECLARES
#define AFW_DECLARE_INTERNAL(type)
Declare an internal function for /src/afw/ source*.h files.
Interfaceafw_interface header.
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
_Bool afw_boolean_t
Definition: afw_common.h:373
struct afw_model_internal_s afw_model_t
afw_model_internal_create_basic_to_adaptor_mapped_object(afw_model_internal_context_t *ctx, afw_xctx_t *xctx)
afw_model_internal_complete_ctx_default_modify_object(afw_model_internal_context_t *ctx, afw_xctx_t *xctx)
afw_model_internal_convert_query_criteria(const afw_model_object_type_t *model_object_type, const afw_query_criteria_t *criteria, const afw_pool_t *p, afw_xctx_t *xctx)
Convert query criteria based on model.
AFW_ASSOCIATIVE_ARRAY_TEMPLATE(afw_model_associative_array, afw_model_object_type_t) struct afw_model_internal_s
Define afw_model_internal_object_type_associative_array template.
enum afw_model_adapt_e afw_model_adapt_t
Typedef for model adapt type enum.
Internal request info used by afw_adaptor_impl*() functions.
Adaptor modify entry.
Interface afw_adaptor_object_type_cache public struct.
Interface afw_adaptor public struct.
Interface afw_adaptor_session public struct.
Resources that can be shared by multiple compiles.
Struct passed to afw_context_type_register_cb_variables()
Definition: afw_context.h:43
Interface afw_data_type public struct.
Interface afw_list public struct.
const afw_object_t * custom_variables
Custom variables.
const afw_value_t * mapped_property_name
mappedPropertyName or NULL.
Internal struct used by afw_model* functions.
const afw_list_t * mapped_entries
Mapped entries for modify.
const afw_value_t * modify_entries_value
Original entries for modify as list value.
const afw_adaptor_modify_entry_t *const * modify_entries
Original entries for modify.
Struct for afw_model_object_type_t property_type_other member.
const afw_value_t * object_id_property_name_value
objectIdPropertyName value.
const afw_value_t * onGetObject
onGetObject or NULL.
const afw_utf8_t * object_type_id
Object type id.
const afw_model_property_type_t ** property_type
NULL terminated list of property types for this object type.
const afw_model_t * model
Model containing this object type.
const afw_value_t * mapped_object_type_id_value
mappedObjectType value.
const afw_value_t * description_property_name_value
descriptionPropertyName value.
const afw_object_t * object_type_object
Property type object.
const afw_value_t * object_type_path_value
Object type path value.
const afw_utf8_t * object_id_property_name
objectIdPropertyName.
const afw_utf8_t * object_type_path
Object type path.
const afw_value_t * onReplaceObject
onReplaceObject or NULL.
const afw_value_t * onGetInitialObjectId
onGetInitialObjectId or NULL.
const afw_value_t * onDeleteObject
onDeleteObject or NULL.
const afw_model_object_type_t ** descendants
NULL terminated list of descendants.
const afw_value_t * onAddObject
onAddObject or NULL.
const afw_value_t * object_type_object_value
Property type object value.
const afw_value_t * onModifyObject
onModifyObject or NULL.
const afw_value_t * onRetrieveObjects
onRetrieveObjects or NULL.
const afw_object_t * custom_variables
Custom variables.
const afw_value_compiled_value_t * compiled_value
Compiled value for this object type.
const afw_model_property_type_t * property_type_other
Property type for other properties.
const afw_model_object_type_t ** parents
NULL terminated list of parents.
const afw_utf8_t * mapped_object_type_id
mapped object type.
const afw_utf8_t * description_property_name
descriptionPropertyName.
const afw_value_t * object_type_id_value
Object type id value.
const afw_value_t * onSetProperty
onSetProperty value or NULL if value from object used asis.
const afw_data_type_t * evaluated_data_type
Data type to use if value is evaluated or NULL.
const afw_value_t * onGetProperty
onGetProperty value or NULL if value from object used asis.
afw_boolean_t allow_query
allowQuery.
const afw_value_t * onGetInitialValue
initial value or NULL if value from object used asis.
const afw_value_t * default_value
defaultValue or NULL.
const afw_value_t * property_name_value
Property name as adaptive value.
const afw_value_t * property_type_path_value
Property type path value.
const afw_utf8_t * property_name
Property name or regular expression if other.
const afw_data_type_t * data_type
Data type or NULL if not restricted.
const afw_utf8_t * property_type_path
Property type path.
const afw_utf8_t * mapped_property_name
Mapped property name.
const afw_object_t * custom_variables
constraint.
const afw_value_compiled_value_t * compiled_value
Compiled value for this property.
afw_boolean_t transitory
transitory.
const afw_object_t * property_type_object
Property type object.
const afw_value_t * mapped_property_name_value
Mapped property name as adaptive value.
const afw_value_t * property_type_object_value
Property type object value.
Interface afw_object public struct.
Interface afw_pool public struct.
Parsed query criteria.
Struct for runtime objects.
Definition: afw_runtime.h:174
NFC normalized UTF-8 string.
Definition: afw_common.h:545
Struct for compiled value value.
Interface afw_value public struct.
Interface afw_xctx public struct.