nidas  v1.2-1520
StatisticsProcessor.h
Go to the documentation of this file.
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2 // vim: set shiftwidth=4 softtabstop=4 expandtab:
3 /*
4  ********************************************************************
5  ** NIDAS: NCAR In-situ Data Acquistion Software
6  **
7  ** 2006, Copyright University Corporation for Atmospheric Research
8  **
9  ** This program is free software; you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation; either version 2 of the License, or
12  ** (at your option) any later version.
13  **
14  ** This program is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** The LICENSE.txt file accompanying this software contains
20  ** a copy of the GNU General Public License. If it is not found,
21  ** write to the Free Software Foundation, Inc.,
22  ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  **
24  ********************************************************************
25 */
26 
27 #ifndef NIDAS_DYNLD_STATISTICSPROCESSOR_H
28 #define NIDAS_DYNLD_STATISTICSPROCESSOR_H
29 
31 #include "StatisticsCruncher.h"
32 #include <nidas/util/UTime.h>
33 
34 namespace nidas { namespace dynld {
35 
36 using namespace nidas::core;
37 
44 {
45 public:
46 
48 
50 
56  void addRequestedSampleTag(SampleTag* tag)
58 
59  void selectRequestedSampleTags(const std::vector<unsigned int>& sampleIds);
60 
71  void connectSource(SampleSource*) override;
72 
77  void disconnectSource(SampleSource*) throw();
78 
85  void connect(SampleOutput* output) throw();
86 
93  void disconnect(SampleOutput* output) throw();
94 
99  void flush() throw();
100 
102  {
103  _startTime = val;
104  }
105 
107  {
108  return _startTime;
109  }
110 
111  void setEndTime(const nidas::util::UTime& val)
112  {
113  _endTime = val;
114  }
115 
117  {
118  return _endTime;
119  }
120 
121  float getPeriod() const
122  {
123  return _statsPeriod;
124  }
125 
133  bool getFillGaps() const
134  {
135  return _fillGaps;
136  }
137 
138  void setFillGaps(bool val)
139  {
140  _fillGaps = val;
141  }
142 
150  std::string getUniqueCountsName(const std::string& val);
151 
152 protected:
153 
157  /*
158  void addSampleTag(SampleTag* tag)
159  throw(nidas::util::InvalidParameterException);
160  */
161 
162 private:
163 
165 
166  std::set<SampleSource*> _connectedSources;
167 
168  std::set<SampleOutput*> _connectedOutputs;
169 
170 
171  std::list<StatisticsCruncher*> _crunchers;
172 
173  struct OutputInfo {
175  type(StatisticsCruncher::STATS_UNKNOWN),countsName(),higherMoments(false) {}
177  std::string countsName;
179  };
180 
181  std::map<dsm_sample_id_t,struct OutputInfo> _infoBySampleId;
182 
184 
186 
188 
189  bool _fillGaps;
190 
194  std::set<std::string> _cntsNames;
195 
200 
204  StatisticsProcessor& operator=(const StatisticsProcessor&);
205 
206 };
207 
208 }} // namespace nidas namespace core
209 
210 #endif
nidas::util::UTime _startTime
Definition: StatisticsProcessor.h:183
nidas::util::UTime getEndTime() const
Definition: StatisticsProcessor.h:116
A class for parsing, formatting and doing operations on time, based on Unix time conventions, where leap seconds are ignored, so that there are always 60 seconds in a minute, 3600 seconds in an hour and 86400 seconds in a day.
Definition: UTime.h:76
void setFillGaps(bool val)
Definition: StatisticsProcessor.h:138
nidas::util::UTime _endTime
Definition: StatisticsProcessor.h:185
nidas::util::Mutex _cruncherListMutex
Implementation of SampleIOProcessor::addSampleTag(SampleTag*).
Definition: StatisticsProcessor.h:164
std::map< dsm_sample_id_t, struct OutputInfo > _infoBySampleId
Definition: StatisticsProcessor.h:181
Interface of an output stream of samples.
Definition: SampleOutput.h:47
std::list< StatisticsCruncher * > _crunchers
Definition: StatisticsProcessor.h:171
Pure virtual interface for a source of Samples.
Definition: SampleSource.h:48
bool higherMoments
Definition: StatisticsProcessor.h:178
Definition: StatisticsProcessor.h:173
std::string countsName
Definition: StatisticsProcessor.h:177
std::set< SampleOutput * > _connectedOutputs
Definition: StatisticsProcessor.h:168
bool getFillGaps() const
Whether to generate output samples over time gaps.
Definition: StatisticsProcessor.h:133
std::set< SampleSource * > _connectedSources
Definition: StatisticsProcessor.h:166
std::set< std::string > _cntsNames
Set of counts variables for output samples.
Definition: StatisticsProcessor.h:194
float getPeriod() const
Definition: StatisticsProcessor.h:121
Definition: StatisticsCruncher.h:47
OutputInfo()
Definition: StatisticsProcessor.h:174
nidas::util::UTime getStartTime() const
Definition: StatisticsProcessor.h:106
void setStartTime(const nidas::util::UTime &val)
Definition: StatisticsProcessor.h:101
StatisticsCruncher::statisticsType type
Definition: StatisticsProcessor.h:176
Class describing a group of variables that are sampled and handled together.
Definition: SampleTag.h:87
Interface of a processor of samples.
Definition: SampleIOProcessor.h:49
enum nidas::dynld::StatisticsCruncher::statsEnumType statisticsType
Types of statistics I can generate.
Interface of a processor of samples.
Definition: StatisticsProcessor.h:43
float _statsPeriod
Definition: StatisticsProcessor.h:187
A C++ wrapper for a POSIX mutex.
Definition: ThreadSupport.h:154
bool _fillGaps
Definition: StatisticsProcessor.h:189
Definition: InvalidParameterException.h:35
void setEndTime(const nidas::util::UTime &val)
Definition: StatisticsProcessor.h:111