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 
7 namespace gbxserialdeviceacfr {
8 
10 class TimedRxMsg {
11 public:
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 //
28 class StickInBufferCallback : public RxMsgCallback
29 {
30 public:
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 
43 private:
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:45
Definition: serialdevicehandler.h:66
Definition: printutil.cpp:8
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