Back to index

unity  6.0.0
Public Types | Public Member Functions | Protected Attributes | Static Private Member Functions | Private Attributes
unity::glib::Signal< R, G, Ts > Class Template Reference

#include <GLibSignal.h>

Inheritance diagram for unity::glib::Signal< R, G, Ts >:
Inheritance graph
[legend]
Collaboration diagram for unity::glib::Signal< R, G, Ts >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef sigc::slot< R, G, Ts...> SignalCallback
typedef std::shared_ptr
< SignalBase
Ptr

Public Member Functions

 Signal ()
 Signal (G object, std::string const &signal_name, SignalCallback const &callback)
void Connect (G Object, std::string const &signal_name, SignalCallback const &callback)
void Disconnect ()
GObject * object () const
std::string const & name () const

Protected Attributes

GObject * object_
guint32 connection_id_
std::string name_

Static Private Member Functions

static R Callback (G Object, Ts...vs, Signal *self)

Private Attributes

SignalCallback callback_

Detailed Description

template<typename R, typename G, typename... Ts>
class unity::glib::Signal< R, G, Ts >

Definition at line 57 of file GLibSignal.h.


Member Typedef Documentation

typedef std::shared_ptr<SignalBase> unity::glib::SignalBase::Ptr [inherited]

Definition at line 39 of file GLibSignal.h.

template<typename R, typename G, typename... Ts>
typedef sigc::slot<R, G, Ts...> unity::glib::Signal< R, G, Ts >::SignalCallback

Definition at line 64 of file GLibSignal.h.


Constructor & Destructor Documentation

template<typename R, typename G, typename... Ts>
unity::glib::Signal< R, G, Ts >::Signal ( ) [inline]

Definition at line 74 of file GLibSignal.h.

{};
template<typename R , typename G, typename... Ts>
unity::glib::Signal< R, G, Ts >::Signal ( object,
std::string const &  signal_name,
SignalCallback const &  callback 
) [inline]

Definition at line 30 of file GLibSignal-inl.h.

{
  Connect(object, signal_name, callback);
}

Member Function Documentation

template<typename R , typename G, typename... Ts>
R unity::glib::Signal< R, G, Ts >::Callback ( Object,
Ts...  vs,
Signal< R, G, Ts > *  self 
) [static, private]

Definition at line 47 of file GLibSignal-inl.h.

{
  return self->callback_(object, vs...);
}
template<typename R , typename G, typename... Ts>
void unity::glib::Signal< R, G, Ts >::Connect ( Object,
std::string const &  signal_name,
SignalCallback const &  callback 
) [inline]

Definition at line 37 of file GLibSignal-inl.h.

{
  object_ = reinterpret_cast<GObject*>(object);
  name_ = signal_name;
  callback_ = callback;
  connection_id_ = g_signal_connect(object, signal_name.c_str(), G_CALLBACK(Callback), this);
}

Here is the caller graph for this function:

Definition at line 38 of file GLibSignal.cpp.

{
  if (connection_id_ && G_IS_OBJECT(object_))
    g_signal_handler_disconnect(object_, connection_id_);

  object_ = 0;
  connection_id_ = 0;
}

Here is the caller graph for this function:

std::string const & unity::glib::SignalBase::name ( ) const [inherited]

Definition at line 52 of file GLibSignal.cpp.

{
  return name_;
}
GObject * unity::glib::SignalBase::object ( ) const [inherited]

Definition at line 47 of file GLibSignal.cpp.

{
  return object_;
}

Here is the caller graph for this function:


Member Data Documentation

template<typename R, typename G, typename... Ts>
SignalCallback unity::glib::Signal< R, G, Ts >::callback_ [private]

Definition at line 82 of file GLibSignal.h.

guint32 unity::glib::SignalBase::connection_id_ [protected, inherited]

Definition at line 52 of file GLibSignal.h.

std::string unity::glib::SignalBase::name_ [protected, inherited]

Definition at line 53 of file GLibSignal.h.

GObject* unity::glib::SignalBase::object_ [protected, inherited]

Definition at line 51 of file GLibSignal.h.


The documentation for this class was generated from the following files: