TIM SDK
TIM API C
object.h File Reference

Description

Base object.

Macros

#define ta_object_invalid   ((ta_object_t)0)
 Invalid object (null-pointer).
 

Typedefs

typedef struct _ta_object * ta_object_t
 Opaque object handler.
 

Functions

ta_e_result_code_t ta_object_retain (ta_object_t object)
 Retain object instance. More...
 
ta_e_result_code_t ta_object_release (ta_object_t object)
 Release object instance. More...
 
ta_e_result_code_t ta_object_release_if_valid (ta_object_t object)
 Release object instance if object is not ta_object_invalid. More...
 
ta_e_result_code_t ta_object_to_string (ta_object_t object, ta_object_t *string)
 String representation of object instance. More...
 

Function Documentation

◆ ta_object_release()

ta_e_result_code_t ta_object_release ( ta_object_t  object)

Release object instance.

Object instance is destroyed once nobody retains the object instance anymore.

Parameters
[in]objectObject instance to release.
Return values
ta_c_rc_okObject instance has been released.
ta_c_rc_invalid_argumentobject is ta_object_invalid.
ta_c_rc_*Last object instance released but failed disposing of object.

◆ ta_object_release_if_valid()

ta_e_result_code_t ta_object_release_if_valid ( ta_object_t  object)

Release object instance if object is not ta_object_invalid.

Convenience method to clean up object instance which are potentially not created yet. If you use this method make sure to always initialize ta_object_t with ta_object_invalid.

Parameters
[in]objectObject instance to release. Object instance can be ta_object_invalid.
Return values
ta_c_rc_okIf object instance is not ta_object_invalid object instance has been released.
ta_c_rc_*Last object instance released but failed disposing of object.

◆ ta_object_retain()

ta_e_result_code_t ta_object_retain ( ta_object_t  object)

Retain object instance.

Retain object instance ensures the instance is keep alive as long as the user requires working with the object instance. Call ta_object_release if the user does not access the object instance anymore in the future. The object instance is destroyed once nobody retains the object instance anymore.

Parameters
[in]objectObject instance to retain.
Return values
ta_c_rc_okObject instance retained.
ta_c_rc_invalid_argumentobject is ta_object_invalid.

◆ ta_object_to_string()

ta_e_result_code_t ta_object_to_string ( ta_object_t  object,
ta_object_t string 
)

String representation of object instance.

For debugging use. Object instance produces a string representing the object instance content. Depending on the object instance this can be a short or long string.

Note
Object is allowed to be ta_object_invalid. In this case a string with content "(null)" is produced.
Parameters
[in]objectObject instance to get string representation for.
[out]stringPointer to variable to write object instance to. Object instance is retained.
Return values
ta_c_rc_okObject instance written to string. Object instance has been retained.
ta_c_rc_invalid_argumentstring is null-pointer.
ta_c_rc_out_of_memoryFailed allocating memory.