Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

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.

Detailed Description

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.

Macro Definition Documentation

◆ MPIPE_OBJECT_FLAG_BASE

#define MPIPE_OBJECT_FLAG_BASE   BIT(0)

#include <mpipe_object.h>

Base flag of the object.

◆ MPIPE_OBJECT_FLAG_BIN

#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.

◆ MPIPE_PROP_LIST_END

#define MPIPE_PROP_LIST_END   -1

#include <mpipe_object.h>

Sentinel value to mark the end of property lists.

Function Documentation

◆ mpipe_object_get_properties()

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:

mpipe_object_get_properties(obj, "key1", val1, "key2", val2, MPIPE_PROP_LIST_END);
int mpipe_object_get_properties(struct mpipe_object *obj,...)
Get multiple properties' values of an mpipe_object.
#define MPIPE_PROP_LIST_END
Sentinel value to mark the end of property lists.
Definition mpipe_object.h:57
Parameters
objPointer to a Objects.
...A variable list of {uint32_t key, void *val} pairs, terminated by MPIPE_PROP_LIST_END.
Returns
0 on success, else the first failing getter's error, leaving the remaining pairs unread
Return values
-ENOTSUPThe object exposes no property getter

◆ mpipe_object_init()

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.

Parameters
objPointer to the mpipe_object to initialize.

◆ mpipe_object_set_properties()

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:

mpipe_object_set_properties(obj, "key1", val1, "key2", val2, MPIPE_PROP_LIST_END);
int mpipe_object_set_properties(struct mpipe_object *obj,...)
Set multiple properties of an mpipe_object.
Parameters
objPointer to a Objects.
...A variable list of {uint32_t key, const void *val} pairs, terminated by MPIPE_PROP_LIST_END.
Returns
0 on success, else the first failing setter's error, leaving the remaining pairs unapplied
Return values
-ENOTSUPThe object exposes no property setter