![]() |
Angel
A 2D Game Prototyping Engine
|
A templated class for delivering additional information with Messages. More...
#include <Message.h>
Inheritance diagram for TypedMessage< T >:Public Member Functions | |
| TypedMessage (const String &messageName, T value, MessageListener *sender=NULL) | |
| const T | GetValue () |
Protected Attributes | |
| T | _value |
This class lets you define your own message types that carry data with them. For instance, if you wanted to create a Message that carried a world location with it:
TypedMessage<Vector2> *m = new TypedMessage<Vector2>("SomethingHappenedHere", Vector2(-3, -2));
This gets sent through the Switchboard as just a pointer to the base class, though, so your MessageReceivers will have to parse what it is from the Message::GetMessageType function and cast it appropriately from there.
| TypedMessage< T >::TypedMessage | ( | const String & | messageName, |
| T | value, | ||
| MessageListener * | sender = NULL |
||
| ) | [inline] |
Creates a new TypedMessage carrying the information you've designated
| messageName | The name of the message |
| value | Any data of the type defined in the template constructor |
| sender | Who is sending this message; NULL by default |
| const T TypedMessage< T >::GetValue | ( | ) | [inline] |


1.7.5.1