libdballe  6.8
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 Record;
31 
32 namespace memdb {
33 
35 struct ValueBase
36 {
37  wreport::Var* var;
38 
39  ValueBase(std::auto_ptr<wreport::Var> var)
40  : var(var.release()) {}
41  ~ValueBase();
42 
43  unsigned query_attrs(const std::vector<wreport::Varcode>& qcs, Record& attrs) const;
44 
45  void attr_insert(const Record& attrs);
46  void attr_remove(const std::vector<wreport::Varcode>& qcs);
47 
49  void replace(std::auto_ptr<wreport::Var> var);
50 
52  void replace(const wreport::Var& var);
53 
54 private:
55  ValueBase(const ValueBase&);
56  ValueBase& operator=(const ValueBase&);
57 };
58 
59 }
60 }
61 
62 #endif
Station information.
Definition: valuebase.h:35
DB-All.E record.
Definition: record.h:102
Definition: cmdline.h:34
void replace(std::auto_ptr< wreport::Var > var)
Replace the variable with the given one.