49 rewind(int64_t num_items, util::ForthError& err) noexcept;
57 dup(int64_t num_times, util::ForthError& err) noexcept = 0;
60 virtual const std::shared_ptr<
void>
61 ptr() const noexcept = 0;
68 write_one_bool(
bool value,
bool byteswap) noexcept = 0;
72 write_one_int8(int8_t value,
bool byteswap) noexcept = 0;
76 write_one_int16(int16_t value,
bool byteswap) noexcept = 0;
80 write_one_int32(int32_t value,
bool byteswap) noexcept = 0;
84 write_one_int64(int64_t value,
bool byteswap) noexcept = 0;
88 write_one_intp(ssize_t value,
bool byteswap) noexcept = 0;
92 write_one_uint8(uint8_t value,
bool byteswap) noexcept = 0;
96 write_one_uint16(uint16_t value,
bool byteswap) noexcept = 0;
100 write_one_uint32(uint32_t value,
bool byteswap) noexcept = 0;
104 write_one_uint64(uint64_t value,
bool byteswap) noexcept = 0;
108 write_one_uintp(
size_t value,
bool byteswap) noexcept = 0;
112 write_one_float32(
float value,
bool byteswap) noexcept = 0;
116 write_one_float64(
double value,
bool byteswap) noexcept = 0;
120 write_one_string(
char* string_buffer, int64_t length) noexcept = 0;
124 write_bool(int64_t num_items,
bool* values,
bool byteswap) noexcept = 0;
128 write_int8(int64_t num_items, int8_t* values,
bool byteswap) noexcept = 0;
132 write_int16(int64_t num_items, int16_t* values,
bool byteswap) noexcept = 0;
136 write_int32(int64_t num_items, int32_t* values,
bool byteswap) noexcept = 0;
140 write_int64(int64_t num_items, int64_t* values,
bool byteswap) noexcept = 0;
144 write_intp(int64_t num_items, ssize_t* values,
bool byteswap) noexcept = 0;
148 write_const_uint8(int64_t num_items, const uint8_t* values) noexcept = 0;
152 write_uint8(int64_t num_items, uint8_t* values,
bool byteswap) noexcept = 0;
156 write_uint16(int64_t num_items, uint16_t* values,
bool byteswap) noexcept = 0;
160 write_uint32(int64_t num_items, uint32_t* values,
bool byteswap) noexcept = 0;
164 write_uint64(int64_t num_items, uint64_t* values,
bool byteswap) noexcept = 0;
168 write_uintp(int64_t num_items,
size_t* values,
bool byteswap) noexcept = 0;
172 write_float32(int64_t num_items,
float* values,
bool byteswap) noexcept = 0;
176 write_float64(int64_t num_items,
double* values,
bool byteswap) noexcept = 0;
180 write_add_int32(int32_t value) noexcept = 0;
184 write_add_int64(int64_t value) noexcept = 0;
187 tostring() const = 0;
201 dup(int64_t num_times, util::ForthError& err)
noexcept override;
203 const std::shared_ptr<void>
204 ptr() const noexcept override;
207 dtype() const override;
210 write_one_bool(
bool value,
bool byteswap) noexcept override;
213 write_one_int8(int8_t value,
bool byteswap) noexcept override;
216 write_one_int16(int16_t value,
bool byteswap) noexcept override;
219 write_one_int32(int32_t value,
bool byteswap) noexcept override;
222 write_one_int64(int64_t value,
bool byteswap) noexcept override;
225 write_one_intp(ssize_t value,
bool byteswap) noexcept override;
228 write_one_uint8(uint8_t value,
bool byteswap) noexcept override;
231 write_one_uint16(uint16_t value,
bool byteswap) noexcept override;
234 write_one_uint32(uint32_t value,
bool byteswap) noexcept override;
237 write_one_uint64(uint64_t value,
bool byteswap) noexcept override;
240 write_one_uintp(
size_t value,
bool byteswap) noexcept override;
243 write_one_float32(
float value,
bool byteswap) noexcept override;
246 write_one_float64(
double value,
bool byteswap) noexcept override;
249 write_one_string(
char* string_buffer, int64_t length) noexcept override;
252 write_bool(int64_t num_items,
bool* values,
bool byteswap) noexcept override;
255 write_int8(int64_t num_items, int8_t* values,
bool byteswap) noexcept override;
258 write_int16(int64_t num_items, int16_t* values,
bool byteswap) noexcept override;
261 write_int32(int64_t num_items, int32_t* values,
bool byteswap) noexcept override;
264 write_int64(int64_t num_items, int64_t* values,
bool byteswap) noexcept override;
267 write_intp(int64_t num_items, ssize_t* values,
bool byteswap) noexcept override;
270 write_const_uint8(int64_t num_items, const uint8_t* values) noexcept override;
273 write_uint8(int64_t num_items, uint8_t* values,
bool byteswap) noexcept override;
276 write_uint16(int64_t num_items, uint16_t* values,
bool byteswap) noexcept override;
279 write_uint32(int64_t num_items, uint32_t* values,
bool byteswap) noexcept override;
282 write_uint64(int64_t num_items, uint64_t* values,
bool byteswap) noexcept override;
285 write_uintp(int64_t num_items,
size_t* values,
bool byteswap) noexcept override;
288 write_float32(int64_t num_items,
float* values,
bool byteswap) noexcept override;
291 write_float64(int64_t num_items,
double* values,
bool byteswap) noexcept override;
294 write_add_int32(int32_t value) noexcept override;
297 write_add_int64(int64_t value) noexcept override;
299 std::
string tostring() const override;
305 maybe_resize(int64_t next);
308 template <typename IN>
309 inline
void write_one(IN value) noexcept {
311 maybe_resize(length_);
312 ptr_.get()[length_ - 1] = (OUT)value;
316 template <
typename IN>
317 inline void write_copy(int64_t num_items,
const IN* values)
noexcept {
318 int64_t next = length_ + num_items;
320 for (int64_t i = 0; i < num_items; i++) {
321 ptr_.get()[length_ + i] = (OUT)values[i];
326 std::shared_ptr<OUT> ptr_;