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