Lexically casts an argument to a given type stored in a byte array. Returns true if not null.
| 1163 | |
| 1164 | /// Lexically casts an argument to a given type stored in a byte array. Returns true if not null. |
| 1165 | bool arg_as_scalar( |
| 1166 | std::vector<uint8_t> &bytes, |
| 1167 | library::NumericTypeID numeric_type, |
| 1168 | KernelArgument::Value const *value_ptr) { |
| 1169 | |
| 1170 | if (value_ptr->not_null) { |
| 1171 | if (value_ptr->argument->description->type == ArgumentTypeID::kInteger) { |
| 1172 | int64_t int_value = static_cast<IntegerArgument::IntegerValue const *>(value_ptr)->value; |
| 1173 | |
| 1174 | // TODO - convert int64_t => destination type |
| 1175 | } |
| 1176 | else if (value_ptr->argument->description->type == ArgumentTypeID::kScalar) { |
| 1177 | std::string const &str_value = static_cast<ScalarArgument::ScalarValue const *>(value_ptr)->value; |
| 1178 | |
| 1179 | return lexical_cast(bytes, numeric_type, str_value); |
| 1180 | } |
| 1181 | else { |
| 1182 | throw std::runtime_error( |
| 1183 | "arg_as_int() - illegal cast. Problem space argument must be integer or scalar"); |
| 1184 | } |
| 1185 | |
| 1186 | return true; |
| 1187 | } |
| 1188 | |
| 1189 | return false; |
| 1190 | } |
| 1191 | |
| 1192 | /// Lexically casts an argument to a given type and returns a byte array |
| 1193 | bool arg_as_scalar( |
nothing calls this directly
no test coverage detected