The get method retrieves the message at the beginning of the message queue.
gen_ptr RiCOSMessageQueue_get(
RiCOSMessageQueue * const me);
me
The RiCOSMessageQueue from which to retrieve the message
The message
gen_ptr RiCOSMessageQueue_get(
RiCOSMessageQueue * const me)
{
gen_ptr m = NULL;
if (me == NULL) return NULL;
if (me->m_State == dataReady) {
m = me->pmessage;
me->m_State = noData;
}
else { /* function returns NULL if there are
no messages in me->hVxMQ queue */
if (msgQReceive(me->hVxMQ, (char*)&m, sizeof(m),
NO_WAIT) <= 0) /* nonblocking semantics */
return NULL;
}
return m;
}