INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         
stickinbuffercallback.h
1#ifndef GBXSERIALDEVICEACFR_STICKINBUFFERCALLBACK_H
2#define GBXSERIALDEVICEACFR_STICKINBUFFERCALLBACK_H
3
4#include <gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h>
5#include <gbxsickacfr/gbxiceutilacfr/buffer.h>
6
7namespace gbxserialdeviceacfr {
8
11public:
12
13 // Require an empty constructor to put in a buffer
14 TimedRxMsg() {}
15 TimedRxMsg( int s, int us, const RxMsgPtr &r )
16 : timeStampSec(s), timeStampUsec(us), msg(r) {}
17
18 int timeStampSec;
19 int timeStampUsec;
20 RxMsgPtr msg;
21};
22
23//
24// @brief simply sticks new messages into a thread-safe buffer
25//
26// @author Alex Brooks
27//
28class StickInBufferCallback : public RxMsgCallback
29{
30public:
31
32 StickInBufferCallback() {}
33
34 // from RxMsgCallback
35 void msgReceived( const RxMsgPtr &msg,
36 int timeStampSec,
37 int timeStampUsec )
38 { rxMsgBuffer_.push( TimedRxMsg( timeStampSec, timeStampUsec, msg ) ); }
39
40 // Allow external non-const access direct to (thread-safe) rxMsgBuffer.
41 gbxiceutilacfr::Buffer<TimedRxMsg> &rxMsgBuffer() { return rxMsgBuffer_; }
42
43private:
44
45 // Thread-safe store of rxMsgs from the device
47};
48
49}
50
51#endif
A thread-safe data pipe with buffer semantics.
Definition: buffer.h:46
Definition: serialdevicehandler.h:66
Received message plus a timeStamp: a simple container to keep the two together.
Definition: stickinbuffercallback.h:10
 

Generated for GearBox by  doxygen 1.4.5