libdballe  7.6
valuebase.h
1 /*
2  * memdb/valuebase - Common implementation for StationValue and Value
3  *
4  * Copyright (C) 2014 ARPA-SIM <urpsim@smr.arpa.emr.it>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * Author: Enrico Zini <enrico@enricozini.com>
20  */
21 
22 #ifndef DBA_MEMDB_VALUEBASE_H
23 #define DBA_MEMDB_VALUEBASE_H
24 
25 #include <wreport/var.h>
26 #include <vector>
27 #include <memory>
28 
29 namespace dballe {
30 struct Values;
31 struct Record;
32 
33 namespace memdb {
34 
36 struct ValueBase
37 {
38  wreport::Var* var;
39 
40  ValueBase(std::unique_ptr<wreport::Var> var)
41  : var(var.release()) {}
42  ~ValueBase();
43 
44  void query_attrs(std::function<void(std::unique_ptr<wreport::Var>)> dest) const;
45 
46  void attr_insert(const Record& attrs);
47  void attr_insert(const Values& attrs);
48  void attr_remove(const std::vector<wreport::Varcode>& qcs);
49 
51  void replace(std::unique_ptr<wreport::Var> var);
52 
54  void replace(const wreport::Var& var);
55 
56 private:
57  ValueBase(const ValueBase&);
58  ValueBase& operator=(const ValueBase&);
59 };
60 
61 }
62 }
63 
64 #endif
Station information.
Definition: valuebase.h:36
Key/value store where keys are strings and values are wreport variables.
Definition: record.h:16
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
void replace(std::unique_ptr< wreport::Var > var)
Replace the variable with the given one.
Storage and index for measured values.
Definition: value.h:43