get

The get method retrieves the message at the beginning of the message queue.

Signature
gen_ptr RiCOSMessageQueue_get(
   RiCOSMessageQueue * const me);
Parameters
me

The RiCOSMessageQueue from which to retrieve the message

Returns

The message

Example
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;
}

Feedback