counter.h
1 /***************************************************************************
2  Copyright (C) 2002-2015 Kentaro Kitagawa
3  kitagawa@phys.s.u-tokyo.ac.jp
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  You should have received a copy of the GNU Library General
11  Public License and a list of authors along with this program;
12  see the files COPYING and AUTHORS.
13 ***************************************************************************/
14 #ifndef encoderH
15 #define encoderH
16 //---------------------------------------------------------------------------
17 #include "primarydriverwiththread.h"
18 #include "xnodeconnector.h"
19 
20 class XScalarEntry;
21 
23 public:
24  XCounter(const char *name, bool runtime,
25  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
26  //! usually nothing to do
27  virtual ~XCounter() {}
28  //! Shows all forms belonging to driver
29  virtual void showForms() {}
30 protected:
31  //! This function will be called when raw data are written.
32  //! Implement this function to convert the raw data to the record (Payload).
33  //! \sa analyze()
34  virtual void analyzeRaw(RawDataReader &reader, Transaction &tr) throw (XRecordError&);
35  //! This function is called after committing XPrimaryDriver::analyzeRaw() or XSecondaryDriver::analyze().
36  //! This might be called even if the record is invalid (time() == false).
37  virtual void visualize(const Snapshot &shot);
38 
39  //! driver specific part below
40 protected:
41  //! register channel names in your constructor
42  //! \param channel_names array of pointers to channel name. ends with null pointer.
43  void createChannels(Transaction &tr_meas, const shared_ptr<XMeasure> &meas,
44  const char **channel_names);
45 
46  virtual double getLevel(unsigned int ch) = 0;
47 private:
48  std::deque<shared_ptr<XScalarEntry> > m_entries;
49 
50  void *execute(const atomic<bool> &);
51 };
52 
53 #include "chardevicedriver.h"
54 
55 //! Mutoh Digital Counter NPS
56 class XMutohCounterNPS : public XCharDeviceDriver<XCounter> {
57 public:
58  XMutohCounterNPS(const char *name, bool runtime,
59  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
60  virtual ~XMutohCounterNPS() {}
61 protected:
62  virtual double getLevel(unsigned int ch);
63 };
64 #endif

Generated for KAME4 by  doxygen 1.8.3