DAQ  1.0.0
Data Acquisition System (basic demo)
varvaluesmodel.h
Go to the documentation of this file.
1 /*! @brief This file have the interface for VarValuesModel class.
2  @file varvaluesmodel.h
3  @author Alvaro Denis <denisacostaq@gmail.com>
4  @date 6/29/2019
5 
6  @copyright
7  @attention <h1><center><strong>COPYRIGHT &copy; 2019 </strong>
8  [<strong>denisacostaq</strong>][denisacostaq-URL].
9  All rights reserved.</center></h1>
10  @attention This file is part of [<strong>DAQs</strong>][DAQs-URL].
11 
12  Redistribution and use in source and binary forms, with or without
13  modification, are permitted provided that the following conditions
14  are met:
15  - 1. Redistributions of source code must retain the above copyright
16  notice, this list of conditions and the following disclaimer.
17  - 2. Redistributions in binary form must reproduce the above copyright
18  notice, this list of conditions and the following disclaimer in the
19  documentation and/or other materials provided with the distribution.
20  - 3. Neither the name of the University nor the names of its contributors
21  may be used to endorse or promote products derived from this software
22  without specific prior written permission.
23 
24  THIS PRODUCT IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
28  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33  THIS PRODUCT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 
35  [denisacostaq-URL]: https://about.me/denisacostaq "Alvaro Denis Acosta"
36  [DAQs-URL]: https://github.com/denisacostaq/DAQs "DAQs"
37  */
38 #ifndef HMI_MODEL_VARVALUESMODEL
39 #define HMI_MODEL_VARVALUESMODEL
40 
41 class Client;
42 
43 #include <chrono>
44 #include <thread>
45 
46 #include <QtCore/QDateTime>
47 #include <QtCore/QDebug>
48 #include <QtCore/QObject>
49 #include <QtCore/QPointF>
50 #include <QtCore/QVector>
51 #include <QtQml/QQmlListProperty>
52 
53 #include "src/hmi/model/varvaluemodel.h"
54 
55 class VarValuesModel : public QObject {
56  Q_OBJECT
57  public:
60 
63 
64  signals:
65  void valsChanged();
66 
67  private:
68  Client *m_cl; // FIXME(denisacostaq@gmail.com): RAII even delete.
73  qDebug() << "unsupported operation, so ignored";
74  }
76  int index) {
77  return &(reinterpret_cast<decltype(m_vals) *>(property->data)->at(index));
78  }
80  return reinterpret_cast<decltype(m_vals) *>(property->data)->size();
81  }
82  static void clear_vals(decltype(m_qml_vals) *) {
83  qDebug() << "unsupported operation, so ignored";
84  }
85 };
86 
87 #endif // HMI_MODEL_VARVALUESMODEL
std::chrono::system_clock::time_point m_now
Definition: varvaluesmodel.h:69
static void clear_vals(decltype(m_qml_vals)*)
Definition: varvaluesmodel.h:82
void do_request(const message::GetValues &gv)
Definition: client.cc:261
Client * m_cl
Definition: varvaluesmodel.h:68
static void add_val(decltype(m_qml_vals)*, decltype(m_vals)::value_type *)
Definition: varvaluesmodel.h:72