Signal Class Reference

yasimavr: Signal Class Reference
yasimavr
Loading...
Searching...
No Matches

Signalling framework class. More...

#include <sim_signal.h>

Inheritance diagram for Signal:
DataSignal

Public Member Functions

 Signal ()
 
 Signal (const Signal &other)
 
 Signal (const Signal &&)=delete
 
virtual ~Signal ()
 
void connect (SignalHook &hook, int hooktag=0)
 
void disconnect (SignalHook &hook)
 
virtual void raise (const signal_data_t &sigdata)
 
void raise (int sigid=0, const vardata_t &v=vardata_t(), long long index=0)
 
Signaloperator= (const Signal &)
 
Signaloperator= (const Signal &&)=delete
 

Friends

class SignalHook
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Signal() [1/3]

Signal::Signal ( )

Build a signal.

◆ Signal() [2/3]

Signal::Signal ( const Signal other)

Copy construction ensuring the connection with hooks is consistent.

◆ Signal() [3/3]

Signal::Signal ( const Signal &&  )
delete

◆ ~Signal()

Signal::~Signal ( )
virtual

Destroy a signal. Severs all the connections with hooks.

Member Function Documentation

◆ connect()

void Signal::connect ( SignalHook hook,
int  hooktag = 0 
)

Connect a hook to this signal.

Parameters
hookhook to be connected. If the hook is already connected, the call has no effect.
hooktagidentifier given to the hook when calling it. It has only a meaning for the hook and is passed though by the signal when called.
Note
The hootag can be useful when a single hook connects to several signals, in order to differentiate which one the raise comes from.
See also
SignalHook::raised()

◆ disconnect()

void Signal::disconnect ( SignalHook hook)

Disconnect a hook to this signal.

Parameters
hookhook to be disconnected.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

Signal & Signal::operator= ( const Signal other)

Copy assignment ensuring the connection with hooks is consistent.

◆ raise() [1/2]

void Signal::raise ( const signal_data_t sigdata)
virtual

Raise the signal with the given data

Parameters
sigdata

Reimplemented in DataSignal, and DataSignal.

◆ raise() [2/2]

void Signal::raise ( int  sigid = 0,
const vardata_t v = vardata_t(),
long long  ix = 0 
)

Raise the signal with the given data.

Parameters
data

Friends And Related Symbol Documentation

◆ SignalHook

friend class SignalHook
friend

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