4 #include <zerobuf/ConstAllocator.h> 5 #include <zerobuf/Vector.h> 6 #include <zerobuf/Zerobuf.h> 16 typedef std::unique_ptr< const Histogram > ConstHistogramPtr;
21 typedef ::zerobuf::Vector< uint64_t > Bins;
29 const Histogram::Bins&
getBins()
const;
37 void setBins( uint64_t
const * value,
size_t size );
38 std::vector< uint64_t > getBinsVector()
const;
45 void setBins(
const std::vector< uint64_t >& value );
54 void setMin(
float value );
63 void setMax(
float value );
65 void compact(
float threshold = 0.1f )
final;
67 Histogram(
const std::vector< uint64_t >& binsValue,
const float& minValue,
const float& maxValue );
70 Histogram( const ::zerobuf::Zerobuf& rhs );
71 explicit Histogram( ::zerobuf::AllocatorPtr allocator );
73 Histogram& operator = (
const Histogram& rhs ) { ::zerobuf::Zerobuf::operator = ( rhs );
return *
this; }
77 std::string getSchema()
const final;
78 static std::string ZEROBUF_SCHEMA();
79 std::string getTypeName()
const final {
return "lexis::render::Histogram"; }
80 static std::string ZEROBUF_TYPE_NAME() {
return "lexis::render::Histogram"; }
81 ::zerobuf::uint128_t getTypeIdentifier()
const final { return ::zerobuf::uint128_t( 0x9dfdd89ba3575401ull, 0xeb19e84da1a445c6ull ); }
82 static ::zerobuf::uint128_t ZEROBUF_TYPE_IDENTIFIER() { return ::zerobuf::uint128_t( 0x9dfdd89ba3575401ull, 0xeb19e84da1a445c6ull ); }
83 size_t getZerobufStaticSize()
const final {
return 28; }
84 static size_t ZEROBUF_STATIC_SIZE() {
return 28; }
85 size_t getZerobufNumDynamics()
const final {
return 1; }
86 static size_t ZEROBUF_NUM_DYNAMICS() {
return 1; }
87 static ConstHistogramPtr create(
const void* data,
const size_t size ) {
return ConstHistogramPtr(
new Histogram( ::zerobuf::AllocatorPtr( new ::zerobuf::ConstAllocator( reinterpret_cast< const uint8_t* >( data ), size )))); }
89 void _parseJSON(
const Json::Value& json )
final;
90 void _createJSON( Json::Value& json )
const final;
void setMax(float value)
Set the Max value.
void setBins(uint64_t const *value, size_t size)
Set the value of the Bins dynamic object from a uint64_t* and size.
Histogram::Bins & getBins()
Get a reference to the Bins dynamic member.
void setMin(float value)
Set the Min value.