Lines Matching full:object

2  * QEMU Object Model
28 #define TYPE_OBJECT "object"
35 * @obj: the object that owns the property
38 * @opaque: the object property opaque
43 typedef void (ObjectPropertyAccessor)(Object *obj,
51 * @obj: the object that owns the property
55 * Resolves the #Object corresponding to property @part.
57 * The returned object can also be used as a starting point
61 * returns the #Object corresponding to "@path/@part".
62 * If "@path/@part" is not a valid object path, it returns #NULL.
64 typedef Object *(ObjectPropertyResolve)(Object *obj,
70 * @obj: the object that owns the property
74 * Called when a property is removed from a object.
76 typedef void (ObjectPropertyRelease)(Object *obj,
82 * @obj: the object that owns the property
87 typedef void (ObjectPropertyInit)(Object *obj, ObjectProperty *prop);
105 * @obj: the object that is being removed from the composition tree
107 * Called when an object is being removed from the QOM composition tree.
110 typedef void (ObjectUnparent)(Object *obj);
114 * @obj: the object being freed
116 * Called when an object's last reference is removed.
143 * struct Object:
145 * The base for all objects. The first member of this object is a pointer to
147 * always begins at byte 0 of that structure, as long as any sub-object places
148 * its parent as the first member, we can cast directly to a #Object.
150 * As a result, #Object contains a reference to the objects type as its
151 * first member. This allows identification of the real type of the object at
154 struct Object struct
161 Object *parent; argument
167 * @OBJ_NAME: the object name in uppercase with underscore separators
184 * @OBJ_NAME: the object name in uppercase with underscore separators
206 * @OBJ_NAME: the object name in uppercase with underscore separators
224 * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
228 * - create the typedefs for the object and class structs
232 * The object struct and class struct need to be declared manually.
246 * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
264 * @ModuleObjName: the object name with initial caps
265 * @module_obj_name: the object name in lowercase with underscore separators
266 * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
267 * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore
269 * @ABSTRACT: boolean flag to indicate whether the object can be instantiated
281 module_obj_name##_finalize(Object *obj); \
285 module_obj_name##_init(Object *obj); \
309 * @ModuleObjName: the object name with initial caps
310 * @module_obj_name: the object name in lowercase with underscore separators
311 * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
312 * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore
314 * @ABSTRACT: boolean flag to indicate whether the object can be instantiated
340 * @ModuleObjName: the object name with initial caps
341 * @module_obj_name: the object name in lowercase with underscore separators
342 * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
343 * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore
357 * @ModuleObjName: the object name with initial caps
358 * @module_obj_name: the object name in lowercase with underscore separators
359 * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
360 * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore
380 * @ModuleObjName: the object name with initial caps
381 * @module_obj_name: the object name in lowercase with underscore separators
382 * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
383 * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore
397 * @ModuleObjName: the object name with initial caps
398 * @module_obj_name: the object name in lowercase with underscore separators
399 * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
400 * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore
417 * @ModuleObjName: the object name with initial caps
418 * @module_obj_name: the object name in lowercase with underscore separators
419 * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
420 * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore
438 * @instance_size: The size of the object (derivative of #Object). If
439 * @instance_size is 0, then the size of the object will be the size of the
440 * parent object.
441 * @instance_align: The required alignment of the object. If @instance_align
444 * @instance_init: This function is called to initialize an object. The parent
448 * an object, after all @instance_init functions were called, as well as
450 * @instance_finalize: This function is called during object destruction. This
452 * An object should only free the members that are unique to its type in this
456 * @class_size: The size of the class object (derivative of #ObjectClass)
457 * for this object. If @class_size is 0, then the size of the class will be
483 void (*instance_init)(Object *obj);
484 void (*instance_post_init)(Object *obj);
485 void (*instance_finalize)(Object *obj);
498 * OBJECT:
499 * @obj: A derivative of #Object
501 * Converts an object to a #Object. Since all objects are #Objects,
504 #define OBJECT(obj) \ macro
505 ((Object *)(obj))
525 * this object type.
527 * If an invalid object is passed to this function, a run time assert will be
531 ((type *)object_dynamic_cast_assert(OBJECT(obj), (name), \
551 * @obj: The object to obtain the class for.
554 * This function will return a specific class for a given object. Its generally
556 * from an object.
559 OBJECT_CLASS_CHECK(class, object_get_class(OBJECT(obj)), name)
602 * @obj: the object to convert to an interface
608 ((interface *)object_dynamic_cast_assert(OBJECT((obj)), (name), \
615 * This function will initialize a new object using heap allocated memory.
616 * The returned object has a reference count of 1, and will be freed when
619 * Returns: The newly allocated and instantiated object.
621 Object *object_new_with_class(ObjectClass *klass);
625 * @typename: The name of the type of the object to instantiate.
627 * This function will initialize a new object using heap allocated memory.
628 * The returned object has a reference count of 1, and will be freed when
631 * Returns: The newly allocated and instantiated object.
633 Object *object_new(const char *typename);
637 * @typename: The name of the type of the object to instantiate.
638 * @parent: the parent object
639 * @id: The unique ID of the object
640 * @errp: pointer to error object
643 * This function will initialize a new object using heap allocated memory.
644 * The returned object has a reference count of 1, and will be freed when
647 * The @id parameter will be used when registering the object as a
652 * list. If the object implements the user creatable interface, the
653 * object will be marked complete once all the properties have been
657 * :caption: Creating an object with properties
660 * Object *obj;
676 * The returned object will have one stable reference maintained
677 * for as long as it is present in the object hierarchy.
679 * Returns: The newly allocated, instantiated & initialized object.
681 Object *object_new_with_props(const char *typename,
682 Object *parent,
689 * @typename: The name of the type of the object to instantiate.
690 * @parent: the parent object
691 * @id: The unique ID of the object
692 * @errp: pointer to error object
697 Object *object_new_with_propv(const char *typename,
698 Object *parent,
703 bool object_apply_global_props(Object *obj, const GPtrArray *props,
709 void object_apply_compat_props(Object *obj);
713 * @obj: the object instance to set properties on
714 * @errp: pointer to error object
717 * This function will set a list of properties on an existing object
725 * :caption: Update an object's properties
728 * Object *obj = ...get / create object...;
740 * The returned object will have one stable reference maintained
741 * for as long as it is present in the object hierarchy.
745 bool object_set_props(Object *obj, Error **errp, ...) G_GNUC_NULL_TERMINATED;
749 * @obj: the object instance to set properties on
750 * @errp: pointer to error object
757 bool object_set_propv(Object *obj, Error **errp, va_list vargs);
761 * @obj: A pointer to the memory to be used for the object.
762 * @size: The maximum size available at @obj for the object.
763 * @typename: The name of the type of the object to instantiate.
765 * This function will initialize an object. The memory for the object should
766 * have already been allocated. The returned object has a reference count of 1,
773 * @parentobj: The parent object to add a property to
775 * @childobj: A pointer to the memory to be used for the object.
776 * @size: The maximum size available at @childobj for the object.
777 * @type: The name of the type of the object to instantiate.
781 * This function will initialize an object. The memory for the object should
782 * have already been allocated. The object will then be added as child property
783 * to a parent with object_property_add_child() function. The returned object
785 * so the object will be finalized automatically when the parent gets removed.
789 * If the object implements the user creatable interface, the object will
794 bool object_initialize_child_with_props(Object *parentobj,
801 * @parentobj: The parent object to add a property to
803 * @childobj: A pointer to the memory to be used for the object.
804 * @size: The maximum size available at @childobj for the object.
805 * @type: The name of the type of the object to instantiate.
813 bool object_initialize_child_with_propsv(Object *parentobj,
820 * @parent: The parent object to add a property to
823 * object.
824 * @type: The name of the type of the object to instantiate.
835 void object_initialize_child_internal(Object *parent, const char *propname,
841 * @obj: The object to cast.
845 * object or an interface associated with an object.
849 Object *object_dynamic_cast(Object *obj, const char *typename);
853 * @obj: The object to cast.
865 Object *object_dynamic_cast_assert(Object *obj, const char *typename,
870 * @obj: A derivative of #Object
874 ObjectClass *object_get_class(Object *obj);
878 * @obj: A derivative of #Object.
882 const char *object_get_typename(const Object *obj);
920 * Print the object's class properties to stdout or the monitor.
921 * Return whether an object was found.
927 * @obj: a QOM object
931 * @errp: pointer to error object
936 void object_set_properties_from_keyval(Object *obj, const QDict *qdict,
1046 * @obj: the object
1048 * Increase the reference count of a object. A object cannot be freed as long
1052 Object *object_ref(void *obj);
1056 * @obj: the object
1058 * Decrease the reference count of a object. A object cannot be freed as long
1065 * @obj: the object to add a property to
1077 * @release: called when the property is removed from the object. This is
1078 * meant to allow a property to free its opaque upon object
1081 * @errp: pointer to error object
1086 ObjectProperty *object_property_try_add(Object *obj, const char *name,
1098 * @obj: the object to add a property to
1110 * @release: called when the property is removed from the object. This is
1111 * meant to allow a property to free its opaque upon object
1115 ObjectProperty *object_property_add(Object *obj, const char *name,
1122 void object_property_del(Object *obj, const char *name);
1177 * @obj: the object
1180 * Look up a property for an object.
1184 ObjectProperty *object_property_find(Object *obj, const char *name);
1188 * @obj: the object
1192 * Look up a property for an object.
1196 ObjectProperty *object_property_find_err(Object *obj,
1202 * @klass: the object class
1205 * Look up a property for an object class.
1214 * @klass: the object class
1218 * Look up a property for an object class.
1234 * @obj: the object
1237 * registered against an object instance, its class and all parent classes.
1245 * :caption: Using object property iterators
1256 Object *obj);
1264 * registered against an object class and all parent classes.
1289 void object_unparent(Object *obj);
1293 * @obj: the object
1299 * Reads a property from a object.
1303 bool object_property_get(Object *obj, const char *name, Visitor *v,
1308 * @obj: the object
1317 bool object_property_set_str(Object *obj, const char *name,
1322 * @obj: the object
1330 char *object_property_get_str(Object *obj, const char *name,
1335 * @obj: the object
1340 * Writes an object's canonical path to a property.
1343 * %OBJ_PROP_LINK_STRONG bit, the old target object is
1344 * unreferenced, and a reference is added to the new target object.
1348 bool object_property_set_link(Object *obj, const char *name,
1349 Object *value, Error **errp);
1353 * @obj: the object
1357 * Returns: the value of the property, resolved from a path to an Object,
1359 * string or not a valid object path).
1361 Object *object_property_get_link(Object *obj, const char *name,
1366 * @obj: the object
1375 bool object_property_set_bool(Object *obj, const char *name,
1380 * @obj: the object
1387 bool object_property_get_bool(Object *obj, const char *name,
1392 * @obj: the object
1401 bool object_property_set_int(Object *obj, const char *name,
1406 * @obj: the object
1413 int64_t object_property_get_int(Object *obj, const char *name,
1418 * @obj: the object
1427 bool object_property_set_uint(Object *obj, const char *name,
1432 * @obj: the object
1439 uint64_t object_property_get_uint(Object *obj, const char *name,
1444 * @obj: the object
1453 int object_property_get_enum(Object *obj, const char *name,
1458 * @obj: the object
1465 * Writes a property to a object.
1469 bool object_property_set(Object *obj, const char *name, Visitor *v,
1474 * @obj: the object
1479 * Parses a string and writes the result into a property of an object.
1483 bool object_property_parse(Object *obj, const char *name,
1488 * @obj: the object
1496 char *object_property_print(Object *obj, const char *name, bool human,
1501 * @obj: the object
1507 const char *object_property_get_type(Object *obj, const char *name,
1513 * Returns: the root object of the composition tree
1515 Object *object_get_root(void);
1525 Object *object_get_container(const char *name);
1531 * Get the container object that holds user created
1532 * object instances. This is the object at path
1535 * Returns: the user object container
1537 Object *object_get_objects_root(void);
1542 * Get the container object that holds internally used object
1543 * instances. Any object which is put into this container must not be
1546 * Returns: the internal object container
1548 Object *object_get_internal_root(void);
1552 * @obj: the object
1554 * Returns: The final component in the object's canonical path. The canonical
1556 * %NULL if the object doesn't have a parent (and thus a canonical path).
1558 const char *object_get_canonical_path_component(const Object *obj);
1562 * @obj: the object
1564 * Returns: The canonical path for a object, newly allocated. This is
1568 char *object_get_canonical_path(const Object *obj);
1578 * Absolute paths are derived from the root object and can follow child<> or
1591 * Returns: The matched object or %NULL on path lookup failure.
1593 Object *object_resolve_path(const char *path, bool *ambiguous);
1611 * Returns: The matched object or NULL on path lookup failure.
1613 Object *object_resolve_path_type(const char *path, const char *typename,
1619 * @errp: pointer to error object
1621 * Return the only object in the QOM tree of type @typename.
1625 * Returns: The matched object or NULL on path lookup failure.
1627 Object *object_resolve_type_unambiguous(const char *typename, Error **errp);
1631 * @parent: the object in which to resolve the path
1637 * Returns: The resolved object or NULL on path lookup failure.
1639 Object *object_resolve_path_at(Object *parent, const char *path);
1643 * @parent: the object in which to resolve the path
1649 * Returns: The resolved object or NULL on path lookup failure.
1651 Object *object_resolve_path_component(Object *parent, const char *part);
1655 * @obj: the object to add a property to
1657 * @child: the child object
1658 * @errp: pointer to error object
1661 * of another object. Objects can only be a child of one object.
1666 * The value of a child property as a C string will be the child object's
1668 * The child object itself can be retrieved using object_property_get_link().
1672 ObjectProperty *object_property_try_add_child(Object *obj, const char *name,
1673 Object *child, Error **errp);
1677 * @obj: the object to add a property to
1679 * @child: the child object
1684 ObjectProperty *object_property_add_child(Object *obj, const char *name,
1685 Object *child);
1698 * @obj: the object to add a property to
1700 * @child: the child object
1701 * @errp: pointer to error object
1707 void object_property_allow_set_link(const Object *obj, const char *name,
1708 Object *child, Error **errp);
1712 * @obj: the object to add a property to
1715 * @targetp: a pointer to where the link object reference is stored
1723 * Links form the graph in the object model.
1740 ObjectProperty *object_property_add_link(Object *obj, const char *name,
1741 const char *type, Object **targetp,
1742 void (*check)(const Object *obj, const char *name,
1743 Object *val, Error **errp),
1749 void (*check)(const Object *obj, const char *name,
1750 Object *val, Error **errp),
1755 * @obj: the object to add a property to
1766 ObjectProperty *object_property_add_str(Object *obj, const char *name,
1767 char *(*get)(Object *, Error **),
1768 void (*set)(Object *, const char *, Error **));
1772 char *(*get)(Object *, Error **),
1773 void (*set)(Object *, const char *,
1778 * @obj: the object to add a property to
1788 ObjectProperty *object_property_add_bool(Object *obj, const char *name,
1789 bool (*get)(Object *, Error **),
1790 void (*set)(Object *, bool, Error **));
1794 bool (*get)(Object *, Error **),
1795 void (*set)(Object *, bool, Error **));
1799 * @obj: the object to add a property to
1811 ObjectProperty *object_property_add_enum(Object *obj, const char *name,
1814 int (*get)(Object *, Error **),
1815 void (*set)(Object *, int, Error **));
1821 int (*get)(Object *, Error **),
1822 void (*set)(Object *, int, Error **));
1826 * @obj: the object to add a property to
1835 ObjectProperty *object_property_add_tm(Object *obj, const char *name,
1836 void (*get)(Object *, struct tm *, Error **));
1840 void (*get)(Object *, struct tm *, Error **));
1853 * @obj: the object to add a property to
1863 ObjectProperty *object_property_add_uint8_ptr(Object *obj, const char *name,
1874 * @obj: the object to add a property to
1884 ObjectProperty *object_property_add_uint16_ptr(Object *obj, const char *name,
1895 * @obj: the object to add a property to
1905 ObjectProperty *object_property_add_uint32_ptr(Object *obj, const char *name,
1916 * @obj: the object to add a property to
1926 ObjectProperty *object_property_add_uint64_ptr(Object *obj, const char *name,
1937 * @obj: the object to add a property to
1939 * @target_obj: the object to forward property access to
1940 * @target_name: the name of the property on the forwarded object
1942 * Add an alias for a property on an object. This function will add a property
1946 * this property exists. In the case of a child object or an alias on the same
1947 * object this will be the case. For aliases to other objects the caller is
1952 ObjectProperty *object_property_add_alias(Object *obj, const char *name,
1953 Object *target_obj, const char *target_name);
1957 * @obj: the object to add a property to
1959 * @target: the object to be referred by the link
1961 * Add an unmodifiable link for a property on an object. This function will
1971 ObjectProperty *object_property_add_const_link(Object *obj, const char *name,
1972 Object *target);
1976 * @obj: the object owning the property
1978 * @description: the description of the property on the object
1980 * Set an object property's description.
1984 void object_property_set_description(Object *obj, const char *name,
1991 * @obj: the object whose children will be navigated
2003 int object_child_foreach(Object *obj, int (*fn)(Object *child, void *opaque),
2008 * @obj: the object whose children will be navigated
2021 int object_child_foreach_recursive(Object *obj,
2022 int (*fn)(Object *child, void *opaque),
2027 * @obj: the parent object
2028 * @name: the name of the parent object's property to add
2030 * Add a newly created container object to a parent object.
2032 * Returns: the newly created container object. Its reference count is 1,
2033 * and the reference is owned by the parent object.
2035 Object *object_property_add_new_container(Object *obj, const char *name);
2050 G_DEFINE_AUTOPTR_CLEANUP_FUNC(Object, object_unref)