Skip to content

Signal

class Signal

Functions

Name Description
setSignature Use like setSignature() to ensure that any emitted signal has to take arguments of these three types in that order.
registerSlot Register a slot to receive an emitted signal slotInstanceId : id of the instance of the slot slotFunction : name of the slot Return : bool whether freshly registered (false means: was already registered)
unregisterSlot Undo registration of a slot slotInstanceId : instance id of the slot to be removed slotFunction : the slot - if empty string, remove all registered slots of slotInstanceId Return : bool whether slot registration could be undone, i.e. false if slot was not registered
setTopic This function allows to use a specific topic to which all messages are emitted If the setter is not called, the topic of SignalSlotable will be used NOTE: The idea is to keep a door open for a later change where each emit will use a topic identical to the signal name. In that case the setter can just be removed. topic : The topic name

Function Details

registerSlot

bool registerSlot(const std::string& slotInstanceId, const std::string& slotFunction)

Register a slot to receive an emitted signal

slotInstanceId : id of the instance of the slot

slotFunction : name of the slot

Return : bool whether freshly registered (false means: was already registered)

setSignature

template <typename... Args> void setSignature()

Use like setSignature() to ensure that any emitted signal has to take arguments of these three types in that order.

setTopic

void setTopic(const std::string& topic)

This function allows to use a specific topic to which all messages are emitted If the setter is not called, the topic of SignalSlotable will be used NOTE: The idea is to keep a door open for a later change where each emit will use a topic identical to the signal name. In that case the setter can just be removed.

topic : The topic name

unregisterSlot

bool unregisterSlot(const std::string& slotInstanceId, const std::string& slotFunction = "")

Undo registration of a slot

slotInstanceId : instance id of the slot to be removed

slotFunction : the slot - if empty string, remove all registered slots of slotInstanceId

Return : bool whether slot registration could be undone, i.e. false if slot was not registered