static void cb_func(const lcm_recv_buf_t *rbuf, const char *channel, void *user_data) { typedef LCMTypedSubscription<MessageType,ContextClass> SubsClass; SubsClass *subs = static_cast<SubsClass *> (user_data); MessageType msg; int status = msg.decode(rbuf->data, 0, rbuf->data_size); if (status < 0) { fprintf (stderr, "error %d decoding %s!!!\n", status, MessageType::getTypeName()); return; } const ReceiveBuffer rb = { rbuf->data, rbuf->data_size, rbuf->recv_utime }; subs->handler(&rb, channel, &msg, subs->context); }
static void cb_func(const lcm_recv_buf_t *rbuf, const char *channel, void *user_data) { LCMMHSubscription<MessageType,MessageHandlerClass> *subs = static_cast<LCMMHSubscription<MessageType,MessageHandlerClass> *>(user_data); MessageType msg; int status = msg.decode(rbuf->data, 0, rbuf->data_size); if (status < 0) { fprintf (stderr, "error %d decoding %s!!!\n", status, MessageType::getTypeName()); return; } const ReceiveBuffer rb = { rbuf->data, rbuf->data_size, rbuf->recv_utime }; std::string chan_str(channel); (subs->handler->*subs->handlerMethod)(&rb, chan_str, &msg); }