#include <octopos.h>
octopOS is the main control class. It is singleton so there can only ever be one instance. octopOS implements a light weight data bus on top of the IPC primatives. On destruction, or a deadly signal octopOS will free these resources befor terminating the program
◆ octopOS()
octopOS::octopOS |
( |
octopOS const & |
| ) |
|
|
delete |
copy constructor deleted to prevent accidental copying of class
◆ ~octopOS()
The constructor creates the neccecary shared memory segments, semaphors, and IPC message busses for the rest of the system to build on.
◆ create_new_topic()
std::pair< unsigned, key_t > octopOS::create_new_topic |
( |
std::string |
name, |
|
|
unsigned |
size |
|
) |
| |
create_new_topic adds a new topic to octopOS that can be published to or subscreibed from.
- Parameters
-
name | The name of the new topic (will be used as it's identifier) |
size | The amount of space need to store the data object associated with the topic. |
- Returns
- a pair where the first is the offset of the data object in the shared memory segment, and the second is the key for the associated semaphore
◆ getInstance()
getInstance returns a reference to the single static instance of octopOS.
- Returns
- reference to running octopOS instance
◆ listen_for_child()
void * octopOS::listen_for_child |
( |
void * |
tentacle_index_dynamic | ) |
|
|
static |
listen_for_child listens for requestes from a child on a specific tentacle. It then routes the request and executes the proper octopOS code to complete the request. Function signature is designed to be used with pthread_create.
- Parameters
-
tentacle_index_dynamic | The index in the global tentacle list to be listening on. Note: this should be a pointer to dynamically allocated memory containing the index value. This memory will be freed by this function. |
- Returns
- NULL
◆ operator=()
void octopOS::operator= |
( |
octopOS const & |
| ) |
|
|
delete |
assignment operator deleted to prevent accidental copying of class
◆ propagate_to_subscribers()
bool octopOS::propagate_to_subscribers |
( |
std::string |
name | ) |
|
propagate_to_subscribers sends a message to every subscriber of a topic alerting it that the data has for the topic has been updated.
- Parameters
-
name | The topic to propagate t. |
- Returns
- true if propagation was successfull otherwise false.
◆ sig_handler()
void octopOS::sig_handler |
( |
int |
sig | ) |
|
|
static |
sig_handler provides a signal handler to clean up persistant resources in the case of total failure.
- Parameters
-
sig | The number identifier of the signal caught |
◆ subscribe_to_topic()
std::pair< unsigned, key_t > octopOS::subscribe_to_topic |
( |
std::string |
name, |
|
|
unsigned |
tentacle, |
|
|
octopOS_id_t |
subscriber_id, |
|
|
long |
size = -1 |
|
) |
| |
subscribe_to_topic adds a subscriber to a topic's subscriber list.
- Parameters
-
name | The name of the topic to subscribe to. |
tentacle | The tentacle that the subscription request is comming from. Need for later routing. |
subscriber_id | The unique identifier of the subscriber. |
size | The size of the topic data. Needed only if the topic does not exist so it can be created. |
- Returns
- a pair where the first is the offset of the data object in the shared memory segment, and the second is the key for the associated semaphore
The documentation for this class was generated from the following files: