nmrfspectrum.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 nmrfspectrumH
15 #define nmrfspectrumH
16 
17 #include "nmrspectrumbase.h"
18 
19 class XSG;
20 class XPulser;
21 class XAutoLCTuner;
22 class QMainWindow;
23 class Ui_FrmNMRFSpectrum;
25 
26 class XNMRFSpectrum : public XNMRSpectrumBase<FrmNMRFSpectrum> {
27 public:
28  XNMRFSpectrum(const char *name, bool runtime,
29  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
30  //! ususally nothing to do
31  virtual ~XNMRFSpectrum() = default;
32 protected:
33  //! \return true to be cleared.
34  virtual bool onCondChangedImpl(const Snapshot &shot, XValueNodeBase *) const override;
35  virtual double getFreqResHint(const Snapshot &shot_this) const override;
36  virtual double getMinFreq(const Snapshot &shot_this) const override;
37  virtual double getMaxFreq(const Snapshot &shot_this) const override;
38  virtual double getCurrentCenterFreq(const Snapshot &shot_this, const Snapshot &shot_others) const override;
39  virtual void getValues(const Snapshot &shot_this, std::vector<double> &values) const override;
40 
41  virtual bool checkDependencyImpl(const Snapshot &shot_this,
42  const Snapshot &shot_emitter, const Snapshot &shot_others,
43  XDriver *emitter) const override;
44 
45  virtual void rearrangeInstrum(const Snapshot &shot) override;
46 public:
47  //! driver specific part below
48  const shared_ptr<XItemNode<XDriverList, XSG> > &sg1() const {return m_sg1;}
49  const shared_ptr<XItemNode<XDriverList, XAutoLCTuner> > &autoTuner() const {return m_autoTuner;}
50  const shared_ptr<XItemNode<XDriverList, XPulser> > &pulser() const {return m_pulser;}
51  //! Offset for IF [MHz]
52  const shared_ptr<XDoubleNode> &sg1FreqOffset() const {return m_sg1FreqOffset;}
53  //! [MHz]
54  const shared_ptr<XDoubleNode> &centerFreq() const {return m_centerFreq;}
55  //! [kHz]
56  const shared_ptr<XDoubleNode> &freqSpan() const {return m_freqSpan;}
57  //! [kHz]
58  const shared_ptr<XDoubleNode> &freqStep() const {return m_freqStep;}
59  const shared_ptr<XBoolNode> &active() const {return m_active;}
60  //! [MHz]
61  const shared_ptr<XDoubleNode> &tuneCycleStep() const {return m_tuneCycleStep;}
62  const shared_ptr<XComboNode> &tuneCycleStrategy() const {return m_tuneCycleStrategy;}
63  enum TuneCycleStrategy {STRATEGY_ASIS = 0, STRATEGY_TUNE_AWAIT = 1, STRATEGY_AUTOTUNE = 2,
64  STRATEGY_CYCLE_DBL = 3, STRATEGY_CYCLE_QUAD = 4, STRATEGY_CYCLE_OCT = 5};
65 private:
66  const shared_ptr<XItemNode<XDriverList, XSG> > m_sg1;
67  const shared_ptr<XItemNode<XDriverList, XAutoLCTuner> > m_autoTuner;
68  const shared_ptr<XItemNode<XDriverList, XPulser> > m_pulser;
69  const shared_ptr<XDoubleNode> m_sg1FreqOffset;
70 
71  const shared_ptr<XDoubleNode> m_centerFreq;
72  const shared_ptr<XDoubleNode> m_freqSpan;
73  const shared_ptr<XDoubleNode> m_freqStep;
74  const shared_ptr<XBoolNode> m_active;
75  const shared_ptr<XDoubleNode> m_tuneCycleStep;
76  const shared_ptr<XComboNode> m_tuneCycleStrategy;
77 
78  shared_ptr<XListener> m_lsnOnActiveChanged, m_lsnOnTuningChanged;
79 
80  std::deque<xqcon_ptr> m_conUIs;
81 
82  void onActiveChanged(const Snapshot &shot, XValueNodeBase *);
83  void onTuningChanged(const Snapshot &shot, XValueNodeBase *); //!< receives signals from AutoLCTuner.
84  void performTuning(const Snapshot &shot_this, double newf);
85 
86  mutable double m_lastFreqAcquired; //!< to avoid inifite averaging after a sweep.
87  double m_tunedFreq;
88  int m_lastCycle; //!< 0-7
89 };
90 
91 
92 #endif

Generated for KAME4 by  doxygen 1.8.3