Function anj_dm_add_obj

Function Documentation

int anj_dm_add_obj(anj_t *anj, const anj_dm_obj_t *obj)

Adds an Object to the data model and validates its structure.

obj parameter is not copied; the user must ensure that it remains valid for the entire lifetime of the anj object or until it is removed using anj_dm_remove_obj.

Note

Validation of the Object, its Instances, and Resources is performed only in debug builds (i.e., when the NDEBUG macro is not defined). In release builds, internal consistency checks are skipped.

Warning

Object Instances in the obj structure must be stored in ascending order by their oid.

Parameters:
  • anj – Anjay object.

  • obj – Pointer to the Object definition struct.

Returns:

0 on success, a non-zero value in case of an error.