OctopOS  0.6.0
Data communication bus for SPACE HAUC
Public Member Functions | Static Public Member Functions | Protected Types | Static Protected Member Functions | Static Protected Attributes | Friends | List of all members
tentacle Class Reference

#include <tentacle.h>

Inheritance diagram for tentacle:
publisher< T > subscriber_manager subscriber< T >

Public Member Functions

 tentacle (key_t msg_key)
 
bool write (long type, std::string data)
 
bool write (std::pair< long, std::string > pair)
 

Static Public Member Functions

static std::pair< long, std::string > read (long type, bool block=true, bool under=false)
 

Protected Types

enum  role_t { SUBSCRIBER, PUBLISHER }
 

Static Protected Member Functions

static long getTempId (role_t role)
 

Static Protected Attributes

static int message_que
 
static intptr_t * shared_data = NULL
 

Friends

class octopOS
 

Detailed Description

class provides a wrapper for system V IPC message buss. This allows for easy data communication between child modules and octopOS.

Member Enumeration Documentation

◆ role_t

enum tentacle::role_t
protected

enum for role discrimination. used to generate temp/perm ids

Constructor & Destructor Documentation

◆ 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_keymessage bus to attach tentacle to.

Member Function Documentation

◆ getTempId()

long tentacle::getTempId ( role_t  role)
staticprotected

generated a tem id for initial communication with octopOS.

Parameters
roleThe 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
typeThe type(id) of message to read from the bus.
blockWhether or not the read call should block thread untill success, or just return. Set to false to do a non-blocking read.
underSet 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
typeThe type to publish the message under
dataThe 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
pairThe data to write. first becomes type and second beecomes data
Returns
true if write was successfull, otherwise false.

Friends And Related Function Documentation

◆ octopOS

friend class octopOS
friend

allows octopOS to see its private. This is needed in a few use cases

Member Data Documentation

◆ 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: