|
rllib
1
|
#include <rlmailbox.h>

Public Types | |
| enum | MailboxEnum { MAILBOX_ERROR = -1, MAILBOX_FULL = -2, WAIT = 1, NOWAIT = 0, MAX_MAILBOX = 256*256, OK = 2, COULD_NOT_CREATE_MAILBOX = 3, COULD_NOT_GET_KEY = 4, COULD_NOT_GET_CHAN_ID = 5 } |
Public Member Functions | |
| rlMailbox (const char *name) | |
| virtual | ~rlMailbox () |
| int | write (const void *buf, int len) |
| int | printf (const char *format,...) |
| int | read (void *buf, int maxlen, int wait=WAIT) |
| int | setReadBufferSize (int size) |
| const char * | read (int wait=WAIT) |
| int | write (const char *message) |
| void | clear () |
Public Attributes | |
| int | status |
| char * | name |
Private Attributes | |
| int | chanid |
| int | buffer_size |
| char * | buffer |
class for a mailbox.
A mailbox is for communication between processes on the same computer. It works like a fifo. Many processes can write to 1 mailbox. Only 1 reader is allowed.
Definition at line 29 of file rlmailbox.h.
| Enumerator | |
|---|---|
| MAILBOX_ERROR | return codes for write() |
| MAILBOX_FULL | |
| WAIT | wait parameter for read() |
| NOWAIT | |
| MAX_MAILBOX | maximum mailbox length |
| OK | status: |
| COULD_NOT_CREATE_MAILBOX | |
| COULD_NOT_GET_KEY | |
| COULD_NOT_GET_CHAN_ID | |
Definition at line 32 of file rlmailbox.h.
| rlMailbox::rlMailbox | ( | const char * | name | ) |
construct a named mailbox
Definition at line 55 of file rlmailbox.cpp.
|
virtual |
| void rlMailbox::clear | ( | ) |
read all messages from mailbox, clear them
Definition at line 337 of file rlmailbox.cpp.
| int rlMailbox::printf | ( | const char * | format, |
| ... | |||
| ) |
similar to printf
return: bytes written
MAILBOX_ERROR
MAILBOX_FULL
Definition at line 344 of file rlmailbox.cpp.
| int rlMailbox::read | ( | void * | buf, |
| int | maxlen, | ||
| int | wait = WAIT |
||
| ) |
read buf from mailbox, maxlen=Maximal length of buf return: number of bytes read wait = 0 no wait wait = 1 wait for message
Definition at line 224 of file rlmailbox.cpp.
| const char * rlMailbox::read | ( | int | wait = WAIT | ) |
read buffer from mailbox return: buffer | "" wait = 0 no wait wait = 1 wait for message
Definition at line 365 of file rlmailbox.cpp.
| int rlMailbox::setReadBufferSize | ( | int | size | ) |
set the size of buffer for "const char *read(int wait)"
Definition at line 357 of file rlmailbox.cpp.
| int rlMailbox::write | ( | const void * | buf, |
| int | len | ||
| ) |
write buf with length len to mailbox
return: bytes written
MAILBOX_ERROR
MAILBOX_FULL
Definition at line 149 of file rlmailbox.cpp.
| int rlMailbox::write | ( | const char * | message | ) |
write message to mailbox
return: bytes written
MAILBOX_ERROR
MAILBOX_FULL
Definition at line 377 of file rlmailbox.cpp.
|
private |
Definition at line 124 of file rlmailbox.h.
|
private |
Definition at line 123 of file rlmailbox.h.
|
private |
Definition at line 122 of file rlmailbox.h.
| char* rlMailbox::name |
Name of mailbox
Definition at line 119 of file rlmailbox.h.
| int rlMailbox::status |
should be: OK
can be: COULD_NOT_CREATE_MAILBOX
COULD_NOT_GET_CHAN_ID
Definition at line 114 of file rlmailbox.h.
1.8.14