All Data Structures Namespaces Files Functions Groups Pages
Accessing header and data values

## Functions

int | codes_get_offset (codes_handle *h, const char *key, size_t *offset)
| Get the number offset of a key, in a message if several keys of the same name are present, the offset of the last one is returned. More...
int | codes_get_size (codes_handle *h, const char *key, size_t *size)
| Get the number of coded value from a key, if several keys of the same name are present, the total sum is returned. More...
int | codes_get_length (codes_handle *h, const char *key, size_t *length)
| Get the length of the string representation of the key, if several keys of the same name are present, the maximum length is returned. More...
int | codes_get_long (codes_handle *h, const char *key, long *value)
| Get a long value from a key, if several keys of the same name are present, the last one is returned. More...
int | codes_get_double (codes_handle *h, const char *key, double *value)
| Get a double value from a key, if several keys of the same name are present, the last one is returned. More...
int | codes_get_double_element (codes_handle *h, const char *key, int i, double *value)
| Get as double the i-th element of the "key" array. More...
int | codes_get_double_elements (codes_handle *h, const char *key, int *i, long size, double *value)
| Get as double array the elements of the "key" array whose indexes are listed in the input array i. More...
int | codes_get_string (codes_handle *h, const char *key, char *mesg, size_t *length)
| Get a string value from a key, if several keys of the same name are present, the last one is returned. More...
int | codes_get_bytes (codes_handle *h, const char *key, unsigned char *bytes, size_t *length)
| Get raw bytes values from a key. More...
int | codes_get_double_array (codes_handle *h, const char *key, double *vals, size_t *length)
| Get double array values from a key. More...
int | codes_get_long_array (codes_handle *h, const char *key, long *vals, size_t *length)
| Get long array values from a key. More...
int | codes_copy_namespace (codes_handle *dest, const char *name, codes_handle *src)
| Copy the keys belonging to a given namespace from a source handle to a destination handle. More...
int | codes_set_long (codes_handle *h, const char *key, long val)
| Set a long value from a key. More...
int | codes_set_double (codes_handle *h, const char *key, double val)
| Set a double value from a key. More...
int | codes_set_string (codes_handle *h, const char *key, const char *mesg, size_t *length)
| Set a string value from a key. More...
int | codes_set_bytes (codes_handle *h, const char *key, const unsigned char *bytes, size_t *length)
| Set a bytes array from a key. More...
int | codes_set_double_array (codes_handle *h, const char *key, const double *vals, size_t length)
| Set a double array from a key. More...
int | codes_set_force_double_array (codes_handle *h, const char *key, const double *vals, size_t length)
| Same as codes_set_double_array but allows setting of READ-ONLY keys like codedValues. More...
int | codes_set_long_array (codes_handle *h, const char *key, const long *vals, size_t length)
| Set a long array from a key. More...
int | codes_set_string_array (codes_handle *h, const char *key, const char **vals, size_t length)
| Set a string array from a key. More...

## Detailed Description

## Function Documentation

int codes_copy_namespace | ( | codes_handle * | dest,
|  | const char * | name,
|  | codes_handle * | src
| ) |  |

Copy the keys belonging to a given namespace from a source handle to a destination handle.

Parameters

  dest | : destination handle
  name | : namespace
  src | : source handle

Returns
  0 if OK, integer value on error

int codes_get_bytes | ( | codes_handle * | h,
|  | const char * | key,
|  | unsigned char * | bytes,
|  | size_t * | length
| ) |  |

Get raw bytes values from a key.

If several keys of the same name are present, the last one is returned

See Also
  codes_set_bytes

Parameters

  h | : the handle to get the data from
  key | : the key to be searched
  bytes | : the address of a byte array where the data will be retrieved
  length | : the address of a size_t that contains allocated length of the byte array on input, and that contains the actual length of the byte array on output

Returns
  0 if OK, integer value on error

int codes_get_double | ( | codes_handle * | h,
|  | const char * | key,
|  | double * | value
| ) |  |

Get a double value from a key, if several keys of the same name are present, the last one is returned.

See Also
  codes_set_double

Parameters

  h | : the handle to get the data from
  key | : the key to be searched
  value | : the address of a double where the data will be retrieved

Returns
  0 if OK, integer value on error

int codes_get_double_array | ( | codes_handle * | h,
|  | const char * | key,
|  | double * | vals,
|  | size_t * | length
| ) |  |

Get double array values from a key.

If several keys of the same name are present, the last one is returned

See Also
  codes_set_double_array

Parameters

  h | : the handle to get the data from
  key | : the key to be searched
  vals | : the address of a double array where the data will be retrieved
  length | : the address of a size_t that contains allocated length of the double array on input, and that contains the actual length of the double array on output

Returns
  0 if OK, integer value on error

int codes_get_double_element | ( | codes_handle * | h,
|  | const char * | key,
|  | int | i,
|  | double * | value
| ) |  |

Get as double the i-th element of the "key" array.

Parameters

  h | : the handle to get the data from
  key | : the key to be searched
  i | : zero-based index
  value | : the address of a double where the data will be retrieved

Returns
  0 if OK, integer value on error

int codes_get_double_elements | ( | codes_handle * | h,
|  | const char * | key,
|  | int * | i,
|  | long | size,
|  | double * | value
| ) |  |

Get as double array the elements of the "key" array whose indexes are listed in the input array i.

Parameters

  h | : the handle to get the data from
  key | : the key to be searched
  i | : zero-based array of indexes
  size | : size of the i and value arrays
  value | : the double array for the data values

Returns
  0 if OK, integer value on error

int codes_get_length | ( | codes_handle * | h,
|  | const char * | key,
|  | size_t * | length
| ) |  |

Get the length of the string representation of the key, if several keys of the same name are present, the maximum length is returned.

