Debian Codegraph @

pdata/pprofile/generated_profile.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 pprofile
8
9 import (
10 "go.opentelemetry.io/collector/pdata/internal"
11 "go.opentelemetry.io/collector/pdata/pcommon"
12 )
13
14 // Profile are an implementation of the pprofextended data model.
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 NewProfile function to create new instances.
20 // Important: zero-initialized instance is not valid for use.
21 type Profile struct {
22 orig *internal.Profile
23 state *internal.State
24 }
25
26 func newProfile(orig *internal.Profile, state *internal.State) Profile {
27 return Profile{orig: orig, state: state}
28 }
29
30 // NewProfile creates a new empty Profile.
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 NewProfile() Profile {
35 return newProfile(internal.NewProfile(), 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 Profile) MoveTo(dest Profile) {
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.DeleteProfile(dest.orig, false)
48 *dest.orig, *ms.orig = *ms.orig, *dest.orig
49 }
50
51 // SampleType returns the sampletype associated with this Profile.
52 func (ms Profile) SampleType() ValueType {
53 return newValueType(&ms.orig.SampleType, ms.state)
54 }
55
56 // Samples returns the Samples associated with this Profile.
57 func (ms Profile) Samples() SampleSlice {
58 return newSampleSlice(&ms.orig.Samples, ms.state)
59 }
60
61 // Time returns the time associated with this Profile.
62 func (ms Profile) Time() pcommon.Timestamp {
63 return pcommon.Timestamp(ms.orig.TimeUnixNano)
64 }
65
66 // SetTime replaces the time associated with this Profile.
67 func (ms Profile) SetTime(v pcommon.Timestamp) {
68 ms.state.AssertMutable()
69 ms.orig.TimeUnixNano = uint64(v)
70 }
71
72 // DurationNano returns the durationnano associated with this Profile.
73 func (ms Profile) DurationNano() uint64 {
74 return ms.orig.DurationNano
75 }
76
77 // SetDurationNano replaces the durationnano associated with this Profile.
78 func (ms Profile) SetDurationNano(v uint64) {
79 ms.state.AssertMutable()
80 ms.orig.DurationNano = v
81 }
82
83 // PeriodType returns the periodtype associated with this Profile.
84 func (ms Profile) PeriodType() ValueType {
85 return newValueType(&ms.orig.PeriodType, ms.state)
86 }
87
88 // Period returns the period associated with this Profile.
89 func (ms Profile) Period() int64 {
90 return ms.orig.Period
91 }
92
93 // SetPeriod replaces the period associated with this Profile.
94 func (ms Profile) SetPeriod(v int64) {
95 ms.state.AssertMutable()
96 ms.orig.Period = v
97 }
98
99 // ProfileID returns the profileid associated with this Profile.
100 func (ms Profile) ProfileID() ProfileID {
101 return ProfileID(ms.orig.ProfileId)
102 }
103
104 // SetProfileID replaces the profileid associated with this Profile.
105 func (ms Profile) SetProfileID(v ProfileID) {
106 ms.state.AssertMutable()
107 ms.orig.ProfileId = internal.ProfileID(v)
108 }
109
110 // DroppedAttributesCount returns the droppedattributescount associated with this Profile.
111 func (ms Profile) DroppedAttributesCount() uint32 {
112 return ms.orig.DroppedAttributesCount
113 }
114
115 // SetDroppedAttributesCount replaces the droppedattributescount associated with this Profile.
116 func (ms Profile) SetDroppedAttributesCount(v uint32) {
117 ms.state.AssertMutable()
118 ms.orig.DroppedAttributesCount = v
119 }
120
121 // OriginalPayloadFormat returns the originalpayloadformat associated with this Profile.
122 func (ms Profile) OriginalPayloadFormat() string {
123 return ms.orig.OriginalPayloadFormat
124 }
125
126 // SetOriginalPayloadFormat replaces the originalpayloadformat associated with this Profile.
127 func (ms Profile) SetOriginalPayloadFormat(v string) {
128 ms.state.AssertMutable()
129 ms.orig.OriginalPayloadFormat = v
130 }
131
132 // OriginalPayload returns the OriginalPayload associated with this Profile.
133 func (ms Profile) OriginalPayload() pcommon.ByteSlice {
134 return pcommon.ByteSlice(internal.NewByteSliceWrapper(&ms.orig.OriginalPayload, ms.state))
135 }
136
137 // AttributeIndices returns the AttributeIndices associated with this Profile.
138 func (ms Profile) AttributeIndices() pcommon.Int32Slice {
139 return pcommon.Int32Slice(internal.NewInt32SliceWrapper(&ms.orig.AttributeIndices, ms.state))
140 }
141
142 // CopyTo copies all properties from the current struct overriding the destination.
143 func (ms Profile) CopyTo(dest Profile) {
144 dest.state.AssertMutable()
145 internal.CopyProfile(dest.orig, ms.orig)
146 }