|
Public Member Functions | |
Message () | |
DECLARE_CONOBJECT (Message) | |
virtual bool | onAdd () |
Called when the object is added to the sim. | |
virtual void | onRemove () |
Called when the object is removed from the sim. | |
const char * | getType () |
Get the type of the message. | |
void | addReference () |
Add a reference to the reference count of this message. | |
void | freeReference () |
Free a reference to this message. | |
Static Public Member Functions | |
static SimObjectId | getNextMessageID () |
Obtain next available SimObjectId for messages. | |
Private Types | |
typedef SimObject | Parent |
Private Attributes | |
S32 | mRefCount |
Current reference count. |
typedef SimObject Message::Parent [private] |
Reimplemented from SimObject.
Message::Message | ( | ) |
Message::DECLARE_CONOBJECT | ( | Message | ) |
static SimObjectId Message::getNextMessageID | ( | ) | [static] |
Obtain next available SimObjectId for messages.
This is used in combination with the newmsg script operator to provide ID pooling for messages and works similarly to datablock IDs.
By default, the 64 IDs following the datablock IDs are used for messages. As message objects generally have a short life time this prevents them from eating object IDs as if they haven't eaten for a year.
Note that unlike SimObjects and datablocks, Messages IDs are re-used. If you store a message object in script and do not clear the variable containing the object ID after freeing the message, it is probable that the object ID will become valid again.
virtual bool Message::onAdd | ( | ) | [virtual] |
virtual void Message::onRemove | ( | ) | [virtual] |
const char* Message::getType | ( | ) |
Get the type of the message.
The message type is either the script class name or the C++ class name if it has not been overridden in script. This allows easy identification of message types with minimum effort.
void Message::addReference | ( | ) |
Add a reference to the reference count of this message.
Use freeReference() to free the reference when you are done with it.
void Message::freeReference | ( | ) |
S32 Message::mRefCount [private] |
Current reference count.