libwreport
2.4
|
00001 /* 00002 * wreport/vartable - Load variable information from on-disk tables 00003 * 00004 * Copyright (C) 2005--2010 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 WREPORT_VARTABLE_H 00023 #define WREPORT_VARTABLE_H 00024 00071 #include <wreport/varinfo.h> 00072 #include <vector> 00073 #include <string> 00074 00075 namespace wreport { 00076 00084 class Vartable : public std::vector<_Varinfo> 00085 { 00086 protected: 00088 std::string m_id; 00089 00090 public: 00091 Vartable(); 00092 ~Vartable(); 00093 00095 const std::string& id() const { return m_id; } 00096 00098 bool loaded() const { return !m_id.empty(); } 00099 00101 void load(const std::pair<std::string, std::string>& idfile); 00102 00111 Varinfo query(Varcode code) const; 00112 00114 bool contains(Varcode code) const; 00115 00130 Varinfo query_altered(Varcode var, int scale, unsigned bit_len) const; 00131 00144 static const Vartable* get(const char* id); 00145 00152 static const Vartable* get(const std::pair<std::string, std::string>& idfile); 00153 00163 static std::pair<std::string, std::string> find_table(const std::vector<std::string>& ids); 00164 00171 static std::pair<std::string, std::string> find_table(const std::string& id); 00172 }; 00173 00174 } 00175 00176 #endif 00177 /* vim:set ts=4 sw=4: */