glibmm 2.78.1

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gio::DBus::ObjectManagerServer Class Reference
D-Bus API

Service-side object manager. More...

`#include <giomm/dbusobjectmanagerserver.h>`

Inheritance diagram for Gio::DBus::ObjectManagerServer:
[legend]

## Public Member Functions
| ObjectManagerServer (ObjectManagerServer &&src) noexcept
ObjectManagerServer & | operator= (ObjectManagerServer &&src) noexcept
| ~ObjectManagerServer () noexcept override
GDBusObjectManagerServer * | gobj ()
| Provides access to the underlying C GObject.
const GDBusObjectManagerServer * | gobj () const
| Provides access to the underlying C GObject.
GDBusObjectManagerServer * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr< Connection > | get_connection ()
| Gets the Gio::DBus::Connection used by manager.
Glib::RefPtr< const Connection > | get_connection () const
| Gets the Gio::DBus::Connection used by manager.
void | set_connection (const Glib::RefPtr< Connection > &connection)
| Exports all objects managed by manager on connection.
void | export_object (const Glib::RefPtr< Gio::DBus::ObjectSkeleton > &object)
| Exports object on manager.
void | export_uniquely (const Glib::RefPtr< Gio::DBus::ObjectSkeleton > &object)
| Like g_dbus_object_manager_server_export() but appends a string of the form _N (with N being a natural number) to object's object path if an object with the given path already exists.
bool | is_exported (const Glib::RefPtr< Gio::DBus::ObjectSkeleton > &object) const
| Returns whether object is currently exported on manager.
bool | unexport (const Glib::ustring &object_path)
| If manager has an object at path, removes the object.
Glib::PropertyProxy< Glib::RefPtr< Connection > > | property_connection ()
| The Gio::DBus::Connection to export objects on.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Connection > > | property_connection () const
| The Gio::DBus::Connection to export objects on.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_object_path () const
| The object path to register the manager object at.
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark & key)
void | set_data (const Quark & key, void *data)
void | set_data_with_c_callback (const Quark & key, void *data, GDestroyNotify notify)
void | set_data (const Quark & key, void *data, DestroyNotify notify)
| Prefer set_data_with_c_callback() with a callback with C linkage.
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring & property_name, const Glib::ValueBase & value)
| You probably want to use a specific property_*() accessor method instead.
void | get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const
| You probably want to use a specific property_*() accessor method instead.
template<class PropertyType >
void | set_property (const Glib::ustring & property_name, const PropertyType & value)
| You probably want to use a specific property_*() accessor method instead.
template<class PropertyType >
void | get_property (const Glib::ustring & property_name, PropertyType & value) const
| You probably want to use a specific property_*() accessor method instead.
template<class PropertyType >
PropertyType | get_property (const Glib::ustring & property_name) const
| You probably want to use a specific property_*() accessor method instead.
sigc::connection | connect_property_changed (const Glib::ustring & property_name, const sigc::slot< void()> &slot)
| You can use the signal_changed() signal of the property proxy instead.
sigc::connection | connect_property_changed (const Glib::ustring & property_name, sigc::slot< void()> &&slot)
| You can use the signal_changed() signal of the property proxy instead.
void | freeze_notify ()
| Increases the freeze count on object.
void | thaw_notify ()
| Reverts the effect of a previous call to freeze_notify().
virtual void | reference () const
| Increment the reference count for this object.
virtual void | unreference () const
| Decrement the reference count for this object.
GObject * | gobj ()
| Provides access to the underlying C GObject.
const GObject * | gobj () const
| Provides access to the underlying C GObject.
GObject * | gobj_copy () const
| Give a ref-ed copy to someone. Use for direct struct access.
Public Member Functions inherited from Gio::DBus::ObjectManager
| ObjectManager (ObjectManager &&src) noexcept
ObjectManager & | operator= (ObjectManager &&src) noexcept
| ~ObjectManager () noexcept override
GDBusObjectManager * | gobj ()
| Provides access to the underlying C GObject.
const GDBusObjectManager * | gobj () const
| Provides access to the underlying C GObject.
Glib::ustring | get_object_path () const
| Gets the object path that manager is for.
std::vector< Glib::RefPtr< Gio::DBus::Object > > | get_objects ()
| Gets all DBusObject objects known to manager.
std::vector< Glib::RefPtr< const Gio::DBus::Object > > | get_objects () const
| Gets all DBusObject objects known to manager.
Glib::RefPtr< Gio::DBus::Object > | get_object (const Glib::ustring &object_path)
| Gets the DBusObject at object_path, if any.
Glib::RefPtr< const Gio::DBus::Object > | get_object (const Glib::ustring &object_path) const
| Gets the DBusObject at object_path, if any.
Glib::RefPtr< Gio::DBus::Interface > | get_interface (const Glib::ustring &object_path, const Glib::ustring &interface_name)
| Gets the interface proxy for interface_name at object_path, if any.
Glib::RefPtr< const Gio::DBus::Interface > | get_interface (const Glib::ustring &object_path, const Glib::ustring &interface_name) const
| Gets the interface proxy for interface_name at object_path, if any.
Public Member Functions inherited from Glib::Interface
| Interface ()
| A Default constructor.
| Interface (Interface &&src) noexcept
Interface & | operator= (Interface &&src) noexcept
| Interface (const Glib::Interface_Class &interface_class)
| Called by constructors of derived classes.
| Interface (GObject *castitem)
| Called by constructors of derived classes.
| ~Interface () noexcept override
| Interface (const Interface &)=delete
Interface & | operator= (const Interface &)=delete
GObject * | gobj ()
const GObject * | gobj () const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.
static Glib::RefPtr< ObjectManagerServer > | create (const Glib::ustring &object_path)
| Creates a new Gio::DBus::ObjectManagerServer object.
Static Public Member Functions inherited from Gio::DBus::ObjectManager
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Member Functions
| ObjectManagerServer (const Glib::ustring &object_path)
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor.
| ObjectBase (const char *custom_type_name)
| A derived constructor always overrides this choice.
| ObjectBase (const std::type_info &custom_type_info)
| This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually.
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
Protected Member Functions inherited from Gio::DBus::ObjectManager
| ObjectManager ()
| You should derive from this class to use it.
virtual Glib::ustring | get_object_path_vfunc () const
virtual std::vector< Glib::RefPtr< Gio::DBus::Object > > | get_objects_vfunc () const
virtual Glib::RefPtr< Gio::DBus::Object > | get_object_vfunc (const Glib::ustring &object_path) const
virtual Glib::RefPtr< Gio::DBus::Interface > | get_interface_vfunc (const Glib::ustring &object_path, const Glib::ustring &interface_name) const
virtual void | on_object_added (const Glib::RefPtr< Gio::DBus::Object > &object)
| This is a default handler for the signal signal_object_added().
virtual void | on_object_removed (const Glib::RefPtr< Gio::DBus::Object > &object)
| This is a default handler for the signal signal_object_removed().
virtual void | on_interface_added (const Glib::RefPtr< Gio::DBus::Object > &object, const Glib::RefPtr< Gio::DBus::Interface > &iface)
| This is a default handler for the signal signal_interface_added().
virtual void | on_interface_removed (const Glib::RefPtr< Gio::DBus::Object > &object, const Glib::RefPtr< Gio::DBus::Interface > &iface)
| This is a default handler for the signal signal_interface_removed().

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gio::DBus::ObjectManagerServer > | wrap (GDBusObjectManagerServer *object, bool take_copy=false)
| A Glib::wrap() method for this object.
Related Symbols inherited from Glib::Object
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Related Symbols inherited from Gio::DBus::ObjectManager
Glib::RefPtr< Gio::DBus::ObjectManager > | wrap (GDBusObjectManager *object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Additional Inherited Members
Public Types inherited from Glib::Object
using | DestroyNotify = void (*)(gpointer data)
Public Attributes inherited from Gio::DBus::ObjectManager
Glib::SignalProxy< void(const Glib::RefPtr< Gio::DBus::Object > &) | signal_object_added )()
Glib::SignalProxy< void(const Glib::RefPtr< Gio::DBus::Object > &) | signal_object_removed )()
Glib::SignalProxy< void(const Glib::RefPtr< Gio::DBus::Object > &, const Glib::RefPtr< Gio::DBus::Interface > &) | signal_interface_added )()
Glib::SignalProxy< void(const Glib::RefPtr< Gio::DBus::Object > &, const Glib::RefPtr< Gio::DBus::Interface > &) | signal_interface_removed )()

## Detailed Description

Service-side object manager.

Gio::DBus::ObjectManagerServer is used to export Gio::DBus::Object instances using the standardized org.freedesktop.DBus.ObjectManager interface. For example, remote D-Bus clients can get all objects and properties in a single call. Additionally, any change in the object hierarchy is broadcast using signals. This means that D-Bus clients can keep caches up to date by only listening to D-Bus signals.

The recommended path to export an object manager at is the path form of the well-known name of a D-Bus service, or below. For example, if a D-Bus service is available at the well-known name `net.example.ExampleService1`, the object manager should typically be exported at `/net/example/ExampleService1`, or below (to allow for multiple object managers in a service).

It is supported, but not recommended, to export an object manager at the root path, `/`.

See Gio::DBus::ObjectManagerClient for the client-side code that is intended to be used with ObjectManagerServer or any D-Bus object implementing the org.freedesktop.DBus.ObjectManager interface.

Since glibmm 2.62

## Constructor & Destructor Documentation

## ◆ ObjectManagerServer() [1/2]

Gio::DBus::ObjectManagerServer::ObjectManagerServer | ( | ObjectManagerServer && | src | ) |
| noexcept

## ◆ ~ObjectManagerServer()

Gio::DBus::ObjectManagerServer::~ObjectManagerServer | ( |  | ) |
| override noexcept

