| 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 |
// Mapping describes the mapping of a binary in memory, including its address range, file offset, and metadata like build ID |
| 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 NewMapping function to create new instances. |
| 20 |
// Important: zero-initialized instance is not valid for use. |
| 21 |
type Mapping struct { |
| 22 |
orig *internal.Mapping |
| 23 |
state *internal.State |
| 24 |
} |
| 25 |
|
| 26 |
func newMapping(orig *internal.Mapping, state *internal.State) Mapping { |
| 27 |
return Mapping{orig: orig, state: state} |
| 28 |
} |
| 29 |
|
| 30 |
// NewMapping creates a new empty Mapping. |
| 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 NewMapping() Mapping { |
| 35 |
return newMapping(internal.NewMapping(), 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 Mapping) MoveTo(dest Mapping) { |
| 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.DeleteMapping(dest.orig, false) |
| 48 |
*dest.orig, *ms.orig = *ms.orig, *dest.orig |
| 49 |
} |
| 50 |
|
| 51 |
// MemoryStart returns the memorystart associated with this Mapping. |
| 52 |
func (ms Mapping) MemoryStart() uint64 { |
| 53 |
return ms.orig.MemoryStart |
| 54 |
} |
| 55 |
|
| 56 |
// SetMemoryStart replaces the memorystart associated with this Mapping. |
| 57 |
func (ms Mapping) SetMemoryStart(v uint64) { |
| 58 |
ms.state.AssertMutable() |
| 59 |
ms.orig.MemoryStart = v |
| 60 |
} |
| 61 |
|
| 62 |
// MemoryLimit returns the memorylimit associated with this Mapping. |
| 63 |
func (ms Mapping) MemoryLimit() uint64 { |
| 64 |
return ms.orig.MemoryLimit |
| 65 |
} |
| 66 |
|
| 67 |
// SetMemoryLimit replaces the memorylimit associated with this Mapping. |
| 68 |
func (ms Mapping) SetMemoryLimit(v uint64) { |
| 69 |
ms.state.AssertMutable() |
| 70 |
ms.orig.MemoryLimit = v |
| 71 |
} |
| 72 |
|
| 73 |
// FileOffset returns the fileoffset associated with this Mapping. |
| 74 |
func (ms Mapping) FileOffset() uint64 { |
| 75 |
return ms.orig.FileOffset |
| 76 |
} |
| 77 |
|
| 78 |
// SetFileOffset replaces the fileoffset associated with this Mapping. |
| 79 |
func (ms Mapping) SetFileOffset(v uint64) { |
| 80 |
ms.state.AssertMutable() |
| 81 |
ms.orig.FileOffset = v |
| 82 |
} |
| 83 |
|
| 84 |
// FilenameStrindex returns the filenamestrindex associated with this Mapping. |
| 85 |
func (ms Mapping) FilenameStrindex() int32 { |
| 86 |
return ms.orig.FilenameStrindex |
| 87 |
} |
| 88 |
|
| 89 |
// SetFilenameStrindex replaces the filenamestrindex associated with this Mapping. |
| 90 |
func (ms Mapping) SetFilenameStrindex(v int32) { |
| 91 |
ms.state.AssertMutable() |
| 92 |
ms.orig.FilenameStrindex = v |
| 93 |
} |
| 94 |
|
| 95 |
// AttributeIndices returns the AttributeIndices associated with this Mapping. |
| 96 |
func (ms Mapping) AttributeIndices() pcommon.Int32Slice { |
| 97 |
return pcommon.Int32Slice(internal.NewInt32SliceWrapper(&ms.orig.AttributeIndices, ms.state)) |
| 98 |
} |
| 99 |
|
| 100 |
// CopyTo copies all properties from the current struct overriding the destination. |
| 101 |
func (ms Mapping) CopyTo(dest Mapping) { |
| 102 |
dest.state.AssertMutable() |
| 103 |
internal.CopyMapping(dest.orig, ms.orig) |
| 104 |
} |