![]() |
4S Device Communication Module Collection
Version 0.6-SNAPSHOT
Full documentation of the modules in the 4SDC collection (aimed at 4SDC module developers)
|
|
Template class allowing other classes to receive messages. More...
#include <msgreceiver.h>
Public Member Functions | |
MsgReceiver (void) | |
Constructor for MsgReceiver class. More... | |
~MsgReceiver () | |
Destructor for MsgReceiver class. More... | |
![]() | |
MsgAddrGenerator (void) | |
Constructor that creates an address. | |
operator MsgAddr & () | |
MsgAddr operator for type conversion of MsgAddrGenerator to a MsgAddr. More... | |
Private Member Functions | |
TReceiverClass * | parentClassPointer () |
Function to generate a pointer to the parent class. More... | |
void | callBack (TMsg &msg) |
Function that does the actually call into the listening class. More... | |
![]() | |
void | callBack (std::shared_ptr< BaseMsg > &baseMsg) |
callBack function that casts the message to the correct typedef More... | |
![]() | |
MsgCallBack (void) | |
Default constructor. | |
![]() | |
Handle (void) | |
Default constructor. More... | |
Handle (Handle &ref) | |
Copy constructor for handle object. More... | |
Handle (const Handle &ref) | |
Copy constructor for handle object. More... | |
Handle & | operator= (Handle const &theOtherOne) |
bool | operator== (Handle const &compareTo) const |
Equality comparator. More... | |
bool | operator!= (Handle const &compareTo) const |
Not equalify operator. More... | |
bool | operator> (Handle const &compareTo) const |
Greater than operator ('>') More... | |
bool | operator< (Handle const &compareTo) const |
Less than operator ('<') More... | |
Additional Inherited Members | |
![]() | |
static Handle & | broadCastHandle (void) |
Generic broadcast handle. More... | |
static Handle & | null (void) |
The null handle. More... | |
This is the class that other classes can inherit from in order to receive specific messages.
When inheriting from this class you give the parent class and the class of the message that you want to receive as template parameters.
In order to receive a message, the class must inherit from this class and implement a receive function that takes the type of message as parameter.
Remember to take a copy of message if you want to use its content later, or want to respond to it.
The receive function will be called in the thread context where the object was initialised, and it is not possible to move it to another thead.
It is possible to declare the receive function as virtual if that is desired.
|
inline |
The constructor will register this class with the message system, so it is possible for it to receive messages of the specific type.
|
inline |
The destructor of the MsgReceiver class unregisters this class from the message system, so it won't attempt to call it again.
|
inlineprivatevirtual |
This function takes the pointer to the listening class and calls the receive function on that class
msg | A reference to the message that is being received |
Implements FSYS::MsgCallBackT< TMsg >.
|
inlineprivate |
This class uses the pointer to the parent in order to call the receive function on the parent.