libdballe  7.7
mem/repinfo.h
1 /*
2  * db/mem/repinfo - repinfo priority tracking
3  *
4  * Copyright (C) 2013 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 DBALLE_DB_MEM_REPINFO_H
23 #define DBALLE_DB_MEM_REPINFO_H
24 
25 #include <map>
26 #include <string>
27 #include <cstddef>
28 
29 namespace dballe {
30 namespace db {
31 namespace mem {
32 
33 class Repinfo
34 {
35 protected:
36  std::map<std::string, int> priorities;
37 
38 public:
40  int get_prio(const std::string& memo);
41 
43  void load(const char* repinfo_file=0);
44 
61  void update(const char* deffile, int* added, int* deleted, int* updated);
62 
66  std::map<std::string, int> get_priorities() const;
67 
69  void dump(FILE* out) const;
70 };
71 
72 
73 }
74 }
75 }
76 
77 #endif
void dump(FILE *out) const
Dump contents to a file.
std::map< std::string, int > get_priorities() const
Get a mapping between rep_memo and their priorities.
void load(const char *repinfo_file=0)
Like update, but it ignores the added, delete and updated stats.
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
void update(const char *deffile, int *added, int *deleted, int *updated)
Update the report type information in the database using the data from the given file.
int get_prio(const std::string &memo)
Get the priority for a rep_memo.
Definition: mem/repinfo.h:33