dmm.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 dmmH
15 #define dmmH
16 //---------------------------------------------------------------------------
17 #include "primarydriverwiththread.h"
18 #include "xnodeconnector.h"
19 
20 class XScalarEntry;
21 class QMainWindow;
22 class Ui_FrmDMM;
24 
25 class DECLSPEC_SHARED XDMM : public XPrimaryDriverWithThread {
26 public:
27  XDMM(const char *name, bool runtime,
28  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
29 
30  //! usually nothing to do
31  virtual ~XDMM() {}
32  //! Shows all forms belonging to driver
33  virtual void showForms();
34 
35  struct Payload : public XPrimaryDriver::Payload {
36  double value() const {return m_var;}
37  void write_(double var) {m_var = var;}
38  private:
39  double m_var;
40  };
41 protected:
42  //! This function will be called when raw data are written.
43  //! Implement this function to convert the raw data to the record (Payload).
44  //! \sa analyze()
45  virtual void analyzeRaw(RawDataReader &reader, Transaction &tr) throw (XRecordError&);
46  //! This function is called after committing XPrimaryDriver::analyzeRaw() or XSecondaryDriver::analyze().
47  //! This might be called even if the record is invalid (time() == false).
48  virtual void visualize(const Snapshot &shot);
49 
50  //! driver specific part below
51  const shared_ptr<XComboNode> &function() const {return m_function;}
52  const shared_ptr<XUIntNode> &waitInms() const {return m_waitInms;}
53 protected:
54  //! one-shot reading
55  virtual double oneShotRead() = 0;
56  //! is called when m_function is changed
57  virtual void changeFunction() = 0;
58 private:
59  //! is called when m_function is changed
60  void onFunctionChanged(const Snapshot &shot, XValueNodeBase *node);
61 
62  const shared_ptr<XScalarEntry> m_entry;
63  const shared_ptr<XComboNode> m_function;
64  const shared_ptr<XUIntNode> m_waitInms;
65  shared_ptr<XListener> m_lsnOnFunctionChanged;
66  xqcon_ptr m_conFunction, m_conWaitInms;
67 
68  const qshared_ptr<FrmDMM> m_form;
69 
70  void *execute(const atomic<bool> &);
71 
72 };
73 
74 #endif

Generated for KAME4 by  doxygen 1.8.3