Message Class Reference
#include <message.h>
Detailed Description
Reference-counted message objects.All Player messages are transferred between drivers as pointers to Message objects. These objects are reference-counted so that messages can be delivered to multiple recipients with minimal memory overhead.
Messages are not usually manipulated directly in driver code. The details of allocating, filling, parsing, and deleting Message objects are handled by the Driver and MessageQueue classes.
The only method of interest to driver authors is the helper MatchMessage(), which can be used in a Driver::ProcessMessage method to determine if a message header matches a given signature.
Public Member Functions | |
Message (const struct player_msghdr &Header, const void *data, unsigned int data_size, MessageQueue *_queue=NULL) | |
Create a new message. | |
Message (const Message &rhs) | |
Copy pointers from existing message and increment refcount. | |
~Message () | |
Destroy message, dec ref counts and delete data if ref count == 0. | |
void * | GetData () |
GetData from message. | |
player_msghdr_t * | GetHeader () |
Get pointer to header. | |
void * | GetPayload () |
Get pointer to payload. | |
size_t | GetPayloadSize () |
Get Payload size. | |
unsigned int | GetSize () |
Size of message data. | |
bool | Compare (Message &other) |
Compare type, subtype, device, and device_index. | |
void | DecRef () |
Decrement ref count. | |
void | SetReady () |
Set ready to send. | |
bool | Ready (void) const |
Check if ready to send. | |
Static Public Member Functions | |
static bool | MatchMessage (player_msghdr_t *hdr, int type, int subtype, player_devaddr_t addr) |
Helper for message processing. | |
Public Attributes | |
MessageQueue * | Queue |
queue to which any response to this message should be directed | |
unsigned int * | RefCount |
Reference count. |
Member Function Documentation
|
Helper for message processing.
Returns true if |
The documentation for this class was generated from the following file: