9 #ifndef INCLUDE_TENTACLE_H_ 10 #define INCLUDE_TENTACLE_H_ 13 #include <sys/types.h> 37 static std::mutex id_lock;
40 static void initRand(ushort* rand_seed);
50 enum role_t {SUBSCRIBER, PUBLISHER };
77 static std::pair<long, std::string>
read(
long type,
bool block =
true,
86 bool write(
long type, std::string data);
94 bool write(std::pair<long, std::string> pair);
100 char buf[MSGLEN - 1];
104 explicit OctoString(
const std::string &value) {
105 if (value.size() > (MSGLEN - 2)) {
106 throw std::range_error(
"Given string is too large to publish.");
108 strcpy(buf, value.c_str());
110 OctoString& operator=(
const std::string &other) {
111 strcpy(buf, other.c_str());
115 strcpy(buf, other.buf);
119 return std::string(buf);
122 operator std::string() {
123 return std::string(buf);
127 #endif // INCLUDE_TENTACLE_H_ static long getTempId(role_t role)
Definition: tentacle.cpp:72
Definition: tentacle.h:31
tentacle(key_t msg_key)
Definition: tentacle.cpp:11
bool write(long type, std::string data)
Definition: tentacle.cpp:50
static std::pair< long, std::string > read(long type, bool block=true, bool under=false)
Definition: tentacle.cpp:28
Definition: tentacle.h:98
role_t
Definition: tentacle.h:50
static intptr_t * shared_data
Definition: tentacle.h:47
static int message_que
Definition: tentacle.h:44