Angel
A 2D Game Prototyping Engine
Public Member Functions | Protected Attributes
Message Class Reference

The base message class which signals an event. More...

#include <Message.h>

+ Inheritance diagram for Message:

List of all members.

Public Member Functions

 Message ()
 Message (const String &messageName, MessageListener *sender=NULL)
virtual const String & GetMessageName () const
MessageListener *const GetSender ()

Protected Attributes

String _messageName
MessageListener_sender

Detailed Description

A message is used by the Switchboard class to signal to any listeners that an event has happened. The only information it conveys is the message name (a user-definable string) and who sent the message.

Classes which implement the MessageListener interface can subscribe to specific types of messages to get notification.

See also:
MessageListener
TypedMessage
Switchboard

Definition at line 50 of file Message.h.


Constructor & Destructor Documentation

Message::Message ( )

The default constructor creates a Message with the name "GenericMessage" and no sender.

Definition at line 34 of file Message.cpp.

Message::Message ( const String &  messageName,
MessageListener sender = NULL 
)

This is the constructor you should actually use -- gives the Message a name and sender.

Parameters:
messageNameThe name of this Message; used by MessageListener and the Switchboard to manage delivery.
senderWho sent this Message; NULL by default

Definition at line 40 of file Message.cpp.


Member Function Documentation

const String & Message::GetMessageName ( ) const [virtual]

Get the name of this Message. Since all Messages come to the listener via the same ReceiveMessage function, this can be used to filter for specific notifications.

Returns:
The name of this message

Definition at line 46 of file Message.cpp.

MessageListener *const Message::GetSender ( )

Find out who requested this Message to be sent. This can have all sorts of semantics depending on what the Message itself is communicating.

Returns:
The sender

Definition at line 51 of file Message.cpp.


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