Function panda_sys::object_property_add_link[][src]

pub unsafe extern "C" fn object_property_add_link(
    obj: *mut Object,
    name: *const c_char,
    type_: *const c_char,
    child: *mut *mut Object,
    check: Option<unsafe extern "C" fn(obj: *mut Object, name: *const c_char, val: *mut Object, errp: *mut *mut Error)>,
    flags: ObjectPropertyLinkFlags,
    errp: *mut *mut Error
)
Expand description

object_property_add_link: @obj: the object to add a property to @name: the name of the property @type: the qobj type of the link @child: a pointer to where the link object reference is stored @check: callback to veto setting or NULL if the property is read-only @flags: additional options for the link @errp: if an error occurs, a pointer to an area to store the area

Links establish relationships between objects. Links are unidirectional although two links can be combined to form a bidirectional relationship between objects.

Links form the graph in the object model.

The @check() callback is invoked when object_property_set_link() is called and can raise an error to prevent the link being set. If @check is NULL, the property is read-only and cannot be set.

Ownership of the pointer that @child points to is transferred to the link property. The reference count for *@child is managed by the property from after the function returns till the property is deleted with object_property_del(). If the @flags OBJ_PROP_LINK_UNREF_ON_RELEASE bit is set, the reference count is decremented when the property is deleted.