The Object class is the base class for fast and lightweight signal-slot connections in Kourier.
More...
|
template<class T_PtrToSignal , class T_PtrToSlot > |
static void | connect (MetaInvocable< T_PtrToSignal >::T_Class *pSender, T_PtrToSignal pSignal, MetaInvocable< T_PtrToSlot >::T_Class *pReceiver, T_PtrToSlot pSlot) |
|
template<class T_PtrToSignal , class T_PtrToSlot > |
static void | connect (MetaInvocable< T_PtrToSignal >::T_Class *pSender, T_PtrToSignal pSignal, Object *pReceiver, T_PtrToSlot pSlot) |
|
template<class T_PtrToSignal , class T_PtrToSlot > |
static void | connect (MetaInvocable< T_PtrToSignal >::T_Class *pSender, T_PtrToSignal pSignal, T_PtrToSlot pSlot) |
|
template<class T_PtrToSignal , class T_PtrToSlot > |
static void | disconnect (Object *pSender, T_PtrToSignal pSignal, Object *pReceiver, T_PtrToSlot pSlot) |
|
The Object class is the base class for fast and lightweight signal-slot connections in Kourier.
◆ Object()
Kourier::Object::Object |
( |
| ) |
|
◆ ~Object()
Kourier::Object::~Object |
( |
| ) |
|
|
virtual |
Destroys the Object. All connections having this object as sender, receiver, or context object are automatically disconnected.
◆ connect() [1/3]
template<class T_PtrToSignal , class T_PtrToSlot >
void Kourier::Object::connect |
( |
MetaInvocable< T_PtrToSignal >::T_Class * |
pSender, |
|
|
T_PtrToSignal |
pSignal, |
|
|
MetaInvocable< T_PtrToSlot >::T_Class * |
pReceiver, |
|
|
T_PtrToSlot |
pSlot |
|
) |
| |
|
inlinestatic |
Connects pSignal from pSender to pSlot on pReceiver. Arguments in pSignal must be convertible to arguments in pSlot, but pSlot can have fewer arguments than pSignal or no arguments at all. pReceiver must be non-null, and pSlot must be a pointer to a member function of pReceiver. Call disconnect(pSender, pSignal, pReceiver, pSlot) to disconnect. The connection is automatically terminated if either pSender or pReceiver are destroyed.
◆ connect() [2/3]
template<class T_PtrToSignal , class T_PtrToSlot >
void Kourier::Object::connect |
( |
MetaInvocable< T_PtrToSignal >::T_Class * |
pSender, |
|
|
T_PtrToSignal |
pSignal, |
|
|
Object * |
pContextObject, |
|
|
T_PtrToSlot |
pSlot |
|
) |
| |
|
inlinestatic |
Connects pSignal from pSender to pSlot. Arguments in pSignal must be convertible to arguments in pSlot, but pSlot can have fewer arguments than pSignal or no arguments at all. pSlot cannot be a pointer to a non-static member function, and pContextObject acts as a context object and can be null. You can disconnect by destroying the context object or by calling disconnect(pSender, pSignal, pContextObject, nullptr) to disconnect every connection from pSignal and pSender involving the context object. Connection is automatically terminated if either pSender or pContextObject are destroyed.
◆ connect() [3/3]
template<class T_PtrToSignal , class T_PtrToSlot >
void Kourier::Object::connect |
( |
MetaInvocable< T_PtrToSignal >::T_Class * |
pSender, |
|
|
T_PtrToSignal |
pSignal, |
|
|
T_PtrToSlot |
pSlot |
|
) |
| |
|
inlinestatic |
Similar to calling connect(pSender, pSignal, nullptr, pSlot). Connects pSignal from pSender to pSlot. pSlot cannot be a pointer to a non-static member function, and arguments in pSignal must be convertible to arguments in pSlot. pSlot can have fewer arguments than pSignal or no arguments at all. If pSlot is a lambda that captures variables, all captured variables must still exist when the lambda gets called. The connection is automatically terminated if pSender is destroyed. You can use a context object as receiver if you want to disconnect without having to destroy the sender, by calling connect(pSender, pSignal, pContextObject, pSlot), where pContextObject is a non-null pointer to an object containing Object in its inheritance hierarchy. In this case you can disconnect by destroying the given context object, or you can call disconnect(pSender, pSignal, pContextObject, nullptr) to disconnect.
◆ disconnect() [1/3]
void Kourier::Object::disconnect |
( |
| ) |
|
|
inline |
Disconnects all connections with this object as the sender.
◆ disconnect() [2/3]
template<class T_PtrToSignal , class T_PtrToSlot >
void Kourier::Object::disconnect |
( |
Object * |
pSender, |
|
|
T_PtrToSignal |
pSignal, |
|
|
Object * |
pReceiver, |
|
|
T_PtrToSlot |
pSlot |
|
) |
| |
|
inlinestatic |
Disconnects pSignal from pSender to pSlot. pSender cannot be null. Null pointers as a signal, receiver, or slot act as wildcards, meaning all of them.
◆ disconnect() [3/3]
template<class T_PtrToReceiverOrSignal >
void Kourier::Object::disconnect |
( |
T_PtrToReceiverOrSignal |
pReceiverOrSignal | ) |
|
|
inline |
If pReceiverOrSignal points to a signal on this object, everything connected to the signal is disconnected. Otherwise, it disconnects all connections having this object as the sender and pReceiverOrSignal as the receiver.
◆ scheduleForDeletion()
void Kourier::Object::scheduleForDeletion |
( |
| ) |
|
|
inline |
Schedule this object for deletion. This object will be deleted when control returns to the event loop. This method can be called more than once, provided the object has not yet been deleted.
◆ tryCast() [1/2]
template<class T >
T Kourier::Object::tryCast |
( |
| ) |
|
|
inline |
Returns a pointer along the inheritance hierarchy of this object if T belongs to the hierarchy. Otherwise, returns null.
◆ tryCast() [2/2]
template<class T >
T Kourier::Object::tryCast |
( |
| ) |
const |
|
inline |
Returns a pointer along the inheritance hierarchy of this object if T belongs to the hierarchy. Otherwise, returns null.