Debian Codegraph @

pdata/pprofile/generated_profilesdata.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 )
12
13 // ProfilesData represents the profiles data that can be stored in persistent storage,
14 // OR can be embedded by other protocols that transfer OTLP profiles data but do not
15 // implement the OTLP protocol.
16 //
17 // This is a reference type, if passed by value and callee modifies it the
18 // caller will see the modification.
19 //
20 // Must use NewProfilesData function to create new instances.
21 // Important: zero-initialized instance is not valid for use.
22 type ProfilesData internal.ProfilesDataWrapper
23
24 func newProfilesData(orig *internal.ProfilesData, state *internal.State) ProfilesData {
25 return ProfilesData(internal.NewProfilesDataWrapper(orig, state))
26 }
27
28 // NewProfilesData creates a new empty ProfilesData.
29 //
30 // This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice,
31 // OR directly access the member if this is embedded in another struct.
32 func NewProfilesData() ProfilesData {
33 return newProfilesData(internal.NewProfilesData(), internal.NewState())
34 }
35
36 // MoveTo moves all properties from the current struct overriding the destination and
37 // resetting the current instance to its zero value
38 func (ms ProfilesData) MoveTo(dest ProfilesData) {
39 ms.getState().AssertMutable()
40 dest.getState().AssertMutable()
41 // If they point to the same data, they are the same, nothing to do.
42 if ms.getOrig() == dest.getOrig() {
43 return
44 }
45 internal.DeleteProfilesData(dest.getOrig(), false)
46 *dest.getOrig(), *ms.getOrig() = *ms.getOrig(), *dest.getOrig()
47 }
48
49 // ResourceProfiles returns the ResourceProfiles associated with this ProfilesData.
50 func (ms ProfilesData) ResourceProfiles() ResourceProfilesSlice {
51 return newResourceProfilesSlice(&ms.getOrig().ResourceProfiles, ms.getState())
52 }
53
54 // Dictionary returns the dictionary associated with this ProfilesData.
55 func (ms ProfilesData) Dictionary() ProfilesDictionary {
56 return newProfilesDictionary(&ms.getOrig().Dictionary, ms.getState())
57 }
58
59 // CopyTo copies all properties from the current struct overriding the destination.
60 func (ms ProfilesData) CopyTo(dest ProfilesData) {
61 dest.getState().AssertMutable()
62 internal.CopyProfilesData(dest.getOrig(), ms.getOrig())
63 }
64
65 func (ms ProfilesData) getOrig() *internal.ProfilesData {
66 return internal.GetProfilesDataOrig(internal.ProfilesDataWrapper(ms))
67 }
68
69 func (ms ProfilesData) getState() *internal.State {
70 return internal.GetProfilesDataState(internal.ProfilesDataWrapper(ms))
71 }