Parameters

  h | : the handle to get the offset from
  key | : the key to be searched
  length | : the address of a size_t where the length will be set

Returns
  0 if OK, integer value on error

int codes_get_long | ( | codes_handle * | h,
|  | const char * | key,
|  | long * | value
| ) |  |

Get a long value from a key, if several keys of the same name are present, the last one is returned.

See Also
  codes_set_long

Parameters

  h | : the handle to get the data from
  key | : the key to be searched
  value | : the address of a long where the data will be retrieved

Returns
  0 if OK, integer value on error

int codes_get_long_array | ( | codes_handle * | h,
|  | const char * | key,
|  | long * | vals,
|  | size_t * | length
| ) |  |

Get long array values from a key.

If several keys of the same name are present, the last one is returned

See Also
  codes_set_long_array

Parameters

  h | : the handle to get the data from
  key | : the key to be searched
  vals | : the address of a long array where the data will be retrieved
  length | : the address of a size_t that contains allocated length of the long array on input, and that contains the actual length of the long array on output

Returns
  0 if OK, integer value on error

int codes_get_offset | ( | codes_handle * | h,
|  | const char * | key,
|  | size_t * | offset
| ) |  |

Get the number offset of a key, in a message if several keys of the same name are present, the offset of the last one is returned.

Parameters

  h | : the handle to get the offset from
  key | : the key to be searched
  offset | : the address of a size_t where the offset will be set

Returns
  0 if OK, integer value on error

int codes_get_size | ( | codes_handle * | h,
|  | const char * | key,
|  | size_t * | size
| ) |  |

Get the number of coded value from a key, if several keys of the same name are present, the total sum is returned.

Parameters

  h | : the handle to get the offset from
  key | : the key to be searched
  size | : the address of a size_t where the size will be set

Returns
  0 if OK, integer value on error

int codes_get_string | ( | codes_handle * | h,
|  | const char * | key,
|  | char * | mesg,
|  | size_t * | length
| ) |  |

Get a string value from a key, if several keys of the same name are present, the last one is returned.

See Also
  codes_set_string

Parameters

  h | : the handle to get the data from
  key | : the key to be searched
  mesg | : the address of a string where the data will be retrieved
  length | : the address of a size_t that contains allocated length of the string on input, and that contains the actual length of the string on output

Returns
  0 if OK, integer value on error

int codes_set_bytes | ( | codes_handle * | h,
|  | const char * | key,
|  | const unsigned char * | bytes,
|  | size_t * | length
| ) |  |

Set a bytes array from a key.

If several keys of the same name are present, the last one is set

See Also
  codes_get_bytes

Parameters

  h | : the handle to set the data to
  key | : the key to be searched
  bytes | : the address of a byte array where the data will be read
  length | : the address of a size_t that contains the length of the byte array on input, and that contains the actual packed length of the byte array on output

Returns
  0 if OK, integer value on error

int codes_set_double | ( | codes_handle * | h,
|  | const char * | key,
|  | double | val
| ) |  |

Set a double value from a key.

If several keys of the same name are present, the last one is set

See Also
  codes_get_double

Parameters

  h | : the handle to set the data to
  key | : the key to be searched
  val | : a double where the data will be read

Returns
  0 if OK, integer value on error

int codes_set_double_array | ( | codes_handle * | h,
|  | const char * | key,
|  | const double * | vals,
|  | size_t | length
| ) |  |

Set a double array from a key.

If several keys of the same name are present, the last one is set

See Also
  codes_get_double_array

Parameters

  h | : the handle to set the data to
  key | : the key to be searched
  vals | : the address of a double array where the data will be read
  length | : a size_t that contains the length of the byte array on input

Returns
  0 if OK, integer value on error

int codes_set_force_double_array | ( | codes_handle * | h,
|  | const char * | key,
|  | const double * | vals,
|  | size_t | length
| ) |  |

Same as codes_set_double_array but allows setting of READ-ONLY keys like codedValues.

Use with great caution!!

int codes_set_long | ( | codes_handle * | h,
|  | const char * | key,
|  | long | val
| ) |  |

Set a long value from a key.

If several keys of the same name are present, the last one is set

See Also
  codes_get_long

Parameters

  h | : the handle to set the data to
  key | : the key to be searched
  val | : a long where the data will be read

Returns
  0 if OK, integer value on error

int codes_set_long_array | ( | codes_handle * | h,
|  | const char * | key,
|  | const long * | vals,
|  | size_t | length
| ) |  |

Set a long array from a key.

If several keys of the same name are present, the last one is set

See Also
  codes_get_long_array

Parameters

  h | : the handle to set the data to
  key | : the key to be searched
  vals | : the address of a long array where the data will be read
  length | : a size_t that contains the length of the long array on input

Returns
  0 if OK, integer value on error

int codes_set_string | ( | codes_handle * | h,
|  | const char * | key,
|  | const char * | mesg,
|  | size_t * | length
| ) |  |

Set a string value from a key.

If several keys of the same name are present, the last one is set

See Also
  codes_get_string

Parameters

  h | : the handle to set the data to
  key | : the key to be searched
  mesg | : the address of a string where the data will be read
  length | : the address of a size_t that contains the length of the string on input, and that contains the actual packed length of the string on output

Returns
  0 if OK, integer value on error

int codes_set_string_array | ( | codes_handle * | h,
|  | const char * | key,
|  | const char ** | vals,
|  | size_t | length
| ) |  |

Set a string array from a key.

If several keys of the same name are present, the last one is set

See Also
  codes_get_long_array

Parameters

  h | : the handle to set the data to
  key | : the key to be searched
  vals | : the address of a string array where the data will be read
  length | : a size_t that contains the length of the array on input

Returns
  0 if OK, integer value on error