Debian Codegraph @

pdata/pmetric/generated_exponentialhistogram.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 // Code generated by "internal/cmd/pdatagen/main.go". DO NOT EDIT.
5 // To regenerate this file run "make genpdata".
6
7 package pmetric
8
9 import (
10 "go.opentelemetry.io/collector/pdata/internal"
11 )
12
13 // ExponentialHistogram represents the type of a metric that is calculated by aggregating
14 // as a ExponentialHistogram of all reported double measurements over a time interval.
15 //
16 // This is a reference type, if passed by value and callee modifies it the
17 // caller will see the modification.
18 //
19 // Must use NewExponentialHistogram function to create new instances.
20 // Important: zero-initialized instance is not valid for use.
21 type ExponentialHistogram struct {
22 orig *internal.ExponentialHistogram
23 state *internal.State
24 }
25
26 func newExponentialHistogram(orig *internal.ExponentialHistogram, state *internal.State) ExponentialHistogram {
27 return ExponentialHistogram{orig: orig, state: state}
28 }
29
30 // NewExponentialHistogram creates a new empty ExponentialHistogram.
31 //
32 // This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice,
33 // OR directly access the member if this is embedded in another struct.
34 func NewExponentialHistogram() ExponentialHistogram {
35 return newExponentialHistogram(internal.NewExponentialHistogram(), internal.NewState())
36 }
37
38 // MoveTo moves all properties from the current struct overriding the destination and
39 // resetting the current instance to its zero value
40 func (ms ExponentialHistogram) MoveTo(dest ExponentialHistogram) {
41 ms.state.AssertMutable()
42 dest.state.AssertMutable()
43 // If they point to the same data, they are the same, nothing to do.
44 if ms.orig == dest.orig {
45 return
46 }
47 internal.DeleteExponentialHistogram(dest.orig, false)
48 *dest.orig, *ms.orig = *ms.orig, *dest.orig
49 }
50
51 // DataPoints returns the DataPoints associated with this ExponentialHistogram.
52 func (ms ExponentialHistogram) DataPoints() ExponentialHistogramDataPointSlice {
53 return newExponentialHistogramDataPointSlice(&ms.orig.DataPoints, ms.state)
54 }
55
56 // AggregationTemporality returns the aggregationtemporality associated with this ExponentialHistogram.
57 func (ms ExponentialHistogram) AggregationTemporality() AggregationTemporality {
58 return AggregationTemporality(ms.orig.AggregationTemporality)
59 }
60
61 // SetAggregationTemporality replaces the aggregationtemporality associated with this ExponentialHistogram.
62 func (ms ExponentialHistogram) SetAggregationTemporality(v AggregationTemporality) {
63 ms.state.AssertMutable()
64 ms.orig.AggregationTemporality = internal.AggregationTemporality(v)
65 }
66
67 // CopyTo copies all properties from the current struct overriding the destination.
68 func (ms ExponentialHistogram) CopyTo(dest ExponentialHistogram) {
69 dest.state.AssertMutable()
70 internal.CopyExponentialHistogram(dest.orig, ms.orig)
71 }