CARMA C++
AHW_Processor.h
1 /*
2  * AstroHeaderWriter processor for a single type of integrated monitor data
3  */
4 
5 #ifndef CARMA_SDP_AHW_PROCESSOR_H
6 #define CARMA_SDP_AHW_PROCESSOR_H
7 
8 // Carma includes
9 #include <carma/sdp/AHW_Output.h>
10 #include <carma/sdp/AHW_Utils.h>
11 #include <carma/sdp/LineBuffer.h>
13 
16 
17 #include <carma/monitor/DataflowSubsystem.h>
18 
19 #include <carma/util/StopWatch.h>
20 
21 // C++ standard library includes
22 #include <map>
23 #include <vector>
24 #include <string>
25 
26 // Boost includes
27 #include <boost/shared_ptr.hpp>
28 
29 // Namespace using directives
30 
31 // Class definitions
32 namespace carma {
33 namespace sdp {
34 
35 typedef std::map<carma::dbms::MonitorAggregateType, std::string> MonitorAggregateMap;
36 
42 {
43  public:
44  void addFile(const carma::dbms::MonitorAggregateType &type, const std::string &file);
45  bool isComplete() const;
46  void rename(const std::string &suffix);
47  std::string print() const;
48  std::vector<std::string> getNames() const;
49  MonitorAggregateMap getMap() const;
50 
51  private:
52  MonitorAggregateMap map_;
53 };
54 
55 typedef std::map<carma::util::frameType, InputFileSet> InputFileSetMap;
56 
69 {
70 public:
72  const carma::util::CorrelatorType &corlType,
73  const std::string &inputDir,
74  const std::string &outputDir,
75  const std::string &recycleDir,
76  const std::vector<AHW_Output> &outputs,
77  const carma::monitor::DataflowSubsystem::Correlator *monitor);
78  ~AHW_Processor();
79 
86  void reset();
87 
100  unsigned int run_single_iteration(const double elapsedTime, const double lastSleepTime);
101 
105  std::string getCorrelatorType() const;
106 
107 private:
108 
109  AHW_Processor();
110  InputFileSetMap scan_input_files();
111  MPValueMap read_mpdat_set(const InputFileSet &fileSet) const;
112  void update_obsblock(const carma::util::frameType frameCount, const MPValueMap &mpValues);
113  void process_integration(const carma::util::frameType frameCount, const InputFileSet &fileSet, const MPValueMap &mpValues);
114  void close_current_obsblock();
115 
116  const carma::util::CorrelatorType corlType_;
117  const std::string inputDir_;
118  const std::string outputDir_;
119  const std::string recycleDir_;
120  const std::vector<AHW_Output> outputs_;
121  const carma::monitor::DataflowSubsystem::Correlator *monitor_;
122 
127  const int obsBlockLen_;
128 
132  const MPWantedMap mpWanted_;
133 
137  std::string currentAstroHdrFile_;
138 
142  std::string currentObsBlockId_;
143 
147  typedef boost::shared_ptr<LineBuffer> LineBufferPtr;
148  LineBufferPtr currentLineBuffer_;
149 
153  carma::util::frameType startingFrameCount_;
154 
158  std::vector<InputFileSet> currentInputRead_;
159 };
160 
161 } // namespace carma::sdp
162 } // namespace carma
163 
164 
165 #endif /* CARMA_SDP_AHW_PROCESSOR_H */
166 
167 /* vim: set ts=4 sts=4 sw=4 et tw=92: */
void reset()
Reset the AHW input and output directories.
A class to handle common operations on a set of input MPDAT files for a single integration.
Definition: AHW_Processor.h:41
Holds basic info on a monitor point value.
std::string getCorrelatorType() const
Get a string representation of the correlator type.
MonitorAggregateType
aggregate data type of the monitor[point,data file, table]
A class to create Astronomical Header files for a single type of integrated monitor data...
Definition: AHW_Processor.h:68
unsigned int frameType
Half second frames since Jan 1, 2000.
Definition: types.h:29
unsigned int run_single_iteration(const double elapsedTime, const double lastSleepTime)
Run a single iteration of the AstroHeaderWriter.
relationships between the monitor and dbms systems
MonitorDataIndex class.