4.10.17 nxo_dict
Keywords: onyx

Next: 4.10.18 nxo_file Up: 4.10 Classes Previous: 4.10.16 nxo_condition Contents Index
Subsections

- 4.10.17.1 API

##
4.10.17 nxo_dict

The nxo_dict class is a subclass of the nxo class.

### 4.10.17.1 API

void nxo_dict_new(cw_nxo_t *a_nxo, bool a_locking, uint32_t a_dict_size):

  Input(s):
    a_nxo:
      Pointer to a dict nxo.
    a_locking:
      Implicit locking mode.
    a_dict_size:
      Initial number of slots. Dictionaries dynamically grow and shrink as needed, but if the maximum size of a_nxo is known, it should be specified here to save space.
  Output(s):
    None
  Exception(s):
    CW_ONYXX_OOM.
  Description:
    Constructor.

nxo_dict_copy(cw_nxo_t *a_to, cw_nxo_t *a_from):

  Input(s):
    a_to:
      Pointer to a dict nxo.
    a_from:
      Pointer to a dict nxo.
  Output(s):
    None.
  Exception(s):
    CW_ONYXX_OOM.
  Description:
    Do a deep copy (actual contents are copied) of a_from to a_to.

void nxo_dict_def(cw_nxo_t *a_nxo, cw_nxo_t *a_key, cw_nxo_t *a_val):

  Input(s):
    a_nxo:
      Pointer to a dict nxo.
    a_key:
      Pointer to an nxo.
    a_val:
      Pointer to an nxo.
  Output(s):
    None.
  Exception(s):
    CW_ONYXX_OOM.
  Description:
    Define a_key with value a_val in a_nxo.

void nxo_dict_undef(cw_nxo_t *a_nxo, cw_nxo_t *a_key):

  Input(s):
    a_nxo:
      Pointer to a dict nxo.
    a_key:
      Pointer to an nxo.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Undefine a_key in a_nxo, if defined.

bool nxo_dict_lookup(const cw_nxo_t *a_nxo, const cw_nxo_t *a_key, cw_nxo_t *r_nxo):

  Input(s):
    a_nxo:
      Pointer to a dict nxo.
    a_key:
      Pointer to an nxo.
    r_nxo:
      Pointer to an nxo.
  Output(s):
    retval:
      false:
        Success.
      true:
        a_key not found.
    r_nxo:
      If retval is false, value associated with a_key in a_nxo, otherwise unmodified.
  Exception(s):
    None.
  Description:
    Find a_key in a_nxo and dup its associated value to r_nxo.

uint32_t nxo_dict_count(const cw_nxo_t *a_nxo):

  Input(s):
    a_nxo:
      Pointer to a dict nxo.
  Output(s):
    retval:
      The number of key/value pairs in a_nxo.
  Exception(s):
    None.
  Description:
    Return the number of key/value pairs in a_nxo.

void nxo_dict_iterate(cw_nxo_t *a_nxo, cw_nxo_t *r_nxo):

  Input(s):
    a_nxo:
      Pointer to a dict nxo.
    r_nxo:
      Pointer to an nxo.
  Output(s):
      false:
        Success.
      true:
        a_nxo is empty.
    r_nxo:
      If retval is false, A key in a_nxo, otherwise unmodified.
  Exception(s):
    None.
  Description:
    Iteratively get a key in a_nxo. Each successive call to this function will get the next key, and wrap back around to the first key when all keys have been returned.

Next: 4.10.18 nxo_file Up: 4.10 Classes Previous: 4.10.16 nxo_condition Contents Index