17#ifndef __SOUSCHEF_DATA_CONSTANT_H__
18#define __SOUSCHEF_DATA_CONSTANT_H__
37 std::vector<uint8_t>
generate(int32_t count)
const override
39 std::vector<uint8_t> res;
41 for (uint32_t n = 0; n < count; ++n)
43 const uint8_t *arr =
reinterpret_cast<const uint8_t *
>(&_value);
45 for (uint32_t b = 0; b <
sizeof(T); ++b)
47 res.emplace_back(arr[b]);
62 auto const value = to_number<T>(args.value(0));
84 std::vector<uint8_t>
generate(int32_t count)
const override
86 std::vector<uint8_t> res;
88 if (_value < -8 || 7 < _value)
89 throw std::runtime_error(
"Constant value out of range.");
91 for (uint32_t n = 0; n < count; ++n)
93 const uint8_t data =
static_cast<const uint8_t
>(_value);
94 res.emplace_back(data);
108 auto const value = to_number<int8_t>(args.value(0));
122 std::vector<uint8_t>
generate(int32_t count)
const override
124 std::vector<uint8_t> res;
127 throw std::runtime_error(
"Constant value out of range.");
129 for (uint32_t n = 0; n < count; ++n)
131 res.emplace_back(_value);
145 auto const value = to_number<uint8_t>(args.value(0));
std::vector< uint8_t > generate(int32_t count) const override
Generate a sequence of 'count' elements as a byte sequence.
ConstantDataChef(const T &value)
ConstantInt4DataChef(const int8_t &value)
std::vector< uint8_t > generate(int32_t count) const override
Generate a sequence of 'count' elements as a byte sequence.
std::vector< uint8_t > generate(int32_t count) const override
Generate a sequence of 'count' elements as a byte sequence.
ConstantUint4DataChef(const uint8_t &value)
This file provides string <-> number cast helpers.
Read-only string sequence view.
std::unique_ptr< DataChef > create(const Arguments &args) const
std::unique_ptr< DataChef > create(const Arguments &args) const
std::unique_ptr< DataChef > create(const Arguments &args) const