libdballe 9.6
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
14namespace dballe {
15
18
20wreport::Varinfo varinfo(const char* code);
21
23wreport::Varinfo varinfo(const std::string& code);
24
25
31
36wreport::Varcode resolve_varcode(const std::string& name);
37
38
40template<typename C>
41static inline wreport::Var var(C code) { return wreport::Var(varinfo(code)); }
42
44template<typename C, typename T>
45static inline wreport::Var var(C code, const T& val) { return wreport::Var(varinfo(code), val); }
46
47
49static inline std::unique_ptr<wreport::Var> newvar(const wreport::Var& var)
50{
51 return std::unique_ptr<wreport::Var>(new wreport::Var(var));
52}
53
55template<typename C>
56static inline std::unique_ptr<wreport::Var> newvar(C code)
57{
58 return std::unique_ptr<wreport::Var>(new wreport::Var(varinfo(code)));
59}
60
62template<typename C, typename T>
63std::unique_ptr<wreport::Var> newvar(C code, const T& val)
64{
65 return std::unique_ptr<wreport::Var>(new wreport::Var(varinfo(code), val));
66}
67
68}
69
70#endif
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.