Files
wireplumber/lib/wp/object-manager.h
George Kiagiadakis 2f3f5f8e66 lib: refactor WpProxy
This is an attempt to unclutter the API of WpProxy and
split functionality into smaller pieces, making it easier
to work with.

In this new class layout, we have the following classes:

- WpObject: base class for everything; handles activating
|           and deactivating "features"
|- WpProxy: base class for anything that wraps a pw_proxy;
 |          handles events from pw_proxy and nothing more
 |- WpGlobalProxy: handles integration with the registry

All the other classes derive from WpGlobalProxy. The reason
for separating WpGlobalProxy from WpProxy, though, is that
classes such as WpImplNode / WpSpaDevice can also derive from
WpProxy now, without interfacing with the registry.

All objects that come with an "info" structure and have properties
and/or params also implement the WpPipewireObject interface. This
provides the API to query properties and get/set params. Essentially,
this is implemented by all classes except WpMetadata (pw_metadata
does not have info)

This interface is implemented on each object separately, using
a private "mixin", which is a set of vfunc implementations and helper
functions (and macros) to facilitate the implementation of this interface.

A notable difference to the old WpProxy is that now features can be
deactivated, so it is possible to enable something and later disable
it again.

This commit disables modules, tests, tools, etc, to avoid growing the
patch more, while ensuring that the project compiles.
2020-11-13 19:54:48 +02:00

79 lines
1.7 KiB
C

/* WirePlumber
*
* Copyright © 2019 Collabora Ltd.
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
*
* SPDX-License-Identifier: MIT
*/
#ifndef __WIREPLUMBER_OBJECT_MANAGER_H__
#define __WIREPLUMBER_OBJECT_MANAGER_H__
#include <glib-object.h>
#include "object.h"
#include "iterator.h"
#include "object-interest.h"
G_BEGIN_DECLS
/**
* WP_TYPE_OBJECT_MANAGER:
*
* The #WpObjectManager #GType
*/
#define WP_TYPE_OBJECT_MANAGER (wp_object_manager_get_type ())
WP_API
G_DECLARE_FINAL_TYPE (WpObjectManager, wp_object_manager, WP, OBJECT_MANAGER, GObject)
WP_API
WpObjectManager * wp_object_manager_new (void);
/* installation */
WP_API
gboolean wp_object_manager_is_installed (WpObjectManager * self);
/* interest */
WP_API
void wp_object_manager_add_interest (WpObjectManager * self,
GType gtype, ...) G_GNUC_NULL_TERMINATED;
WP_API
void wp_object_manager_add_interest_full (WpObjectManager * self,
WpObjectInterest * interest);
/* object features */
WP_API
void wp_object_manager_request_object_features (WpObjectManager *self,
GType object_type, WpObjectFeatures wanted_features);
/* object inspection */
WP_API
guint wp_object_manager_get_n_objects (WpObjectManager * self);
WP_API
WpIterator * wp_object_manager_iterate (WpObjectManager * self);
WP_API
WpIterator * wp_object_manager_iterate_filtered (WpObjectManager * self,
GType gtype, ...);
WP_API
WpIterator * wp_object_manager_iterate_filtered_full (WpObjectManager * self,
WpObjectInterest * interest);
WP_API
gpointer wp_object_manager_lookup (WpObjectManager * self,
GType gtype, ...) G_GNUC_NULL_TERMINATED;
WP_API
gpointer wp_object_manager_lookup_full (WpObjectManager * self,
WpObjectInterest * interest);
G_END_DECLS
#endif