Program Listing for File base2_exponential_histogram_indexer.h
↰ Return to documentation for file (/tmp/B.puc0r6hi/BUILD/opentelemetry-cpp-1.27.0-build/opentelemetry-cpp-1.27.0/sdk/include/opentelemetry/sdk/metrics/aggregation/base2_exponential_histogram_indexer.h)
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <stdint.h>
#include "opentelemetry/version.h"
OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace metrics
{
/*
* An indexer for base2 exponential histograms. It is used to calculate index for a given value and
* scale.
*/
class Base2ExponentialHistogramIndexer
{
public:
/*
* Construct a new indexer for a given scale.
*/
explicit Base2ExponentialHistogramIndexer(int32_t scale = 0);
Base2ExponentialHistogramIndexer(const Base2ExponentialHistogramIndexer &) = default;
Base2ExponentialHistogramIndexer(Base2ExponentialHistogramIndexer &&) = default;
Base2ExponentialHistogramIndexer &operator=(const Base2ExponentialHistogramIndexer &) = default;
Base2ExponentialHistogramIndexer &operator=(Base2ExponentialHistogramIndexer &&) = default;
~Base2ExponentialHistogramIndexer() = default;
int32_t ComputeIndex(double value) const;
private:
int32_t scale_;
double scale_factor_;
};
} // namespace metrics
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE