Angel 3.2
A 2D Game Prototyping Engine
Public Member Functions | Protected Attributes | List of all members
Message Class Reference

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

#include <Message.h>

+ Inheritance diagram for Message:

Public Member Functions

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

Protected Attributes

String _messageName

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

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 ( )

Virtual destructor.

Definition at line 40 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.

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

Definition at line 44 of file Message.cpp.

Member Function Documentation

const String & Message::GetMessageName ( ) const

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.

The name of this message

Definition at line 50 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.

The sender

Definition at line 55 of file Message.cpp.

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