bitmaps.h
#ifndef WREPORT_BULLETIN_BITMAPS_H
#define WREPORT_BULLETIN_BITMAPS_H
#include <wreport/var.h>
#include <vector>
namespace wreport {
struct Var;
struct Subset;
namespace bulletin {
struct Bitmap
{
Var bitmap;
std::vector<unsigned> refs;
std::vector<unsigned>::const_reverse_iterator iter;
Bitmap(const Var& bitmap, const Subset& subset, unsigned anchor);
Bitmap(const Var& bitmap, const Subset& subset);
Bitmap(const Bitmap&) = delete;
~Bitmap();
Bitmap& operator=(const Bitmap&) = delete;
bool eob() const;
unsigned next();
void reuse();
};
struct Bitmaps
{
Varcode pending_definitions = 0;
Bitmap* current = nullptr;
Bitmap* last = nullptr;
Bitmaps() {}
Bitmaps(const Bitmaps&) = delete;
~Bitmaps();
Bitmaps& operator=(const Bitmaps&) = delete;
void define(const Var& bitmap, const Subset& subset);
void define(const Var& bitmap, const Subset& subset, unsigned anchor_point);
void reuse_last();
void discard_last();
unsigned next();
bool active() const { return (bool)current; }
};
}
}
#endif
wreport::Subset
Represent a BUFR/CREX data subset as a list of decoded variables.
Definition subset.h:13
wreport::Var
A physical variable.
Definition var.h:25
wreport::bulletin
The bulletin namespace contains bulletin implementation details, internals and utility functions.
Definition input.h:13
wreport
String functions.
Definition benchmark.h:13
wreport::Varcode
uint16_t Varcode
Holds the WMO variable code of a variable.
Definition fwd.h:12
wreport::bulletin::Bitmap
Associate a Data Present Bitmap to decoded variables in a subset.
Definition bitmaps.h:15
wreport::bulletin::Bitmap::next
unsigned next()
Return the next variable offset for which the bitmap reports that data is present.
wreport::bulletin::Bitmap::bitmap
Var bitmap
Bitmap being iterated.
Definition bitmaps.h:17
wreport::bulletin::Bitmap::reuse
void reuse()
Reset the bitmap iterator, to reuse the bitmap another time.
wreport::bulletin::Bitmap::eob
bool eob() const
True if there is no bitmap or if the bitmap has been iterated until the end.
wreport::bulletin::Bitmap::Bitmap
Bitmap(const Var &bitmap, const Subset &subset, unsigned anchor)
Create a new bitmap.
wreport::bulletin::Bitmap::refs
std::vector< unsigned > refs
Arrays of variable indices corresponding to positions in the bitmap where data is present.
Definition bitmaps.h:23
wreport::bulletin::Bitmap::iter
std::vector< unsigned >::const_reverse_iterator iter
Iterator over refs.
Definition bitmaps.h:31
wreport::bulletin::Bitmaps
Definition bitmaps.h:67
wreport::bulletin::Bitmaps::next
unsigned next()
Return the next variable offset for which the bitmap reports that data is present.
wreport::bulletin::Bitmaps::last
Bitmap * last
Last bitmap used.
Definition bitmaps.h:75
wreport::bulletin::Bitmaps::active
bool active() const
Return true if there is an active bitmap.
Definition bitmaps.h:97
wreport::bulletin::Bitmaps::pending_definitions
Varcode pending_definitions
Nonzero if a Data Present Bitmap is expected.
Definition bitmaps.h:69
wreport::bulletin::Bitmaps::current
Bitmap * current
Currently active bitmap.
Definition bitmaps.h:72