## GUPnPResourceFactory

GUPnPResourceFactory — Class for resource and resource proxy object creation.

## Synopsis

                        GUPnPResourceFactory;
    GUPnPResourceFactory * gupnp_resource_factory_new       (void);
    GUPnPResourceFactory * gupnp_resource_factory_get_default
                                                            (void);
    void                gupnp_resource_factory_register_resource_type
                                                            (GUPnPResourceFactory *factory,
                                                             const char *upnp_type,
                                                             GType type);
    gboolean            gupnp_resource_factory_unregister_resource_type
                                                            (GUPnPResourceFactory *factory,
                                                             const char *upnp_type);
    void                gupnp_resource_factory_register_resource_proxy_type
                                                            (GUPnPResourceFactory *factory,
                                                             const char *upnp_type,
                                                             GType type);
    gboolean            gupnp_resource_factory_unregister_resource_proxy_type
                                                            (GUPnPResourceFactory *factory,
                                                             const char *upnp_type);

## Object Hierarchy

      GObject
       +----GUPnPResourceFactory

## Description

GUPnPResourceFactory objects are used by GUPnPControlPoint, GUPnPDeviceProxy and GUPnPDevice to create resource proxy and resource objects. Register UPnP type - GType pairs to have resource or resource proxy objects created with the specified GType whenever an object for a resource of the specified UPnP type is requested. The GTypes need to be derived from the relevant resource or resource proxy type (e.g. a device proxy type needs to be derived from GUPnPDeviceProxy).

## Details

### GUPnPResourceFactory

    typedef struct _GUPnPResourceFactory GUPnPResourceFactory;

This struct contains private data only, and should be accessed using the functions below.

### gupnp_resource_factory_new ()

    GUPnPResourceFactory * gupnp_resource_factory_new       (void);

Create a new GUPnPResourceFactory object.

Returns : | A GUPnPResourceFactory object.

### gupnp_resource_factory_get_default ()

    GUPnPResourceFactory * gupnp_resource_factory_get_default
                                                            (void);

Get the default singleton GUPnPResourceFactory object.

Returns : | A `GUPnPResourceFactory` object.

### gupnp_resource_factory_register_resource_type ()

    void                gupnp_resource_factory_register_resource_type
                                                            (GUPnPResourceFactory *factory,
                                                             const char *upnp_type,
                                                             GType type);

Registers the GType `type` for the resource of UPnP type `upnp_type`. After this call, the factory `factory` will create object of GType `type` each time it is asked to create a resource object for UPnP type `upnp_type`.

Note: GType `type` must be a derived type of GUPNP_TYPE_DEVICE if resource is a device or GUPNP_TYPE_SERVICE if its a service.

`factory` : | A GUPnPResourceFactory.
`upnp_type` : | The UPnP type name of the resource.
`type` : | The requested GType assignment for the resource.

### gupnp_resource_factory_unregister_resource_type ()

    gboolean            gupnp_resource_factory_unregister_resource_type
                                                            (GUPnPResourceFactory *factory,
                                                             const char *upnp_type);

Unregisters the GType assignment for the resource of UPnP type `upnp_type`.

`factory` : | A GUPnPResourceFactory.
`upnp_type` : | The UPnP type name of the resource.
Returns : | `TRUE` if GType assignment was removed successfully, `FALSE` otherwise.

### gupnp_resource_factory_register_resource_proxy_type ()

    void                gupnp_resource_factory_register_resource_proxy_type
                                                            (GUPnPResourceFactory *factory,
                                                             const char *upnp_type,
                                                             GType type);

Registers the GType `type` for the proxy of resource of UPnP type `upnp_type`. After this call, the factory `factory` will create object of GType `type` each time it is asked to create a resource proxy object for UPnP type `upnp_type`.

Note: GType `type` must be a derived type of GUPNP_TYPE_DEVICE_PROXY if resource is a device or GUPNP_TYPE_SERVICE_PROXY if its a service.

`factory` : | A GUPnPResourceFactory.
`upnp_type` : | The UPnP type name of the resource.
`type` : | The requested GType assignment for the resource proxy.

### gupnp_resource_factory_unregister_resource_proxy_type ()

    gboolean            gupnp_resource_factory_unregister_resource_proxy_type
                                                            (GUPnPResourceFactory *factory,
                                                             const char *upnp_type);

Unregisters the GType assignment for the proxy of resource of UPnP type `upnp_type`.

`factory` : | A GUPnPResourceFactory.
`upnp_type` : | The UPnP type name of the resource.
Returns : | `TRUE` if GType assignment was removed successfully, `FALSE` otherwise.