17 #ifndef COMMONVALUE_HPP_
18 #define COMMONVALUE_HPP_
22 #include <boost/cstdint.hpp>
23 #include <boost/ref.hpp>
29 template <
typename T, CommonValueType CVT = CommonValueType::COMMON_UNKNOWN>
43 const boost::any
getValue()
const {
return boost::cref(value_).get(); }
44 avro::GenericDatum
toAvro()
const;
57 template <
typename T, CommonValueType CVT>
63 template <
typename T, CommonValueType CVT>
69 template <
typename T, CommonValueType CVT>
75 template <
typename T, CommonValueType CVT>
87 ss <<
"\"" << value_ <<
"\"";
95 for (
auto it = value_.begin(); it != value_.end();) {
96 ss << std::setw(2) << std::setfill(
'0') << std::hex << (int)*it << std::dec;
97 if (++it != value_.end()) {
104 template <
typename T, CommonValueType CVT>
107 avro::GenericDatum datum(value_);
115 value_ =
new boost::uint8_t[valLength_];
116 std::copy(value, value + len, value_);
122 valLength_ = r.valLength_;
123 value_ =
new boost::uint8_t[valLength_];
124 std::copy(r.value_, r.value_ + valLength_, value_);
130 std::stringstream ss;
131 for (
size_t i = 0; i < valLength_; ) {
132 ss << std::setw(2) << std::setfill(
'0') << std::hex << (int)value_[i] << std::dec;
133 if (++i != valLength_) {
CommonValue(value_cref value, size_t len=0)
avro::GenericDatum toAvro() const
const boost::any getValue() const
boost::shared_ptr< T > shared_ptr
std::string toString() const