aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
gum::__sig__::Connector< TargetClass, Args > Class Template Reference

Concrete connector binding a target object and its member function. More...

#include <signaler.h>

Inheritance diagram for gum::__sig__::Connector< TargetClass, Args >:
Collaboration diagram for gum::__sig__::Connector< TargetClass, Args >:

Public Types

using ActionType = void (TargetClass::*)(const void*, Args...)
 Type alias for the member function pointer.

Public Member Functions

 Connector ()
 Default constructor.
 Connector (TargetClass *target, ActionType action)
 Construct with target and action.
 Connector (const Connector &src)
 Copy constructor.
 ~Connector () override
 Destructor.
Listenertarget () const override
void notify (const void *src, Args... args) override
 Notify the target with the given source and arguments.
IConnector< Args... > * clone () const override
 Create a deep copy of this connector.
IConnector< Args... > * duplicate (Listener *newTarget) const override
 Create a duplicate connector pointing to a new target.

Private Attributes

TargetClass * _target_
ActionType _action_

Detailed Description

template<class TargetClass, typename... Args>
class gum::__sig__::Connector< TargetClass, Args >

Concrete connector binding a target object and its member function.

Template Parameters
TargetClassThe class of the listener object.
ArgsThe types of arguments passed to the callback.

Definition at line 120 of file signaler.h.

Member Typedef Documentation

◆ ActionType

template<class TargetClass, typename... Args>
using gum::__sig__::Connector< TargetClass, Args >::ActionType = void (TargetClass::*)(const void*, Args...)

Type alias for the member function pointer.

Definition at line 123 of file signaler.h.

Constructor & Destructor Documentation

◆ Connector() [1/3]

template<class TargetClass, typename... Args>
gum::__sig__::Connector< TargetClass, Args >::Connector ( )
inline

Default constructor.

Definition at line 126 of file signaler.h.

126: _target_(nullptr), _action_(nullptr) { GUM_CONSTRUCTOR(Connector); }
Concrete connector binding a target object and its member function.
Definition signaler.h:120
Connector()
Default constructor.
Definition signaler.h:126
TargetClass * _target_
Definition signaler.h:150

References Connector(), _action_, and _target_.

Referenced by Connector(), Connector(), Connector(), ~Connector(), clone(), and duplicate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Connector() [2/3]

template<class TargetClass, typename... Args>
gum::__sig__::Connector< TargetClass, Args >::Connector ( TargetClass * target,
ActionType action )

Construct with target and action.

Definition at line 53 of file signaler_tpl.h.

53 :
56 }
Listener * target() const override

References Connector(), _action_, _target_, and target().

Here is the call graph for this function:

◆ Connector() [3/3]

template<class TargetClass, typename... Args>
gum::__sig__::Connector< TargetClass, Args >::Connector ( const Connector< TargetClass, Args > & src)

Copy constructor.

Definition at line 59 of file signaler_tpl.h.

References Connector(), _action_, and _target_.

Here is the call graph for this function:

◆ ~Connector()

template<class TargetClass, typename... Args>
gum::__sig__::Connector< TargetClass, Args >::~Connector ( )
inlineoverride

Destructor.

Definition at line 135 of file signaler.h.

References Connector().

Here is the call graph for this function:

Member Function Documentation

◆ clone()

template<class TargetClass, typename... Args>
IConnector< Args... > * gum::__sig__::Connector< TargetClass, Args >::clone ( ) const
overridevirtual

Create a deep copy of this connector.

Implements gum::__sig__::IConnector< Args... >.

Definition at line 75 of file signaler_tpl.h.

75 {
76 return new Connector< TargetClass, Args... >(*this);
77 }

References Connector().

Here is the call graph for this function:

◆ duplicate()

template<class TargetClass, typename... Args>
IConnector< Args... > * gum::__sig__::Connector< TargetClass, Args >::duplicate ( Listener * newTarget) const
nodiscardoverridevirtual

Create a duplicate connector pointing to a new target.

Implements gum::__sig__::IConnector< Args... >.

Definition at line 80 of file signaler_tpl.h.

80 {
81 return new Connector< TargetClass, Args... >(static_cast< TargetClass* >(newTarget), _action_);
82 }

References Connector(), and _action_.

Here is the call graph for this function:

◆ notify()

template<class TargetClass, typename... Args>
void gum::__sig__::Connector< TargetClass, Args >::notify ( const void * src,
Args... args )
overridevirtual

Notify the target with the given source and arguments.

Implements gum::__sig__::IConnector< Args... >.

Definition at line 70 of file signaler_tpl.h.

70 {
71 (_target_->*_action_)(src, args...);
72 }

References _action_, and _target_.

◆ target()

template<class TargetClass, typename... Args>
Listener * gum::__sig__::Connector< TargetClass, Args >::target ( ) const
overridevirtual

Returns
The listener target of this connector.

Implements gum::__sig__::IConnector< Args... >.

Definition at line 65 of file signaler_tpl.h.

65 {
66 return _target_;
67 }

References _target_.

Referenced by Connector().

Here is the caller graph for this function:

Member Data Documentation

◆ _action_

template<class TargetClass, typename... Args>
ActionType gum::__sig__::Connector< TargetClass, Args >::_action_
private

Definition at line 151 of file signaler.h.

Referenced by Connector(), Connector(), Connector(), duplicate(), and notify().

◆ _target_

template<class TargetClass, typename... Args>
TargetClass* gum::__sig__::Connector< TargetClass, Args >::_target_
private

Definition at line 150 of file signaler.h.

Referenced by Connector(), Connector(), Connector(), notify(), and target().


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