libwreport
2.9
|
Holds a variable information table. More...
#include <vartable.h>
Public Member Functions | |
const std::string & | id () const |
Return the Vartable ID. | |
bool | loaded () const |
Return true if the Vartable has been loaded. | |
void | load (const std::pair< std::string, std::string > &idfile) |
Load contents from the table with the given ID. | |
Varinfo | query (Varcode code) const |
Query the Vartable. More... | |
bool | contains (Varcode code) const |
Check if the code can be resolved to a varinfo. | |
Varinfo | query_altered (Varcode var, int scale, unsigned bit_len) const |
Query an altered version of the vartable. More... | |
Static Public Member Functions | |
static const Vartable * | get (const char *id) |
Return a Vartable by id, loading it if necessary. More... | |
static const Vartable * | get (const std::pair< std::string, std::string > &idfile) |
Return a Vartable by id and pathname. More... | |
static std::pair< std::string, std::string > | find_table (const std::vector< std::string > &ids) |
Look for a table for one of the given table IDs. More... | |
static std::pair< std::string, std::string > | find_table (const std::string &id) |
Look for the table file given a table ID. More... | |
Protected Attributes | |
std::string | m_id |
ID of the table. | |
Holds a variable information table.
It never needs to be deallocated, as all the Vartable returned by DB-ALLe are pointers to memory-cached versions that are guaranteed to exist for all the lifetime of the program.
|
static |
Look for a table for one of the given table IDs.
The IDs are tried in order on the various configured paths and on those configured in the environment
|
static |
Look for the table file given a table ID.
|
static |
Return a Vartable by id, loading it if necessary.
Once loaded, the table will be cached in memory for reuse, and further calls to get() will return the cached version.
The cached tables are never deallocated, so the returned pointer is valid through the whole lifetime of the program.
id | ID of the Vartable data to access |
|
static |
Return a Vartable by id and pathname.
idfile | a pair (id, pathname) identifying the table to load |
Query the Vartable.
Throws an exception if not found.
code | wreport::Varcode to query |
Query an altered version of the vartable.
var | wreport::Varcode to query |
scale | Scale to use instead of the default |
bit_len | Bit length to use instead of the default |