OMNeT++ Simulation Library  5.6.1
cListener Class Reference

#include <clistener.h>

Description

A do-nothing implementation of cIListener, suitable as a base class for other listeners.

The user needs to redefine one or more of the overloaded receiveSignal() methods; the rest will throw a "Data type not supported" error.

Inheritance diagram for cListener:
cIListener

Public Member Functions

virtual void receiveSignal (cComponent *source, simsignal_t signalID, bool b, cObject *details) override
 
virtual void receiveSignal (cComponent *source, simsignal_t signalID, long l, cObject *details) override
 
virtual void receiveSignal (cComponent *source, simsignal_t signalID, unsigned long l, cObject *details) override
 
virtual void receiveSignal (cComponent *source, simsignal_t signalID, double d, cObject *details) override
 
virtual void receiveSignal (cComponent *source, simsignal_t signalID, const SimTime &t, cObject *details) override
 
virtual void receiveSignal (cComponent *source, simsignal_t signalID, const char *s, cObject *details) override
 
virtual void receiveSignal (cComponent *source, simsignal_t signalID, cObject *obj, cObject *details) override
 
- Public Member Functions inherited from cIListener
virtual void finish (cComponent *component, simsignal_t signalID)
 
virtual void subscribedTo (cComponent *component, simsignal_t signalID)
 
virtual void unsubscribedFrom (cComponent *component, simsignal_t signalID)
 
int getSubscribeCount () const
 

Protected Member Functions

virtual void unsupportedType (simsignal_t signalID, const char *dataType)
 

Member Function Documentation

◆ unsupportedType()

virtual void unsupportedType ( simsignal_t  signalID,
const char *  dataType 
)
protectedvirtual

Utility function, throws a "data type not supported" error.

◆ receiveSignal() [1/7]

virtual void receiveSignal ( cComponent source,
simsignal_t  signalID,
bool  b,
cObject details 
)
overridevirtual

Receive an emitted signal. Note that cIListener declares several overloaded receiveSignal() methods, one for each data type (except that all integer types are merged to the long and unsigned long types). The "source" argument is the channel or module on which the emit() method was invoked, and NOT the one at which this listener is subscribed.

It is not allowed inside a receiveSignal() call to unsubscribe from the signal being received – it will cause an error to be thrown. (This is to prevent interesting cases when the listener list is being modified while the component iterates on it. The alternative would be to make a temporary copy of the listener list each time, but this is not desirable for performance reasons.)

Implements cIListener.

◆ receiveSignal() [2/7]

virtual void receiveSignal ( cComponent source,
simsignal_t  signalID,
long  l,
cObject details 
)
overridevirtual

Receive an emitted long value. See receiveSignal(cComponent*,simsignal_t,bool,cObject*) for more info.

Implements cIListener.

◆ receiveSignal() [3/7]

virtual void receiveSignal ( cComponent source,
simsignal_t  signalID,
unsigned long  l,
cObject details 
)
overridevirtual

Receive an emitted unsigned long value. See receiveSignal(cComponent*,simsignal_t,bool,cObject*) for more info.

Implements cIListener.

◆ receiveSignal() [4/7]

virtual void receiveSignal ( cComponent source,
simsignal_t  signalID,
double  d,
cObject details 
)
overridevirtual

Receive an emitted double value. See receiveSignal(cComponent*,simsignal_t,bool,cObject*) for more info.

Implements cIListener.

◆ receiveSignal() [5/7]

virtual void receiveSignal ( cComponent source,
simsignal_t  signalID,
const SimTime t,
cObject details 
)
overridevirtual

Receive an emitted simtime_t value. See receiveSignal(cComponent*,simsignal_t,bool,cObject*) for more info.

Implements cIListener.

◆ receiveSignal() [6/7]

virtual void receiveSignal ( cComponent source,
simsignal_t  signalID,
const char *  s,
cObject details 
)
overridevirtual

Receive an emitted string value. See receiveSignal(cComponent*,simsignal_t,bool,cObject*) for more info.

Implements cIListener.

◆ receiveSignal() [7/7]

virtual void receiveSignal ( cComponent source,
simsignal_t  signalID,
cObject obj,
cObject details 
)
overridevirtual

Receive an emitted cObject value. See receiveSignal(cComponent*,simsignal_t,bool,cObject*) for more info.

Implements cIListener.


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