58#ifndef gusimplewhiteboard_gusimplewhiteboard_h
59#define gusimplewhiteboard_gusimplewhiteboard_h
61#pragma clang diagnostic push
62#pragma clang diagnostic ignored "-Wpadded"
63#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
64#pragma clang diagnostic ignored "-Wunused-macros"
65#pragma clang diagnostic ignored "-Wreserved-id-macro"
66#pragma clang diagnostic ignored "-Wdeprecated"
67#pragma clang diagnostic ignored "-Wold-style-cast"
70# ifndef TARGET_OS_IPHONE
71# include <AvailabilityMacros.h>
74#ifndef WITHOUT_LIBDISPATCH
75#include <dispatch/dispatch.h>
83#if __cplusplus < 201103L
93#define __block _xblock
96#define __block __attribute__((__blocks__(byref)))
99#define __has_feature(x) 0
104#pragma clang diagnostic ignored "-Wc++11-long-long"
117# define u_int64_t uint64_t
120# define u_int32_t uint32_t
123# define u_int16_t uint16_t
126# define u_int8_t uint8_t
129#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
130#define GSW_IOS_SIMULATOR
133#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE && !defined (GSW_IOS_SIMULATOR)
134#define GSW_IOS_DEVICE
137#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE || defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
141#define GU_SIMPLE_WHITEBOARD_VERSION 6
142#ifndef GU_SIMPLE_WHITEBOARD_GENERATIONS
143#define GU_SIMPLE_WHITEBOARD_GENERATIONS 4
145#ifndef GU_SIMPLE_WHITEBOARD_BUFSIZE
146#define GU_SIMPLE_WHITEBOARD_BUFSIZE 128
148#ifndef GSW_TOTAL_MESSAGE_TYPES
149#define GSW_TOTAL_MESSAGE_TYPES 512
151#ifndef GSW_NUM_RESERVED
152#define GSW_NUM_RESERVED (GSW_TOTAL_MESSAGE_TYPES/2)
154#define GSW_TOTAL_PROCESSES 256
155#define GSW_NON_RESERVED_MESSAGE_TYPES (GSW_TOTAL_MESSAGE_TYPES-GSW_NUM_RESERVED)
158#ifndef GSW_DEFAULT_ENV
159#define GSW_DEFAULT_ENV "WHITEBOARD_NAME"
161#ifndef GSW_DEFAULT_NAME
162#define GSW_DEFAULT_NAME "guWhiteboard"
164#ifndef GSWR_BASE_NAME
165#define GSWR_BASE_NAME "guudpwhiteboard"
167#ifndef WHITEBOARD_SIGNAL
168#define WHITEBOARD_SIGNAL SIGUSR2
170#ifndef WHITEBOARD_POLL_PERIOD
171#define WHITEBOARD_POLL_PERIOD 10000
303typedef dispatch_semaphore_t __strong *
gsw_sema_t;
314#if __has_feature(objc_arc) || defined(WITHOUT_LIBDISPATCH)
335#define GSW_NUM_TYPES_DEFINED num_types_defined
469#pragma mark - subscription and callbacks
505#pragma clang diagnostic pop
gu_simple_message * gsw_next_message(gu_simple_whiteboard *wb, int i)
get the next shared memory location for the given whiteboard message type i
#define GU_SIMPLE_WHITEBOARD_GENERATIONS
lifespan (max)
void gsw_add_wbd_signal_handler(gu_simple_whiteboard_descriptor *wbd)
add subscription signal handler
void gsw_free_whiteboard(gu_simple_whiteboard_descriptor *wbd)
free the given whiteboard descriptor
void gsw_free(gu_simple_whiteboard *wb, int fd)
free the whiteboard
gsw_sema_t gsw_setup_semaphores(int key)
set up a semaphore array for the whiteboard
struct gsw_whiteboard_s gu_simple_whiteboard_descriptor
the underlying whiteboard object
void gsw_increment(gu_simple_whiteboard *wb, int i)
get the next shared memory location for the given whiteboard message type i
void gsw_increment_event_counter(gu_simple_whiteboard *wb, int i)
add to a messages event counter on the wb
gu_simple_whiteboard_descriptor * gsw_new_custom_whiteboard(const char *name, const char *message_names[], int num_messages, int semaphore_magic_key)
Access a named, custom whiteboard.
#define GSW_TOTAL_PROCESSES
maximum subscriber procs
gu_simple_whiteboard_descriptor * get_local_singleton_whiteboard(void)
create a simple whiteboard for the local singleton wb pointer
gu_simple_whiteboard_descriptor * gsw_new_whiteboard(const char *name)
access a named whiteboard: this is the designated constructore for C programs
const char ** WBTypes_stringValues
allow whiteboard to use old functions for whiteboard initialisation and choose which messages and con...
int num_types_defined
allow whiteboard to use old functions for whiteboard initialisation and choose which messages and con...
gu_simple_whiteboard_descriptor * gsw_new_numbered_whiteboard(const char *name, int num)
access a named whiteboard: this is the designated standard wb constructor for C programs that want to...
gu_simple_message * gsw_current_message(gu_simple_whiteboard *wb, int i)
get the current shared memory location for the given whiteboard message type i
gu_simple_whiteboard * gsw_create(const char *name, int *fdp, bool *ini)
create a simple whiteboard
int gsw_procure(gsw_sema_t sem, enum gsw_semaphores s)
grab a whiteboard semaphore
void(* gsw_subscription_f)(struct gsw_whiteboard_s *wbd)
int gsw_offset_for_message_type(gu_simple_whiteboard_descriptor *wbd, const char *name)
get the numerical index of a whiteboard message type
struct gsw_simple_whiteboard_s gu_simple_whiteboard
the actual whiteboard in shared mem
int gsw_register_message_type(gu_simple_whiteboard_descriptor *wbd, const char *name)
register a new whiteboard message type
#define GSW_TOTAL_MESSAGE_TYPES
message types (max)
union gsw_simple_message gu_simple_message
union type that is used to store data in shared memory
void gsw_init_semaphores(gsw_sema_t sem)
initialise the whiteboard semaphores
void gsw_remove_wbd_signal_handler(gu_simple_whiteboard_descriptor *wbd)
remove subscription signal handler
const char * gsw_global_whiteboard_name
global whiteboard name
@ GSW_SEM_CALLBACK
semaphore for callback data
@ GSW_NUM_SEM
number of semaphores
@ GSW_SEM_MSGTYPE
semaphore for message type registration
@ GSW_SEM_PROC
semaphore for process registration
@ GSW_SEM_PUTMSG
semaphore for adding to the whiteboard
void gsw_remove_process(gu_simple_whiteboard_descriptor *wbd, const pid_t proc)
remove process for subscription signalling
int gsw_vacate(gsw_sema_t sem, enum gsw_semaphores s)
release a whiteboard semaphore
void gsw_add_process(gu_simple_whiteboard_descriptor *wbd, const pid_t proc)
subscribe a new process to receive signals
gu_simple_whiteboard_descriptor * gswr_new_whiteboard(int i)
access a remote named whiteboard: this is the designated constructore for C programs
void gsw_signal_subscribers(gu_simple_whiteboard *wb)
signal all subscribing processes
#define GU_SIMPLE_WHITEBOARD_BUFSIZE
message len (max)
the actual whiteboard in shared mem
uint16_t version
whiteboard version
uint16_t eventcount
current event count
gu_simple_message typenames[512]
message types for numbers
pid_t processes[256]
list of subscribed processes
uint8_t indexes[512]
ring buffer indexes
gu_simple_message hashes[512]
hashes for registered message types
uint16_t num_types
total number of current, registered types
uint64_t magic
end of whiteboard marker
uint16_t event_counters[512]
event counter loops
gu_simple_message messages[512][4]
the actual messages stored in the whiteboard
uint16_t subscribed
subscribed processes
the underlying whiteboard object
bool got_monitor
have a running monitor
bool exit_monitor
exit the monitor
gsw_subscription_f callback
subscription callback function
dispatch_queue_t callback_queue
subscription callback queue
int fd
the associated memory-mapped file
void * context
callback context
gsw_sema_t sem
semaphore to use
gu_simple_whiteboard * wb
the actual whiteboard in shared mem
union type that is used to store data in shared memory
int32_t s32
signed 32 bit value
uint8_t u8
unsigned 8 bit value
uint64_t u64vec[128/sizeof(uint64_t)]
u_int64_t array
unsigned long ulong
unsigned long value
unsigned long ulvec[128/sizeof(unsigned long)]
unsigned long array
long slong
singed long value
unsigned uivec[128/sizeof(unsigned)]
unsigned array
int64_t s64vec[128/sizeof(int64_t)]
int64_t array
long long llvec[128/sizeof(long long)]
long long array
unsigned char uchar
unsigned char
unsigned short usvec[128/sizeof(unsigned short)]
unsigned short array
struct gsw_simple_message::@2 fcoord
simple float coordinates
struct gsw_simple_message::@1 dcoord
simple double coordinates
long lvec[128/sizeof(long)]
long array
unsigned uint
unsigned integer
struct gsw_simple_message::@3 hash
whiteboard hash type
uint8_t u8vec[128]
u_int8_t array
struct gsw_simple_message::@0 coord
simple 16 bit integer coordinates
uint64_t u64
unsigned 64 bit value
bool bvec[128/sizeof(bool)]
bool array
long double slongdouble
long double
unsigned short ushort
unsigned short
int64_t s64
signed 64 bit value
long long slonglong
long long value
uint32_t u32
unsigned 32 bit value
int ivec[128/sizeof(int)]
int array
unsigned char ucvec[128/sizeof(unsigned char)]
unsigned char array
struct gsw_simple_message::@4 wbmsg
compatibility WBMsg type
int16_t s16vec[128/sizeof(int16_t)]
int16_t array
double sdouble
signed double
signed char schar
signed char
uint32_t u32vec[128/sizeof(uint32_t)]
u_int32_t array
uint16_t u16
unsigned 16 bit value
int32_t s32vec[128/sizeof(int32_t)]
int32_t array
short svec[128/sizeof(short)]
short array
int16_t s16
signed 16 bit value
int8_t s8
signed 8 bit value
signed char cvec[128/sizeof(signed char)]
signed char array
int8_t s8vec[128]
int8_t array
unsigned long long ulonglong
unsigned long long value
uint16_t u16vec[128/sizeof(uint16_t)]
u_int16_t array
unsigned long long ullvec[128/sizeof(unsigned long long)]
vector types