libwreport 3.40
wreport::vartable::Base Class Reference

Base Vartable implementation. More...

#include <vartable.h>

Inheritance diagram for wreport::vartable::Base:
wreport::Vartable wreport::vartable::Bufr wreport::vartable::Crex

Public Member Functions

 Base (const std::filesystem::path &pathname)
 
std::string pathname () const override
 Return the pathname of the file from which this table has been loaded.
 
std::filesystem::path path () const override
 Return the pathname of the file from which this table has been loaded.
 
_Varinfoobtain (unsigned line_no, Varcode code)
 
const Entryquery_entry (Varcode code) const
 
Varinfo query (Varcode code) const override
 Query the Vartable.
 
bool contains (Varcode code) const override
 Check if the code can be resolved to a varinfo.
 
Varinfo query_altered (Varcode code, int new_scale, unsigned new_bit_len, int new_bit_ref) const override
 Query an altered version of the vartable.
 
bool iterate (std::function< bool(Varinfo)> dest) const override
 Iterate the whole contents of the table.
 

Data Fields

std::vector< Entryentries
 Entries in this Vartable.
 

Protected Attributes

std::filesystem::path m_pathname
 Pathname to the file from which this vartable has been loaded.
 

Additional Inherited Members

- Static Public Member Functions inherited from wreport::Vartable
static const Vartableload_bufr (const std::string &pathname)
 Return a BUFR vartable, by file name.
 
static const Vartableload_bufr (const std::filesystem::path &pathname)
 
static const Vartableload_bufr (const char *pathname)
 
static const Vartableload_crex (const std::string &pathname)
 Return a CREX vartable, by file name.
 
static const Vartableload_crex (const std::filesystem::path &pathname)
 
static const Vartableload_crex (const char *pathname)
 
static const Vartableget_bufr (const BufrTableID &id)
 Find a BUFR table.
 
static const Vartableget_crex (const CrexTableID &id)
 Find a CREX table.
 
static const Vartableget_bufr (const std::string &basename)
 Find a BUFR table, by file name (without extension)
 
static const Vartableget_crex (const std::string &basename)
 Find a CREX table, by file name (without extension)
 

Detailed Description

Base Vartable implementation.

Member Function Documentation

◆ contains()

bool wreport::vartable::Base::contains ( Varcode code) const
overridevirtual

Check if the code can be resolved to a varinfo.

Implements wreport::Vartable.

◆ iterate()

bool wreport::vartable::Base::iterate ( std::function< bool(Varinfo)> dest) const
overridevirtual

Iterate the whole contents of the table.

Return false from dest to stop iteration.

Returns
true if iteration ended normally, false if dest returned false.

Implements wreport::Vartable.

◆ path()

std::filesystem::path wreport::vartable::Base::path ( ) const
inlineoverridevirtual

Return the pathname of the file from which this table has been loaded.

Implements wreport::Vartable.

References m_pathname.

◆ pathname()

std::string wreport::vartable::Base::pathname ( ) const
inlineoverridevirtual

Return the pathname of the file from which this table has been loaded.

Implements wreport::Vartable.

References m_pathname.

Referenced by wreport::vartable::Bufr::Bufr(), and wreport::vartable::Crex::Crex().

◆ query()

Varinfo wreport::vartable::Base::query ( Varcode code) const
overridevirtual

Query the Vartable.

Throws an exception if not found.

Parameters
codewreport::Varcode to query
Returns
the wreport::varinfo with the results of the query.

Implements wreport::Vartable.

◆ query_altered()

Varinfo wreport::vartable::Base::query_altered ( Varcode code,
int new_scale,
unsigned new_bit_len,
int new_bit_ref ) const
overridevirtual

Query an altered version of the vartable.

Parameters
codewreport::Varcode to query
new_scaleScale to use instead of the default
new_bit_lenBit length to use instead of the default
new_bit_refbit_ref to use instead of the default
Returns
the wreport::Varinfo with the results of the query. The resulting Varinfo is stored inside the Vartable, can be freely copied around and does not need to be deallocated.

Implements wreport::Vartable.

Field Documentation

◆ entries

std::vector<Entry> wreport::vartable::Base::entries

Entries in this Vartable.

The entries are sorted by varcode, so that we can look them up by binary search.

Since we are handing out pointers to _Varinfo structures inside the vector, those pointers will be invalidated if a vector reallocation gets triggered. This means that once the table has been loaded, it size cannot be changed anymore.


The documentation for this class was generated from the following file: