next up previous contents
Next: 2.13 PositionProxy Up: 2. Class Reference Previous: 2.11 LocalizeProxy   Contents

Subsections

2.12 MComProxy

The MComProxy class is used to exchange data with other clients connected with the same server, through a set of named "channels". For some useful (but optional) type and constant definitions that you can use in your clients, see <playermcomtypes.h>.

Attributes

player_mcom_data_t data;
int type;
char channel[MCOM_CHANNEL_LEN];

These members contain the results of the last command. Note: It's better to use the LastData() method.

Methods

int Pop(int type, char channel[MCOM_CHANNEL_LEN])

Read and remove the most recent buffer in 'channel' with type 'type'. The result can be read with LastData() after the next call to PlayerClient::Read(). @return 0 if no error @return -1 on error, the channel does not exist, or the channel is empty.

int Read(int type, char channel[MCOM_CHANNEL_LEN])

Read the most recent buffer in 'channel' with type 'type'. The result can be read with LastData() after the next call to PlayerClient::Read(). @return 0 if no error @return -1 on error, the channel does not exist, or the channel is empty.

int Push(int type, char channel[MCOM_CHANNEL_LEN], char dat[MCOM_DATA_LEN])

Push a message 'dat' into channel 'channel' with message type 'type'.

int Clear(int type, char channel[MCOM_CHANNEL_LEN])

Clear all messages of type 'type' on channel 'channel'

int SetCapacity(int type, char channel[MCOM_CHANNEL_LEN], unsigned char cap)

Set the capacity of the buffer using 'type' and 'channel' to 'cap'. Note that 'cap' is an unsigned char and must be < MCOM_N_BUFS

char* LastData()

Get the results of the last command (Pop or Read). Call PlayerClient::Read() before using.

int LastMsgType()

Get the results of the last command (Pop or Read). Call PlayerClient::Read() before using.

char* LastChannel()

Get the channel of the last command (Pop or Read). Call PlayerClient::Read() before using.


next up previous contents
Next: 2.13 PositionProxy Up: 2. Class Reference Previous: 2.11 LocalizeProxy   Contents
2004-05-31