1 #ifndef WREPORT_OPCODE_H 2 #define WREPORT_OPCODE_H 27 Opcodes(
const std::vector<Varcode>& vals) : begin(vals.data()), end(begin + vals.
size()) {}
30 : begin(begin), end(end) {}
71 Opcodes res(begin, begin + count);
100 if (begin + skip > end)
103 return Opcodes(begin + skip, end);
109 if (begin + skip > end)
111 else if (begin + skip + len >= end)
112 return Opcodes(begin + skip, end);
114 return Opcodes(begin + skip, begin + skip + len);
118 void print(FILE* out)
const;
Opcodes sub(unsigned skip) const
Return the opcodes from skip until the end.
Definition: opcodes.h:98
Report an error when a consistency check failed.
Definition: error.h:183
Opcodes pop_left(unsigned count)
Return the first count elements and advance begin to the first opcode after the sequence.
Definition: opcodes.h:67
Varcode operator[](unsigned i) const
Return the i-th varcode in the chain.
Definition: opcodes.h:36
Opcodes sub(unsigned skip, unsigned len) const
Return len opcodes starting from skip.
Definition: opcodes.h:107
const Varcode * end
One-past-the-last element of the varcode sequence.
Definition: opcodes.h:24
uint16_t Varcode
Holds the WMO variable code of a variable.
Definition: varinfo.h:57
Sequence of opcodes, as a slice of a Varcode vector.
Definition: opcodes.h:19
Opcodes(const std::vector< Varcode > &vals)
Sequence spanning the whole vector.
Definition: opcodes.h:27
const Varcode * begin
First element of the varcode sequence.
Definition: opcodes.h:22
String functions.
Definition: benchmark.h:13
Implement fast access to information about WMO variables.
Opcodes next() const
List of all opcodes after the first one.
Definition: opcodes.h:89
static void throwf(const char *fmt,...) WREPORT_THROWF_ATTRS(1
Throw the exception, building the message printf-style.
bool empty() const
True if there are no opcodes.
Definition: opcodes.h:48
Varcode head() const
First opcode in the list (0 if the list is empty)
Definition: opcodes.h:77
Opcodes(const Varcode *begin, const Varcode *end)
Sequence from begin (inclusive) to end (excluded)
Definition: opcodes.h:29
Varcode pop_left()
Return the first element and advance begin to the next one.
Definition: opcodes.h:55
void print(FILE *out) const
Print the contents of this opcode list.
unsigned size() const
Number of items in this opcode list.
Definition: opcodes.h:45