Session Items Factory — WirePlumber 0.4.1 documentation

# Session Items Factory

digraph inheritance { rankdir=LR; GObject -> WpSiFactory; }

struct WpSiFactory

  A factory for session items.

  The most simple way to register a new item implementation would be:

      wp_si_factory_register (core,
         wp_si_factory_new_simple ("foobar", FOO_TYPE_BAR));

  And the most simple way to construct an item from a registered factory:

      item = wp_session_item_make (core, "foobar");

  GObject Properties

  name

    The factory’s name

    `gchar *` | `G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY`

struct _WpSiFactoryClass

  Public Members

  GObjectClass parent_class
  WpSessionItem *(*construct)(WpSiFactory *self, WpCore *core)

const gchar *wp_si_factory_get_name(WpSiFactory *self)

  Gets the name of the factory.

  Parameters

    - self – the factory

  Returns

    the factory name

WpSessionItem *wp_si_factory_construct(WpSiFactory *self, WpCore *core)

  Creates a new instance of the session item that is constructed by this factory.

  Parameters

    - self – the factory

    - core – the core

  Returns

    (transfer full): a new session item instance

void wp_si_factory_register(WpCore *core, WpSiFactory *factory)

  Registers the factory on the core.

  Parameters

    - core – the core

    - factory – (transfer full): the factory to register

WpSiFactory *wp_si_factory_find(WpCore *core, const gchar *factory_name)

  Looks up a factory matching a name.

  Parameters

    - core – the core

    - factory_name – the lookup name

  Returns

    (transfer full) (nullable): the factory matching the lookup name

WpSessionItem *wp_session_item_make(WpCore *core, const gchar *factory_name)

  Finds the factory associated with the given name from the core and uses it to construct a new WpSessionItem.

  Parameters

    - core – the WpCore

    - factory_name – the name of the factory to be used for constructing the object

  Returns

    (transfer full) (nullable): the new session item

WpSiFactory *wp_si_factory_new_simple(const gchar *factory_name, GType si_type)

  Creates a simple factory that constructs objects of a given GType.

  Parameters

    - factory_name – the factory name; must be a static string!

    - si_type – the WpSessionItem subclass type to instantiate for constructing items

  Returns

    (transfer full): the new factory

WP_TYPE_SI_FACTORY (wp_si_factory_get_type ())

  The WpSiFactory GType.