Class Signal

Nested Relationships

Nested Types

Inheritance Relationships

Derived Type

Class Documentation

class Signal

Signalling framework class.

Main class for raising signals. It implements a messaging passing system in the yasimavr simulation models, in a very similar fashion to simavr’s IRQ, or QT’s signal/slot frameworks.

Signals are connected to objects implementing the SignalHook interface. One signal can be connected to may hooks, whilst one hook can be connected to many signals.

Subclassed by DataSignal

Public Functions

Signal()

Build a signal.

Signal(const Signal &other)

Copy construction ensuring the connection with hooks is consistent.

Signal(const Signal&&) = delete
virtual ~Signal()

Destroy a signal. Severs all the connections with hooks.

void connect(SignalHook &hook, int hooktag = 0)

Connect a hook to this signal.

Note

The hootag can be useful when a single hook connects to several signals, in order to differentiate which one the raise comes from.

Parameters:
  • hook – hook to be connected. If the hook is already connected, the call has no effect.

  • hooktag – identifier given to the hook when calling it. It has only a meaning for the hook and is passed though by the signal when called.

void disconnect(SignalHook &hook)

Disconnect a hook to this signal.

Parameters:

hook – hook to be disconnected.

virtual void raise(const signal_data_t &sigdata)

Raise the signal with the given data

Parameters:

sigdata

void raise(int sigid = 0, const vardata_t &v = vardata_t(), long long index = 0)

Raise the signal with the given data.

Parameters:

data

Signal &operator=(const Signal&)

Copy assignment ensuring the connection with hooks is consistent.

Signal &operator=(const Signal&&) = delete