14 case VaryingDataType::VOID:
16 case VaryingDataType::ARBITRARY_BYTES:
17 return "ARBITRARY_BYTES";
18 case VaryingDataType::STRING:
20 case VaryingDataType::BOOL:
22 case VaryingDataType::INTEGER:
24 case VaryingDataType::FLOAT:
174 if (type_A != type_B_required)
175 throw std::logic_error(
"Varying data type " + TypeName() +
177 "correspond to the required type, " +
189 data_ = std::make_unique<VaryingArbitraryType<std::vector<std::byte>>>(value);
202 data_ = other.
data_->Clone();
209 std::swap(data_, other.data_);
210 std::swap(type_, other.type_);
219 data_ = other.
data_->Clone();
232 data_ = std::make_unique<VaryingArbitraryType<std::vector<std::byte>>>(value);
241 data_ = std::make_unique<VaryingArbitraryType<std::string>>(value);
252 return data_->StringValue();
260 return data_->BoolValue();
268 return data_->IntegerValue();
276 return data_->FloatValue();
287 std::stringstream outstr;
290 outstr <<
"\"" << this->StringValue() <<
"\"";
292 outstr << this->FloatValue() << (with_type ?
"(double)" :
"");
294 outstr << this->IntegerValue();
296 outstr << (this->BoolValue() ?
"true" :
"false");
#define ChiLogicalError(message)
double FloatValue() const override
bool BoolValue() const override
int64_t IntegerValue() const override
std::string StringValue() const override
virtual double FloatValue() const
virtual int64_t IntegerValue() const
virtual std::vector< std::byte > BytesValue() const
virtual std::string StringValue() const
virtual bool BoolValue() const
std::string PrintStr(bool with_type=true) const
double FloatValue() const
std::string StringValue() const
Varying & operator=(const Varying &other)
int64_t IntegerValue() const
void CheckTypeMatch(VaryingDataType type_A, VaryingDataType type_B_required) const
std::unique_ptr< VaryingType > data_
@ INTEGER
Datatype mapping to int64_t.
@ STRING
Datatype mapping to std::string.
@ BOOL
Datatype mapping to bool.
@ ARBITRARY_BYTES
Basic sequence of bytes.
@ FLOAT
Datatype mapping to double.
std::string VaryingDataTypeStringName(VaryingDataType type)
std::ostream & operator<<(std::ostream &outstr, const chi_data_types::Varying &value)