libdballe  9.14
var.h
Go to the documentation of this file.
1 #ifndef DBALLE_VAR_H
2 #define DBALLE_VAR_H
3 
10 #include <memory>
11 #include <string>
12 #include <wreport/var.h>
13 
14 namespace dballe {
15 
17 wreport::Varinfo varinfo(wreport::Varcode code);
18 
20 wreport::Varinfo varinfo(const char* code);
21 
23 wreport::Varinfo varinfo(const std::string& code);
24 
29 wreport::Varcode resolve_varcode(const char* name);
30 
35 wreport::Varcode resolve_varcode(const std::string& name);
36 
38 template <typename C> static inline wreport::Var var(C code)
39 {
40  return wreport::Var(varinfo(code));
41 }
42 
44 template <typename C, typename T>
45 static inline wreport::Var var(C code, const T& val)
46 {
47  return wreport::Var(varinfo(code), val);
48 }
49 
51 static inline std::unique_ptr<wreport::Var> newvar(const wreport::Var& var)
52 {
53  return std::unique_ptr<wreport::Var>(new wreport::Var(var));
54 }
55 
57 template <typename C> static inline std::unique_ptr<wreport::Var> newvar(C code)
58 {
59  return std::unique_ptr<wreport::Var>(new wreport::Var(varinfo(code)));
60 }
61 
63 template <typename C, typename T>
64 std::unique_ptr<wreport::Var> newvar(C code, const T& val)
65 {
66  return std::unique_ptr<wreport::Var>(new wreport::Var(varinfo(code), val));
67 }
68 
69 } // namespace dballe
70 
71 #endif
Definition: cmdline.h:18
wreport::Varcode resolve_varcode(const char *name)
Resolve a variable name to a varcode proper, dealing with aliases and validation. ...
wreport::Varinfo varinfo(wreport::Varcode code)
Return a Varinfo entry from the DB-All.e B table.