#include <tentacle.h>
|
| tentacle (key_t msg_key) |
|
bool | write (long type, std::string data) |
|
bool | write (std::pair< long, std::string > pair) |
|
|
static std::pair< long, std::string > | read (long type, bool block=true, bool under=false) |
|
|
enum | role_t { SUBSCRIBER,
PUBLISHER
} |
|
class provides a wrapper for system V IPC message buss. This allows for easy data communication between child modules and octopOS.
◆ role_t
enum for role discrimination. used to generate temp/perm ids
◆ tentacle()
tentacle::tentacle |
( |
key_t |
msg_key | ) |
|
|
explicit |
constructs a tentacle. Attaches shared memory segment to process if it is not already attached.
- Parameters
-
msg_key | message bus to attach tentacle to. |
◆ getTempId()
long tentacle::getTempId |
( |
role_t |
role | ) |
|
|
staticprotected |
generated a tem id for initial communication with octopOS.
- Parameters
-
role | The role that the id should be generated for. |
- Returns
- An unique temp id.
◆ read()
std::pair< long, std::string > tentacle::read |
( |
long |
type, |
|
|
bool |
block = true , |
|
|
bool |
under = false |
|
) |
| |
|
static |
reads a message from the message bus.
- Parameters
-
type | The type(id) of message to read from the bus. |
block | Whether or not the read call should block thread untill success, or just return. Set to false to do a non-blocking read. |
under | Set to true if you wish to read the range of ids under that type specified. This should only be used by octopOS. |
- Returns
- A pair where first is the type of the message read, and second is the contents of the message as a std::string.
◆ write() [1/2]
bool tentacle::write |
( |
long |
type, |
|
|
std::string |
data |
|
) |
| |
writes data to the message bus.
- Parameters
-
type | The type to publish the message under |
data | The message to be sent. |
- Returns
- true if write was successfull, otherwise false.
◆ write() [2/2]
bool tentacle::write |
( |
std::pair< long, std::string > |
pair | ) |
|
a wrapper for normal write. allows to pass a pair instead.
- Parameters
-
pair | The data to write. first becomes type and second beecomes data |
- Returns
- true if write was successfull, otherwise false.
◆ octopOS
allows octopOS to see its private. This is needed in a few use cases
◆ message_que
int tentacle::message_que |
|
staticprotected |
id of system V message queue
◆ shared_data
intptr_t * tentacle::shared_data = NULL |
|
staticprotected |
a pointer to the shared memory segment
The documentation for this class was generated from the following files: