1#ifndef WREPORT_OPCODE_H
2#define WREPORT_OPCODE_H
49 unsigned size()
const {
return static_cast<unsigned>(
end -
begin); }
63 "cannot do pop_left on an empty opcode sequence");
77 "sequence of only %u elements",
Report an error when a consistency check failed.
Definition error.h:191
static void throwf(const char *fmt,...) WREPORT_THROWF_ATTRS(1
Throw the exception, building the message printf-style.
String functions.
Definition benchmark.h:13
uint16_t Varcode
Holds the WMO variable code of a variable.
Definition fwd.h:12
Sequence of opcodes, as a slice of a Varcode vector.
Definition opcodes.h:20
const Varcode * end
One-past-the-last element of the varcode sequence.
Definition opcodes.h:24
Opcodes sub(unsigned skip, unsigned len) const
Return len opcodes starting from skip.
Definition opcodes.h:115
Varcode head() const
First opcode in the list (0 if the list is empty)
Definition opcodes.h:85
Opcodes(const std::vector< Varcode > &vals)
Sequence spanning the whole vector.
Definition opcodes.h:27
unsigned size() const
Number of items in this opcode list.
Definition opcodes.h:49
Opcodes sub(unsigned skip) const
Return the opcodes from skip until the end.
Definition opcodes.h:106
Opcodes next() const
List of all opcodes after the first one.
Definition opcodes.h:97
Varcode operator[](unsigned i) const
Return the i-th varcode in the chain.
Definition opcodes.h:40
Varcode pop_left()
Return the first element and advance begin to the next one.
Definition opcodes.h:59
Opcodes pop_left(unsigned count)
Return the first count elements and advance begin to the first opcode after the sequence.
Definition opcodes.h:73
void print(FILE *out) const
Print the contents of this opcode list.
const Varcode * begin
First element of the varcode sequence.
Definition opcodes.h:22
bool empty() const
True if there are no opcodes.
Definition opcodes.h:52
Opcodes(const Varcode *begin, const Varcode *end)
Sequence from begin (inclusive) to end (excluded)
Definition opcodes.h:32
Implement fast access to information about WMO variables.