DTNMA Reference Tools v2.2.0 - 5.ga116361
Delay-Tolerant Networking Management Architecture (DTNMA) Tool Suite
Loading...
Searching...
No Matches
promote.c File Reference
#include "promote.h"
#include "typing.h"
#include "cace/util/logging.h"
#include "cace/util/defs.h"
+ Include dependency graph for promote.c:

Functions

cace_ari_type_t cace_amm_promote_eqiv_lit_type (const cace_ari_lit_t *lit)
 Determine the equivalent built-in type of the provided literal-value.
 
bool cace_amm_promote_is_numeric (cace_ari_type_t typ)
 Determine if given type is numeric.
 
void cace_amm_promote_init (cace_amm_promote_state_t *obj)
 Initialize the struct.
 
void cace_amm_promote_deinit (cace_amm_promote_state_t *obj)
 De-initialize the struct.
 
static int cace_amm_promote_valtype (cace_ari_type_t *result, const cace_ari_t *val)
 
static int cace_amm_promote_numeric_rank (cace_ari_type_t typ)
 For the numeric types, provide a rank ordering.
 
static int cace_amm_promote_type (cace_ari_type_t *result, const cace_ari_t *lt_val, const cace_ari_t *rt_val)
 Implement the numeric type promotion procedure from Section 6.11.2.1 of the AMM [draft-ietf-dtn-amm] by choosing the least compatible type between two values.
 
int cace_amm_promote_process (cace_amm_promote_state_t *obj, const cace_ari_t *lt_val, const cace_ari_t *rt_val)
 Determine the numeric type which is the least common promotion type.
 

Function Documentation

◆ cace_amm_promote_deinit()

void cace_amm_promote_deinit ( cace_amm_promote_state_t obj)

◆ cace_amm_promote_eqiv_lit_type()

◆ cace_amm_promote_init()

◆ cace_amm_promote_is_numeric()

bool cace_amm_promote_is_numeric ( cace_ari_type_t  typ)

Determine if given type is numeric.

Parameters
[in]typInput type.
Returns
true if numeric type.

References CACE_ARI_TYPE_BYTE, CACE_ARI_TYPE_INT, CACE_ARI_TYPE_REAL32, CACE_ARI_TYPE_REAL64, CACE_ARI_TYPE_UINT, CACE_ARI_TYPE_UVAST, and CACE_ARI_TYPE_VAST.

Referenced by cace_amm_promote_type().

◆ cace_amm_promote_numeric_rank()

static int cace_amm_promote_numeric_rank ( cace_ari_type_t  typ)
static

◆ cace_amm_promote_process()

int cace_amm_promote_process ( cace_amm_promote_state_t obj,
const cace_ari_t lt_val,
const cace_ari_t rt_val 
)

Determine the numeric type which is the least common promotion type.

This is done in accordance with Section 6.11.2.1 of [amm].

Parameters
[out]resultThe promotion type if the return is zero.
[in]lt_valThe left input value.
[in]rt_valThe right input value.
Returns
Zero if successful.

References cace_amm_promote_type(), cace_amm_promote_valtype(), cace_amm_type_convert(), cace_amm_type_get_builtin(), cace_ari_type_to_name(), CACE_LOG_DEBUG, cace_log_is_enabled_for(), cace_amm_promote_state_t::common, cace_amm_promote_state_t::lt_prom, cace_amm_promote_state_t::lt_use, cace_amm_promote_state_t::lt_val, cace_amm_promote_state_t::rt_prom, cace_amm_promote_state_t::rt_use, and cace_amm_promote_state_t::rt_val.

Referenced by ari_numeric_add(), cace_numeric_binary_operator(), cace_numeric_compare_operator(), and cace_numeric_integer_binary_operator().

◆ cace_amm_promote_type()

static int cace_amm_promote_type ( cace_ari_type_t result,
const cace_ari_t lt_val,
const cace_ari_t rt_val 
)
static

Implement the numeric type promotion procedure from Section 6.11.2.1 of the AMM [draft-ietf-dtn-amm] by choosing the least compatible type between two values.

References cace_ari_lit_t::ari_type, cace_ari_t::as_lit, cace_amm_promote_eqiv_lit_type(), cace_amm_promote_is_numeric(), cace_amm_promote_numeric_rank(), cace_amm_promote_valtype(), CACE_ARI_TYPE_INT, CACE_ARI_TYPE_UVAST, CACE_ARI_TYPE_VAST, CACE_LOG_DEBUG, CHKERR1, cace_ari_lit_t::has_ari_type, and cace_ari_t::is_ref.

Referenced by cace_amm_promote_process().

◆ cace_amm_promote_valtype()