CARMA C++
LLWorkerBoard0Thread.h
1 #ifndef LLWORKERBOARD0THREAD_H
2 #define LLWORKERBOARD0THREAD_H
3 // $Id: LLWorkerBoard0Thread.h,v 1.12 2013/01/07 21:36:41 iws Exp $
4 
5 #include <carma/util/PthreadMutex.h>
6 #include <carma/util/types.h>
7 
8 #include <carma/linelength/ComediDevice.h>
9 
10 #include <boost/shared_ptr.hpp>
11 
12 #include <complex>
13 #include <vector>
14 
15 namespace carma {
16 namespace linelength {
17 
18 struct LLBoard0Data
19 {
20  // timestamp of when this data was captured
21  carma::util::frameType timestamp;
22  ComediSamplePtr rawData;
23 
24  // Complex Data contains both amplitude and phase information
25  // amplitude: abs(std::complex<double>);
26  // phase: arg(std::complex<double>);
27 
28  // Antenna Data (24 antennas)
29  std::vector< std::complex<double> > antComplex;
30  std::vector<double> antPhaseRMS;
31 
32  // Reference Data (3 references)
33  std::vector< std::complex<double> > refComplex;
34  std::vector<double> refPhaseRMS;
35 
36  // Reference Lock Status
37  std::vector<bool> refLockInfo;
38 };
39 
40 typedef boost::shared_ptr<LLBoard0Data> LLBoard0DataPtr;
41 
42 class LLWorkerBoard0Thread
43 {
44  public:
45  LLWorkerBoard0Thread(const std::string &device);
46  ~LLWorkerBoard0Thread();
47 
48  // Thread
49  static void thread(LLWorkerBoard0Thread &This) { This.run(); };
50  void run();
51 
52  // Data Interface
53  LLBoard0DataPtr getNewestData() const;
54 
55  private:
56  const std::string device_;
57 
58  // Data buffer
59  mutable carma::util::PthreadMutex mutex_;
60  LLBoard0DataPtr data_;
61 };
62 
63 } // namespace carma::linelength
64 } // namespace carma
65 
66 #endif // LLWORKERBOARD0THREAD_H
67 // vim: set expandtab ts=4 sts=4 sw=4:
unsigned int frameType
Half second frames since Jan 1, 2000.
Definition: types.h:29
A simple wrapper class that makes use of ::pthread_mutex_t easier in a C++ world. ...
Definition: PthreadMutex.h:41
Various type definitions for util classes.