17 #ifndef VALUEDELTATYPE_HPP_
18 #define VALUEDELTATYPE_HPP_
22 #ifdef KAA_USE_CONFIGURATION
38 class ValueDeltaType:
public EmptyDeltaType {
45 ValueDeltaType(
const IDeltaType::DeltaValue& data,
const avro::Type& type)
46 : value_(data), type_(type) {}
52 inline virtual const DeltaValue& getNewValue() {
60 virtual std::string toString()
const;
63 IDeltaType::DeltaValue value_;
67 inline std::string ValueDeltaType::toString()
const
73 case avro::AVRO_RECORD: {
74 ConfigurationDeltaPtr configurationDelta = boost::any_cast<ConfigurationDeltaPtr>(value_);
75 ss << configurationDelta->toString();
78 case avro::AVRO_BOOL: {
79 ss << std::boolalpha << boost::any_cast<bool>(value_);
82 case avro::AVRO_INT: {
83 ss << boost::any_cast<std::int32_t>(value_);
86 case avro::AVRO_LONG: {
87 ss << boost::any_cast<std::int64_t>(value_);
90 case avro::AVRO_FLOAT: {
91 ss << boost::any_cast<float>(value_);
94 case avro::AVRO_DOUBLE: {
95 ss << boost::any_cast<double>(value_);
98 case avro::AVRO_STRING: {
99 ss <<
"\"" << boost::any_cast<std::string>(value_) <<
"\"";
102 case avro::AVRO_ENUM: {
103 ss << boost::any_cast<std::string>(value_);
106 case avro::AVRO_BYTES:
107 case avro::AVRO_FIXED: {
108 const std::vector<std::uint8_t> buffer =
109 boost::any_cast<std::vector<std::uint8_t> >(value_);
111 for (
auto it = buffer.begin(); it != buffer.end();) {
112 ss << std::setw(2) << std::setfill(
'0') << std::hex << (int)*it << std::dec;
113 if (++it != buffer.end()) {
119 default:
throw KaaException(
"Unknown avro type");