CARMA C++
CatchData.h
1 #ifndef CARMA_PIPELINE_CATCHDATA_H
2 #define CARMA_PIPELINE_CATCHDATA_H
3 
4 #include "carma/pipeline/DataContainer.h"
5 #include "carma/pipeline/pipelineUtils.h"
6 #include "carma/util/FrameAlignedTimer.h"
7 #include "carma/util/types.h"
8 
9 #include <list>
10 #include <memory>
11 #include <string>
12 #include <vector>
13 #include <pthread.h>
14 
15 namespace carma {
16 
17  namespace corba {
18  class Server;
19  }
20 
21  namespace correlator {
22  namespace lib {
23  class CorrelatorListener;
24  class CorrelatorData;
25  }
26  }
27 
28  namespace monitor {
29  class PipelineSubsystem;
30  }
31 
32 
33  namespace pipeline {
34 
35  class DataContainer;
36  class DataCollectorN;
37 
45  class CatchData {
46  public:
47 
51  explicit CatchData( PipelineType pt,
52  long monitorWriteDelayMs,
53  int corrDataWriteDelayMs,
54  const std::string & channelPrefix,
55  const std::string & channelSuffix,
56  carma::corba::Server & server );
57 
61  virtual ~CatchData();
62 
68 
69  void run();
70 
71  private:
72 
73  // Disallow copy and assignment
74  CatchData( const CatchData & rhs );
75  CatchData & operator=( const CatchData & rhs );
76 
77  struct CorrelatorDataStatsInfo;
78  struct SharedMonitorInfo;
79 
84  void performUpdate( bool firstTime,
85  size_t * numBandsHighWaterMark,
86  carma::util::frameType frame );
87 
88  static void harvestCorrelatorDataStatsInfo(
89  CorrelatorDataStatsInfo * cdsi,
91 
92  static void monitorUpdateThread( CatchData & This );
93 
94  class MonitorUpdateTQRH; // Thread quit request handler
95 
96  void notifyListeners(
98 
99  void processMonitorPoints( const CorrelatorDataStatsInfo & cdsi );
100  void fillMonitorData( ) const;
101  void computeStats( const CorrelatorDataStatsInfo & cdsi );
102 
103  const PipelineType pt_;
104  const int waitTimeInMillis_;
105 
106  carma::pipeline::DataContainer _dataContainer;
107  ::std::list<carma::correlator::lib::CorrelatorListener *> _listeners;
108 
109  mutable std::auto_ptr< carma::monitor::PipelineSubsystem > monitorData_;
110  ::std::vector< DataCollectorN * > collectors_;
111 
112  ::std::auto_ptr< SharedMonitorInfo > smi_;
113  mutable carma::util::PthreadMutex smiMutex_;
114 
115  carma::util::FrameAlignedTimer frameTimer_;
116  ::pthread_t monitorUpdateThread_;
117  };
118 
119 } // End namespace pipeline
120 } // End namespace carma
121 
122 #endif
Class used to mediate the merging and writing of a data object at specific times. ...
Definition: CatchData.h:45
unsigned int frameType
Half second frames since Jan 1, 2000.
Definition: types.h:29
virtual ~CatchData()
Shuts down timer and releases any memory.
Class used to represents bands of Correlator Data.
Interface for those wishing to receive notification of arriving Correlator Data.
Class for creating, managing and serving requests to CORBA servants.
Definition: Server.h:22
A simple wrapper class that makes use of ::pthread_mutex_t easier in a C++ world. ...
Definition: PthreadMutex.h:41
void addCorrelatorListener(carma::correlator::lib::CorrelatorListener *cListener)
add a listener for receiving the dataFrame after data have been collected
Various type definitions for util classes.
CatchData(PipelineType pt, long monitorWriteDelayMs, int corrDataWriteDelayMs, const std::string &channelPrefix, const std::string &channelSuffix, carma::corba::Server &server)
Creates all necessary objects.
Timer object that fires at a fixed offset after every Nth CARMA frame time.