nidas  v1.2-1520
DSC_FreqCounter.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  ** 2008, 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 #ifndef NIDAS_DYNLD_DSC_FREQCOUNTER_H
27 #define NIDAS_DYNLD_DSC_FREQCOUNTER_H
28 
29 #include <nidas/core/DSMSensor.h>
30 #include <nidas/core/Parameter.h>
32 
33 namespace nidas { namespace dynld {
34 
35 using namespace nidas::core;
36 
47 class DSC_FreqCounter : public DSMSensor {
48 
49 public:
50 
52  ~DSC_FreqCounter();
53 
54  IODevice* buildIODevice() throw(nidas::util::IOException);
55 
56  SampleScanner* buildSampleScanner()
58 
62  void open(int flags) throw(nidas::util::IOException,
64 
65  void validate() throw(nidas::util::InvalidParameterException);
66 
67  void init() throw(nidas::util::InvalidParameterException);
68 
69  void printStatus(std::ostream& ostr) throw();
70 
74  double calculatePeriodUsec(const Sample*) const;
75 
81  double calculatePeriodUsec(unsigned int npulses, unsigned int tics) const;
82 
87  bool process(const Sample*,std::list<const Sample*>& result)
88  throw();
89 
93  int getSamplePeriodMsec() const
94  {
95  return _msecPeriod;
96  }
97 
98 
99 protected:
100 
101  virtual void readParams(const std::list<const Parameter*>& params)
103 
105 
106  int _nvars;
107 
109 
114 
119  double _clockRate;
120 
122 
123 private:
124 
127 
129  DSC_FreqCounter& operator=(const DSC_FreqCounter&);
130 
131 };
132 
133 }} // namespace nidas namespace dynld
134 
135 #endif
unsigned int dsm_sample_id_t
Definition: Sample.h:63
double _clockRate
Rate of reference clock whose tics are counted while _numPulses are counted.
Definition: DSC_FreqCounter.h:119
int getSamplePeriodMsec() const
Return the frequency sample period.
Definition: DSC_FreqCounter.h:93
const nidas::util::EndianConverter * _cvtr
Definition: DSC_FreqCounter.h:121
int _msecPeriod
Definition: DSC_FreqCounter.h:108
Virtual base class declaring methods for converting numeric values between little-endian and big-endi...
Definition: EndianConverter.h:304
dsm_sample_id_t _sampleId
Definition: DSC_FreqCounter.h:104
An interface to an IO device.
Definition: IODevice.h:41
Sensor support for a frequency counter device.
Definition: DSC_FreqCounter.h:47
Interface to a data sample.
Definition: Sample.h:189
DSMSensor provides the basic support for reading, processing and distributing samples from a sensor a...
Definition: DSMSensor.h:87
Definition: IOException.h:37
A scanner of sample data.
Definition: SampleScanner.h:73
int _numPulses
Number of input pulses to count.
Definition: DSC_FreqCounter.h:113
int _nvars
Definition: DSC_FreqCounter.h:106
Definition: InvalidParameterException.h:35