|
Zephyr Project API 4.4.99
A Scalable Open Source RTOS
|
The common base that gives every type an identity and properties. More...
Files | |
| file | mpipe_object.h |
| Object: the base that every mpipe type embeds. | |
Data Structures | |
| struct | mpipe_object |
| Base object structure. More... | |
Macros | |
| #define | MPIPE_OBJECT_FLAG_BASE BIT(0) |
| Base flag of the object. | |
| #define | MPIPE_OBJECT_FLAG_BIN BIT(1) |
| The object is a Bins and holds children of its own. | |
| #define | MPIPE_PROP_LIST_END -1 |
| Sentinel value to mark the end of property lists. | |
Functions | |
| void | mpipe_object_init (struct mpipe_object *obj) |
| Initialize all fields of mpipe_object to zero. | |
| int | mpipe_object_set_properties (struct mpipe_object *obj,...) |
| Set multiple properties of an mpipe_object. | |
| int | mpipe_object_get_properties (struct mpipe_object *obj,...) |
| Get multiple properties' values of an mpipe_object. | |
The common base that gives every type an identity and properties.
Every mpipe type embeds an Objects as its first member, which is what makes upcasting a plain C cast. The base carries what the framework needs of anything it holds: an id, a pointer to the container that holds it, a list node so a container can keep its children on one list, and a flag field a walker reads to decide whether it may descend.
It also carries the property callbacks. Properties are how an element is configured without the caller knowing its concrete type - a file path, a device, a queue depth - and they are reached through mpipe_object_set_properties and mpipe_object_get_properties rather than by calling the callbacks directly.
A property is not a capability. A property configures one element and nothing else has to agree on it; a capability describes the data crossing a link, so both ends must agree before anything can flow. See Capability Structure.
| #define MPIPE_OBJECT_FLAG_BASE BIT(0) |
#include <mpipe_object.h>
Base flag of the object.
| #define MPIPE_OBJECT_FLAG_BIN BIT(1) |
#include <mpipe_object.h>
The object is a Bins and holds children of its own.
Set by mpipe_bin_init(). This is to tell a walker that an element can be descended into.
| #define MPIPE_PROP_LIST_END -1 |
#include <mpipe_object.h>
Sentinel value to mark the end of property lists.
| int mpipe_object_get_properties | ( | struct mpipe_object * | obj, |
| ... ) |
#include <mpipe_object.h>
Get multiple properties' values of an mpipe_object.
This function gets one or more properties' values of the given object. The arguments must be provided as a sequence of {key, value} pairs, terminated by MPIPE_PROP_LIST_END.
Example usage:
| obj | Pointer to a Objects. |
| ... | A variable list of {uint32_t key, void *val} pairs, terminated by MPIPE_PROP_LIST_END. |
| -ENOTSUP | The object exposes no property getter |
| void mpipe_object_init | ( | struct mpipe_object * | obj | ) |
#include <mpipe_object.h>
Initialize all fields of mpipe_object to zero.
Must be called first when initializing any structure that embeds mpipe_object.
| obj | Pointer to the mpipe_object to initialize. |
| int mpipe_object_set_properties | ( | struct mpipe_object * | obj, |
| ... ) |
#include <mpipe_object.h>
Set multiple properties of an mpipe_object.
This function sets one or more properties on the given object. The arguments must be provided as a sequence of {key, value} pairs, terminated by MPIPE_PROP_LIST_END.
Example usage:
| obj | Pointer to a Objects. |
| ... | A variable list of {uint32_t key, const void *val} pairs, terminated by MPIPE_PROP_LIST_END. |
| -ENOTSUP | The object exposes no property setter |