| 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 |
// Profiles is the top-level struct that is propagated through the profiles pipeline. |
| 14 |
// Use NewProfiles to create new instance, zero-initialized instance is not valid for use. |
| 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 NewProfiles function to create new instances. |
| 20 |
// Important: zero-initialized instance is not valid for use. |
| 21 |
type Profiles internal.ProfilesWrapper |
| 22 |
|
| 23 |
func newProfiles(orig *internal.ExportProfilesServiceRequest, state *internal.State) Profiles { |
| 24 |
return Profiles(internal.NewProfilesWrapper(orig, state)) |
| 25 |
} |
| 26 |
|
| 27 |
// NewProfiles creates a new empty Profiles. |
| 28 |
// |
| 29 |
// This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice, |
| 30 |
// OR directly access the member if this is embedded in another struct. |
| 31 |
func NewProfiles() Profiles { |
| 32 |
return newProfiles(internal.NewExportProfilesServiceRequest(), internal.NewState()) |
| 33 |
} |
| 34 |
|
| 35 |
// MoveTo moves all properties from the current struct overriding the destination and |
| 36 |
// resetting the current instance to its zero value |
| 37 |
func (ms Profiles) MoveTo(dest Profiles) { |
| 38 |
ms.getState().AssertMutable() |
| 39 |
dest.getState().AssertMutable() |
| 40 |
// If they point to the same data, they are the same, nothing to do. |
| 41 |
if ms.getOrig() == dest.getOrig() { |
| 42 |
return |
| 43 |
} |
| 44 |
internal.DeleteExportProfilesServiceRequest(dest.getOrig(), false) |
| 45 |
*dest.getOrig(), *ms.getOrig() = *ms.getOrig(), *dest.getOrig() |
| 46 |
} |
| 47 |
|
| 48 |
// ResourceProfiles returns the ResourceProfiles associated with this Profiles. |
| 49 |
func (ms Profiles) ResourceProfiles() ResourceProfilesSlice { |
| 50 |
return newResourceProfilesSlice(&ms.getOrig().ResourceProfiles, ms.getState()) |
| 51 |
} |
| 52 |
|
| 53 |
// Dictionary returns the dictionary associated with this Profiles. |
| 54 |
func (ms Profiles) Dictionary() ProfilesDictionary { |
| 55 |
return newProfilesDictionary(&ms.getOrig().Dictionary, ms.getState()) |
| 56 |
} |
| 57 |
|
| 58 |
// CopyTo copies all properties from the current struct overriding the destination. |
| 59 |
func (ms Profiles) CopyTo(dest Profiles) { |
| 60 |
dest.getState().AssertMutable() |
| 61 |
internal.CopyExportProfilesServiceRequest(dest.getOrig(), ms.getOrig()) |
| 62 |
} |
| 63 |
|
| 64 |
func (ms Profiles) getOrig() *internal.ExportProfilesServiceRequest { |
| 65 |
return internal.GetProfilesOrig(internal.ProfilesWrapper(ms)) |
| 66 |
} |
| 67 |
|
| 68 |
func (ms Profiles) getState() *internal.State { |
| 69 |
return internal.GetProfilesState(internal.ProfilesWrapper(ms)) |
| 70 |
} |