#include <subscriber.h>
|
enum | role_t { SUBSCRIBER,
PUBLISHER
} |
|
subscriber_manager provides a base class with static maps that can be shared across the different templated child classes
◆ subscriber_manager()
subscriber_manager::subscriber_manager |
( |
key_t |
shared_queue | ) |
|
|
inlineexplicitprotected |
constructs subscriber_manager class. passes the message bus key to the parent tentacle.
- Parameters
-
shared_queue | The message bus to construct a tentacle on. |
◆ register_cb()
Registers CB to topic; CB will be invoked when new data is available on topic
- Parameters
-
cb | The callback to be registered for the topic. |
topic | The name of the topic to register the callback to. |
size | The size of the data object. Only used if a new topic must be created. |
sub | A reference to the subscriber class invoking the static method. |
- Returns
- true if registerd successfully, otherwise false.
◆ wait_for_data()
void * subscriber_manager::wait_for_data |
( |
void * |
data | ) |
|
|
static |
wait_for_data provides a "server" funtion that waits for updates notifications from octopOS and then adds the data to the data_queue of the different subscribers. Function signature is like this so it can easily be run in it's own thread.
- Parameters
-
- Returns
- Will not return. This function loops infinatly.
◆ registered_callbacks
std::unordered_map< std::string, std::vector< callback > > subscriber_manager::registered_callbacks |
|
staticprotected |
Initial value:=
std::unordered_map<std::string, std::vector<callback> >()
topic_ids is a map which assosciates the topic name with its callbacks
◆ topic_ids
std::unordered_map< std::string, octopOS_id_t > subscriber_manager::topic_ids |
|
staticprotected |
Initial value:=
std::unordered_map<std::string, octopOS_id_t>()
topic_ids is a map which assosciates the topic name with its unique identifier
◆ topic_ids_lock
std::mutex subscriber_manager::topic_ids_lock |
|
staticprotected |
mutex locks for the different member data v
◆ topic_memory
Initial value:=
std::unordered_map<std::string,
std::tuple<sem_id_t, shm_object*, generic_t*>>()
topic_memory is a map which assosciates all the shared memory data with a topic name
The documentation for this class was generated from the following files: