gusimplewhiteboard
|
compatibility API for accessing the whiteboard More...
#include <Whiteboard.h>
Classes | |
struct | callback_descr |
Public Types | |
enum | wb_method_result { METHOD_OK , METHOD_FAIL } |
Return Type Enum. More... | |
typedef enum guWhiteboard::Whiteboard::wb_method_result | WBResult |
Return Type Enum. More... | |
Public Member Functions | |
Whiteboard (const char *sharedMemoryObjectName=gsw_global_whiteboard_name, bool checkVersion=true, int number=0) | |
API Constructor This sets up the API and the callback soap server. More... | |
virtual | ~Whiteboard () |
Destructor. More... | |
void | addMessage (gsw_hash_info *hashinfo, const WBMsg &msg, bool nonatomic=false, bool notifySubscribers=true) |
Add Message Adds a message to the whiteboard that the API is connected to. More... | |
WBMsg | getMessage (gsw_hash_info *hashinfo, WBResult *result=NULLPTR) |
Get Message Gets a message from a simple whiteboard. More... | |
void | subscriptionCallback (void) |
subscription callback: not really public! More... | |
virtual void | subscribeToMessage (gsw_hash_info *hashinfo, WBFunctorBase *func, WBResult &result) |
Subscribe To Message Subscribes to a message type on a whiteboard or whiteboards. More... | |
void | unsubscribeToMessage (gsw_hash_info *hashinfo, WBResult &result) |
Unsubscribe To Message (sic!) Unsubscribes from a message type on a whiteboard or whiteboards. More... | |
gsw_hash_info * | getTypeOffset (std::string type) |
create a hash offset from message type, needed for adding, getting from WB More... | |
void | addMessage (const std::string &type, const WBMsg &msg, bool nonatomic=false, bool notifySubscribers=true) |
Add Message Adds a message to the whiteboard that the API is connected to. More... | |
WBMsg | getMessage (std::string type, WBResult *result=NULLPTR) |
Get Message Gets a message from a simple whiteboard. More... | |
virtual void | subscribeToMessage (const std::string &type, WBFunctorBase *func, WBResult &result) |
Subscribe To Message Subscribes to a message type on a whiteboard or whiteboards. More... | |
void | unsubscribeToMessage (std::string type, WBResult &result) |
Unsubscribe To Message (sic!) Unsubscribes from a message type on a whiteboard or whiteboards. More... | |
Static Public Member Functions | |
static WBMsg | getWBMsg (gu_simple_message *m) |
convert the new 'simple' whiteboard data structure into the old WBMsg format More... | |
Public Attributes | |
gu_simple_whiteboard_descriptor * | _wbd |
underlying whiteboard More... | |
compatibility API for accessing the whiteboard
Definition at line 115 of file Whiteboard.h.
Return Type Enum.
Allows the user to test if an error has occured
Return Type Enum.
Allows the user to test if an error has occured
Enumerator | |
---|---|
METHOD_OK | No errors detected. |
METHOD_FAIL | Errors detected. |
Definition at line 166 of file Whiteboard.h.
Whiteboard::Whiteboard | ( | const char * | sharedMemoryObjectName = gsw_global_whiteboard_name , |
bool | checkVersion = true , |
||
int | number = 0 |
||
) |
API Constructor This sets up the API and the callback soap server.
[in] | sharedMemoryObjectName | (optional) Allows the user to specify a local shared-memory whiteboard to use. |
[in] | checkVersion | indicate whether to check wb version (default: true) |
[in] | number | whiteboard number (0 = local, 1..4 = reserved for robots) |
Definition at line 91 of file Whiteboard.cc.
References _wbd, gsw_whiteboard_s::callback, gsw_whiteboard_s::context, DISPATCH_QUEUE_SERIAL, gsw_global_whiteboard_name, gsw_new_numbered_whiteboard(), and init_ios_whiteboard_name.
Referenced by guWhiteboard::RemoteWhiteboard::RemoteWhiteboard().
|
virtual |
Destructor.
shuts down the whiteboard
Definition at line 119 of file Whiteboard.cc.
References _wbd, gsw_whiteboard_s::callback, and gsw_free_whiteboard().
void Whiteboard::addMessage | ( | const std::string & | type, |
const WBMsg & | msg, | ||
bool | nonatomic = false , |
||
bool | notifySubscribers = true |
||
) |
Add Message Adds a message to the whiteboard that the API is connected to.
[in] | type | The string type associated with the message object |
[in] | msg | The message object to post to the whiteboard |
[in] | nonatomic | Add quickly without grabbing the semaphore |
[in] | notifySubscribers | Signal subscribers (default: true) |
Definition at line 328 of file Whiteboard.cc.
References addMessage().
void Whiteboard::addMessage | ( | gsw_hash_info * | hashinfo, |
const WBMsg & | msg, | ||
bool | nonatomic = false , |
||
bool | notifySubscribers = true |
||
) |
Add Message Adds a message to the whiteboard that the API is connected to.
[in] | hashinfo | Contains the offset index to access a message |
[in] | msg | The message object to post to the whiteboard |
[in] | nonatomic | Add quickly without grabbing the semaphore |
[in] | notifySubscribers | Signal subscribers (default: true) |
Definition at line 130 of file Whiteboard.cc.
References _wbd, gsw_simple_message::data, WBMsg::getArrayValue(), WBMsg::getBinaryValue(), WBMsg::getBoolValue(), WBMsg::getFloatValue(), WBMsg::getIntValue(), WBMsg::getSizeInBytes(), WBMsg::getStringValue(), WBMsg::getType(), gsw_increment(), gsw_increment_event_counter(), gsw_next_message(), gsw_procure(), GSW_SEM_PUTMSG, gsw_signal_subscribers(), gsw_vacate(), gsw_simple_message::ivec, gsw_simple_message::len, guWhiteboard::gsw_hash_info::msg_offset, gsw_whiteboard_s::sem, gsw_simple_message::sfloat, gsw_simple_message::sint, gsw_simple_whiteboard_s::subscribed, gsw_simple_message::type, WBMsg::TypeArray, WBMsg::TypeBinary, WBMsg::TypeBool, WBMsg::TypeEmpty, WBMsg::TypeFloat, WBMsg::TypeInt, WBMsg::TypeString, gsw_whiteboard_s::wb, and gsw_simple_message::wbmsg.
Referenced by addMessage(), and guWhiteboard::RemoteWhiteboard::addReplicationType().
WBMsg Whiteboard::getMessage | ( | gsw_hash_info * | hashinfo, |
WBResult * | result = NULLPTR |
||
) |
Get Message Gets a message from a simple whiteboard.
[in] | hashinfo | Contains the offset index to access a message |
[out] | result | A pointer (!) to WBResult to indicate whether a message existed or not |
Definition at line 194 of file Whiteboard.cc.
References _wbd, getWBMsg(), gsw_current_message(), gsw_simple_message::len, METHOD_FAIL, METHOD_OK, guWhiteboard::gsw_hash_info::msg_offset, gsw_simple_message::type, gsw_whiteboard_s::wb, and gsw_simple_message::wbmsg.
Referenced by getMessage().
Get Message Gets a message from a simple whiteboard.
[in] | type | The string type associated with the message object |
[out] | result | A pointer (!) to WBResult to indicate whether a message existed or not |
Definition at line 334 of file Whiteboard.cc.
References getMessage().
gsw_hash_info * Whiteboard::getTypeOffset | ( | std::string | type | ) |
create a hash offset from message type, needed for adding, getting from WB
[in] | type | The string type get the offset for |
Definition at line 210 of file Whiteboard.cc.
|
inlinestatic |
convert the new 'simple' whiteboard data structure into the old WBMsg format
Definition at line 213 of file Whiteboard.h.
References gsw_simple_message::data, gsw_simple_message::ivec, gsw_simple_message::len, gsw_simple_message::sfloat, gsw_simple_message::sint, gsw_simple_message::type, WBMsg::TypeArray, WBMsg::TypeBinary, WBMsg::TypeBool, WBMsg::TypeFloat, WBMsg::TypeInt, WBMsg::TypeString, and gsw_simple_message::wbmsg.
Referenced by getMessage().
|
virtual |
Subscribe To Message Subscribes to a message type on a whiteboard or whiteboards.
[in] | type | The string type to subscribe to |
[in] | func | The function to call when a message of the type enter is added |
[out] | result | An enum showing that either an error occured or the operation was completed successfully |
Reimplemented in guWhiteboard::RemoteWhiteboard.
Definition at line 340 of file Whiteboard.cc.
References subscribeToMessage().
|
virtual |
Subscribe To Message Subscribes to a message type on a whiteboard or whiteboards.
[in] | hashinfo | The string type to subscribe to |
[in] | func | The function to call when a message of the type enter is added |
[out] | result | An enum showing that either an error occured or the operation was completed successfully |
Definition at line 227 of file Whiteboard.cc.
References _wbd, GLOBAL_MSG_ID, gsw_add_process(), gsw_add_wbd_signal_handler(), gsw_procure(), GSW_SEM_CALLBACK, gsw_vacate(), gsw_simple_whiteboard_s::indexes, METHOD_OK, guWhiteboard::gsw_hash_info::msg_offset, gsw_simple_whiteboard_s::num_types, gsw_whiteboard_s::sem, and gsw_whiteboard_s::wb.
Referenced by guWhiteboard::RemoteWhiteboard::subscribeToMessage(), and subscribeToMessage().
void Whiteboard::subscriptionCallback | ( | void | ) |
subscription callback: not really public!
Definition at line 267 of file Whiteboard.cc.
References _wbd, guWhiteboard::Whiteboard::callback_descr::current, gsw_procure(), GSW_SEM_CALLBACK, GU_SIMPLE_WHITEBOARD_GENERATIONS, gsw_simple_whiteboard_s::indexes, gsw_simple_whiteboard_s::num_types, gsw_whiteboard_s::sem, guWhiteboard::Whiteboard::callback_descr::type, and gsw_whiteboard_s::wb.
void Whiteboard::unsubscribeToMessage | ( | gsw_hash_info * | hashinfo, |
WBResult & | result | ||
) |
Unsubscribe To Message (sic!) Unsubscribes from a message type on a whiteboard or whiteboards.
[in] | hashinfo | The string type to unsubscribe from |
[out] | result | An enum showing that either an error occured or the operation was completed successfully |
Definition at line 305 of file Whiteboard.cc.
References _wbd, GLOBAL_MSG_ID, gsw_procure(), gsw_remove_process(), GSW_SEM_CALLBACK, gsw_vacate(), METHOD_FAIL, METHOD_OK, guWhiteboard::gsw_hash_info::msg_offset, gsw_whiteboard_s::sem, and guWhiteboard::Whiteboard::callback_descr::type.
Referenced by unsubscribeToMessage().
void Whiteboard::unsubscribeToMessage | ( | std::string | type, |
WBResult & | result | ||
) |
Unsubscribe To Message (sic!) Unsubscribes from a message type on a whiteboard or whiteboards.
[in] | type | The string type to unsubscribe from |
[out] | result | An enum showing that either an error occured or the operation was completed successfully |
Definition at line 346 of file Whiteboard.cc.
References unsubscribeToMessage().
gu_simple_whiteboard_descriptor* guWhiteboard::Whiteboard::_wbd |
underlying whiteboard
Definition at line 136 of file Whiteboard.h.
Referenced by Whiteboard(), ~Whiteboard(), addMessage(), guWhiteboard::RemoteWhiteboard::getKnownTypesForMachine(), getMessage(), subscribeToMessage(), subscriptionCallback(), and unsubscribeToMessage().