DAQ  1.0.0
Data Acquisition System (basic demo)
mocksqlitewrapper.h
Go to the documentation of this file.
1 /*! @brief This file have the sqlitewrapper mock implementation.
2  @file mocksqlitewrapper.h
3  @author Alvaro Denis <denisacostaq@gmail.com>
4  @date 8/5/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 MOCKSQLITEWRAPPER_H
39 #define MOCKSQLITEWRAPPER_H
40 
41 #include <gmock/gmock.h>
42 
43 #include "src/database-server/data-source/idatasource.h"
44 
45 class MockIDataSource : public IDataSource {
46  public:
48 
52  }
53 
57  }
58 
60  Err(const std::function<void(const Variable& var, size_t index)>&
61  send_vale));
63  const std::function<void(const Variable& var, size_t index)>&
66  }
67 
69  Err(const std::string& var_name,
70  const std::function<void(const VarValue& val, size_t index)>&
71  send_vale));
73  const std::string& var_name,
74  const std::function<void(const VarValue& val, size_t index)>&
77  }
78 
80  const std::string&,
81  const std::function<void(size_t count)>&) noexcept override {
82  return IDataSource::Err::Failed;
83  }
84 
86  Err(const std::string& var_name,
89  const std::function<void(const VarValue&& val,
90  size_t index)>& send_vale));
92  const std::string& var_name,
95  const std::function<void(const VarValue& val, size_t index)>&
98  send_vale);
99  }
100 
102  const std::string&, const std::chrono::system_clock::time_point&,
103  const std::chrono::system_clock::time_point&,
104  const std::function<void(size_t count)>&) noexcept override {
105  return IDataSource::Err::Failed;
106  }
107 };
108 
109 #endif // MOCKSQLITEWRAPPER_H
Err fetch_variable_values(const std::string &var_name, const std::function< void(const VarValue &val, size_t index)> &send_vale) noexceptoverride
fetch_variable_values get all values of a given variable
Definition: mocksqlitewrapper.h:72
VarValue(Variable &&variable, double &&val, std::uint64_t &&ts)
Definition: varvalue.cc:45
Definition: variable.h:44
Err
Definition: idatasource.h:57
Err fetch_variables(const std::function< void(const Variable &var, size_t index)> &send_vale) noexceptoverride
fetch_variables get all variables
Definition: mocksqlitewrapper.h:62
Err create_scheme() noexceptoverride
create_scheme create data storage persistence, e.g. schema for a relational database ...
Definition: mocksqlitewrapper.h:47
Err add_variable(const Variable &variable) noexceptoverride
add_variable add a variable to be tracket for the system (by default the only supported variabe value...
Definition: mocksqlitewrapper.h:50
Err add_variable_value(const VarValue &var_value) noexceptoverride
add_variable_value add a new value for the variable.
Definition: mocksqlitewrapper.h:55
virtual Err count_variable_values(const std::string &var_name, const std::chrono::system_clock::time_point &start_date, const std::chrono::system_clock::time_point &end_date, const std::function< void(size_t count)> &send_count) noexcept=0
count_variable_values count all values of a given variable
Err count_variable_values(const std::string &, const std::chrono::system_clock::time_point &, const std::chrono::system_clock::time_point &, const std::function< void(size_t count)> &) noexceptoverride
count_variable_values count all values of a given variable
Definition: mocksqlitewrapper.h:101