libdballe
5.18
|
00001 /* 00002 * dballe/var - DB-All.e specialisation of wreport variable 00003 * 00004 * Copyright (C) 2005--2011 ARPA-SIM <urpsim@smr.arpa.emr.it> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 * 00019 * Author: Enrico Zini <enrico@enricozini.com> 00020 */ 00021 00022 #ifndef DBALLE_CORE_VAR_H 00023 #define DBALLE_CORE_VAR_H 00024 00031 #include <wreport/var.h> 00032 #include <memory> 00033 #include <string> 00034 00035 namespace dballe { 00036 00041 00042 wreport::Varinfo varinfo(wreport::Varcode code); 00043 00044 00046 static inline wreport::Var var(wreport::Varcode code) { return wreport::Var(varinfo(code)); } 00047 00049 template<typename T> 00050 wreport::Var var(wreport::Varcode code, const T& val) { return wreport::Var(varinfo(code), val); } 00051 00052 00054 static inline std::auto_ptr<wreport::Var> newvar(wreport::Varcode code) 00055 { 00056 return std::auto_ptr<wreport::Var>(new wreport::Var(varinfo(code))); 00057 } 00058 00060 template<typename T> 00061 std::auto_ptr<wreport::Var> newvar(wreport::Varcode code, const T& val) 00062 { 00063 return std::auto_ptr<wreport::Var>(new wreport::Var(varinfo(code), val)); 00064 } 00065 00067 std::auto_ptr<wreport::Var> var_copy_without_unset_attrs(const wreport::Var& var); 00068 00073 std::auto_ptr<wreport::Var> var_copy_without_unset_attrs(const wreport::Var& var, wreport::Varcode code); 00074 00080 void format_code(wreport::Varcode code, char* buf); 00081 00083 std::string format_code(wreport::Varcode code); 00084 00086 wreport::Varcode map_code_to_dballe(wreport::Varcode code); 00087 00088 } 00089 00090 #endif 00091 /* vim:set ts=4 sw=4: */