## ◆ ObjectManagerServer() [2/2]

Gio::DBus::ObjectManagerServer::ObjectManagerServer | ( | const Glib::ustring & | object_path | ) |
| explicit protected

## Member Function Documentation

## ◆ create()

static Glib::RefPtr< ObjectManagerServer > Gio::DBus::ObjectManagerServer::create | ( | const Glib::ustring & | object_path | ) |
| static

Creates a new Gio::DBus::ObjectManagerServer object.

The returned server isn't yet exported on any connection. To do so, use set_connection(). Normally you want to export all of your objects before doing so to avoid Gio::DBus::ObjectManager::signal_interface_added() signals being emitted.

Parameters

  object_path | The object path to export the manager object at.

Returns
  A new Gio::DBus::ObjectManagerServer object.

## ◆ export_object()

void Gio::DBus::ObjectManagerServer::export_object | ( | const Glib::RefPtr< Gio::DBus::ObjectSkeleton > & | object | ) |

Exports object on manager.

If there is already a DBusObject exported at the object path, then the old object is removed.

The object path for object must be in the hierarchy rooted by the object path for manager.

Note that manager will take a reference on object for as long as it is exported.

Since glibmm 2.30

Parameters

  object | A DBusObjectSkeleton.

## ◆ export_uniquely()

void Gio::DBus::ObjectManagerServer::export_uniquely | ( | const Glib::RefPtr< Gio::DBus::ObjectSkeleton > & | object | ) |

Like g_dbus_object_manager_server_export() but appends a string of the form _N (with N being a natural number) to object's object path if an object with the given path already exists.

As such, the DBusObjectProxy::property_g_object_path() property of object may be modified.

Since glibmm 2.30

Parameters

  object | An object.

## ◆ get_connection() [1/2]

Glib::RefPtr< Connection > Gio::DBus::ObjectManagerServer::get_connection | ( |  | ) |

Gets the Gio::DBus::Connection used by manager.

Since glibmm 2.30

Returns
  A Gio::DBus::Connection object or `nullptr` if manager isn't exported on a connection. The returned object should be freed with Glib::object_unref().

## ◆ get_connection() [2/2]

Glib::RefPtr< const Connection > Gio::DBus::ObjectManagerServer::get_connection | ( |  | ) | const

Gets the Gio::DBus::Connection used by manager.

Since glibmm 2.30

Returns
  A Gio::DBus::Connection object or `nullptr` if manager isn't exported on a connection. The returned object should be freed with Glib::object_unref().

## ◆ get_type()

static GType Gio::DBus::ObjectManagerServer::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GDBusObjectManagerServer * Gio::DBus::ObjectManagerServer::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GDBusObjectManagerServer * Gio::DBus::ObjectManagerServer::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GDBusObjectManagerServer * Gio::DBus::ObjectManagerServer::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ is_exported()

bool Gio::DBus::ObjectManagerServer::is_exported | ( | const Glib::RefPtr< Gio::DBus::ObjectSkeleton > & | object | ) | const

Returns whether object is currently exported on manager.

Since glibmm 2.34

Parameters

  object | An object.

Returns
  `true` if object is exported.

## ◆ operator=()

ObjectManagerServer & Gio::DBus::ObjectManagerServer::operator= | ( | ObjectManagerServer && | src | ) |
| noexcept

## ◆ property_connection() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Connection > > Gio::DBus::ObjectManagerServer::property_connection | ( |  | ) |

The Gio::DBus::Connection to export objects on.

Since glibmm 2.30

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_connection() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Connection > > Gio::DBus::ObjectManagerServer::property_connection | ( |  | ) | const

The Gio::DBus::Connection to export objects on.

Since glibmm 2.30

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_object_path()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gio::DBus::ObjectManagerServer::property_object_path | ( |  | ) | const

The object path to register the manager object at.

Since glibmm 2.30

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ set_connection()

void Gio::DBus::ObjectManagerServer::set_connection | ( | const Glib::RefPtr< Connection > & | connection | ) |

Exports all objects managed by manager on connection.

If connection is `nullptr`, stops exporting objects.

Parameters

  connection | A Gio::DBus::Connection or `nullptr`.

## ◆ unexport()

bool Gio::DBus::ObjectManagerServer::unexport | ( | const Glib::ustring & | object_path | ) |

If manager has an object at path, removes the object.

Otherwise does nothing.

Note that object_path must be in the hierarchy rooted by the object path for manager.

Since glibmm 2.30

Parameters

  object_path | An object path.

Returns
  `true` if object at object_path was removed, `false` otherwise.

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gio::DBus::ObjectManagerServer > wrap | ( | GDBusObjectManagerServer * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.