Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::Signal< Args > Class Template Reference

Core class that represents a signal, a list of objects waiting for its message. More...

Classes

class  Connection
 Core class that represents a connection attached to a signal. More...
 
class  ConnectionGuard
 Core class that represents a RAII for a connection attached to a signal. More...
 

Public Types

using Callback = std::function< void(Args...)>
 

Public Member Functions

 Signal ()
 Constructs a Signal object by default.
 
 Signal (const Signal &)=delete
 
 Signal (Signal &&signal) noexcept
 Constructs a Signal object by move semantic. More...
 
void Clear ()
 Clears the list of actions attached to the signal.
 
Connection Connect (const Callback &func)
 Connects a function to the signal. More...
 
Connection Connect (Callback &&func)
 Connects a function to the signal. More...
 
template<typename O >
Connection Connect (O &object, void(O::*method)(Args...))
 Connects a member function and its object to the signal. More...
 
template<typename O >
Connection Connect (O *object, void(O::*method)(Args...))
 Connects a member function and its object to the signal. More...
 
template<typename O >
Connection Connect (const O &object, void(O::*method)(Args...) const)
 Connects a member function and its object to the signal. More...
 
template<typename O >
Connection Connect (const O *object, void(O::*method)(Args...) const)
 Connects a member function and its object to the signal. More...
 
void operator() (Args... args) const
 Applies the list of arguments to every callback functions. More...
 
Signaloperator= (const Signal &)=delete
 
Signaloperator= (Signal &&signal) noexcept
 Moves the signal into this. More...
 

Detailed Description

template<typename... Args>
class Nz::Signal< Args >

Core class that represents a signal, a list of objects waiting for its message.

Constructor & Destructor Documentation

◆ Signal()

template<typename... Args>
Nz::Signal< Args >::Signal ( Signal< Args > &&  signal)
noexcept

Constructs a Signal object by move semantic.

Parameters
signalSignal to move in this

Member Function Documentation

◆ Connect() [1/6]

template<typename... Args>
Signal< Args... >::Connection Nz::Signal< Args >::Connect ( const Callback &  func)

Connects a function to the signal.

Returns
Connection attached to the signal
Parameters
funcNon-member function

◆ Connect() [2/6]

template<typename... Args>
Signal< Args... >::Connection Nz::Signal< Args >::Connect ( Callback &&  func)

Connects a function to the signal.

Returns
Connection attached to the signal
Parameters
funcNon-member function

◆ Connect() [3/6]

template<typename... Args>
template<typename O >
Signal< Args... >::Connection Nz::Signal< Args >::Connect ( O &  object,
void(O::*)(Args...)  method 
)

Connects a member function and its object to the signal.

Returns
Connection attached to the signal
Parameters
objectObject to send the message
methodMember function

◆ Connect() [4/6]

template<typename... Args>
template<typename O >
Signal< Args... >::Connection Nz::Signal< Args >::Connect ( O *  object,
void(O::*)(Args...)  method 
)

Connects a member function and its object to the signal.

Returns
Connection attached to the signal
Parameters
objectObject to send the message
methodMember function

◆ Connect() [5/6]

template<typename... Args>
template<typename O >
Signal< Args... >::Connection Nz::Signal< Args >::Connect ( const O &  object,
void(O::*)(Args...) const  method 
)

Connects a member function and its object to the signal.

Returns
Connection attached to the signal
Parameters
objectObject to send the message
methodMember function

◆ Connect() [6/6]

template<typename... Args>
template<typename O >
Signal< Args... >::Connection Nz::Signal< Args >::Connect ( const O *  object,
void(O::*)(Args...) const  method 
)

Connects a member function and its object to the signal.

Returns
Connection attached to the signal
Parameters
objectObject to send the message
methodMember function

◆ operator()()

template<typename... Args>
void Nz::Signal< Args >::operator() ( Args...  args) const

Applies the list of arguments to every callback functions.

Parameters
argsArguments to send with the message

◆ operator=()

template<typename... Args>
Signal< Args... > & Nz::Signal< Args >::operator= ( Signal< Args > &&  signal)
noexcept

Moves the signal into this.

Returns
A reference to this
Parameters
signalSignal to move in this

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