<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: opentelemetry/proto/profiles/v1development/profiles.proto

namespace Opentelemetry\Proto\Profiles\V1development;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Each Sample records values encountered in some program context. The program
 * context is typically a stack trace, perhaps augmented with auxiliary
 * information like the thread-id, some indicator of a higher level request
 * being handled etc.
 * A Sample MUST have have at least one values or timestamps_unix_nano entry. If
 * both fields are populated, they MUST contain the same number of elements, and
 * the elements at the same index MUST refer to the same event.
 * Examples of different ways of representing a sample with the total value of 10:
 * Report of a stacktrace at 10 timestamps (consumers must assume the value is 1 for each point):
 *    values: []
 *    timestamps_unix_nano: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
 * Report of a stacktrace with an aggregated value without timestamps:
 *   values: [10]
 *    timestamps_unix_nano: []
 * Report of a stacktrace at 4 timestamps where each point records a specific value:
 *    values: [2, 2, 3, 3]
 *    timestamps_unix_nano: [1, 2, 3, 4]
 *
 * Generated from protobuf message <code>opentelemetry.proto.profiles.v1development.Sample</code>
 */
class Sample extends \Google\Protobuf\Internal\Message
{
    /**
     * Reference to stack in ProfilesDictionary.stack_table.
     *
     * Generated from protobuf field <code>int32 stack_index = 1;</code>
     */
    protected $stack_index = 0;
    /**
     * The type and unit of each value is defined by Profile.sample_type.
     *
     * Generated from protobuf field <code>repeated int64 values = 2;</code>
     */
    private $values;
    /**
     * References to attributes in ProfilesDictionary.attribute_table. [optional]
     *
     * Generated from protobuf field <code>repeated int32 attribute_indices = 3;</code>
     */
    private $attribute_indices;
    /**
     * Reference to link in ProfilesDictionary.link_table. [optional]
     * It can be unset / set to 0 if no link exists, as link_table[0] is always a 'null' default value.
     *
     * Generated from protobuf field <code>int32 link_index = 4;</code>
     */
    protected $link_index = 0;
    /**
     * Timestamps associated with Sample represented in nanoseconds. These
     * timestamps should fall within the Profile's time range.
     *
     * Generated from protobuf field <code>repeated fixed64 timestamps_unix_nano = 5;</code>
     */
    private $timestamps_unix_nano;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $stack_index
     *           Reference to stack in ProfilesDictionary.stack_table.
     *     @type int[]|string[]|\Google\Protobuf\Internal\RepeatedField $values
     *           The type and unit of each value is defined by Profile.sample_type.
     *     @type int[]|\Google\Protobuf\Internal\RepeatedField $attribute_indices
     *           References to attributes in ProfilesDictionary.attribute_table. [optional]
     *     @type int $link_index
     *           Reference to link in ProfilesDictionary.link_table. [optional]
     *           It can be unset / set to 0 if no link exists, as link_table[0] is always a 'null' default value.
     *     @type int[]|string[]|\Google\Protobuf\Internal\RepeatedField $timestamps_unix_nano
     *           Timestamps associated with Sample represented in nanoseconds. These
     *           timestamps should fall within the Profile's time range.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Opentelemetry\Proto\Profiles\V1Development\Profiles::initOnce();
        parent::__construct($data);
    }

    /**
     * Reference to stack in ProfilesDictionary.stack_table.
     *
     * Generated from protobuf field <code>int32 stack_index = 1;</code>
     * @return int
     */
    public function getStackIndex()
    {
        return $this->stack_index;
    }

    /**
     * Reference to stack in ProfilesDictionary.stack_table.
     *
     * Generated from protobuf field <code>int32 stack_index = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setStackIndex($var)
    {
        GPBUtil::checkInt32($var);
        $this->stack_index = $var;

        return $this;
    }

    /**
     * The type and unit of each value is defined by Profile.sample_type.
     *
     * Generated from protobuf field <code>repeated int64 values = 2;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getValues()
    {
        return $this->values;
    }

    /**
     * The type and unit of each value is defined by Profile.sample_type.
     *
     * Generated from protobuf field <code>repeated int64 values = 2;</code>
     * @param int[]|string[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setValues($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT64);
        $this->values = $arr;

        return $this;
    }

    /**
     * References to attributes in ProfilesDictionary.attribute_table. [optional]
     *
     * Generated from protobuf field <code>repeated int32 attribute_indices = 3;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getAttributeIndices()
    {
        return $this->attribute_indices;
    }

    /**
     * References to attributes in ProfilesDictionary.attribute_table. [optional]
     *
     * Generated from protobuf field <code>repeated int32 attribute_indices = 3;</code>
     * @param int[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setAttributeIndices($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
        $this->attribute_indices = $arr;

        return $this;
    }

    /**
     * Reference to link in ProfilesDictionary.link_table. [optional]
     * It can be unset / set to 0 if no link exists, as link_table[0] is always a 'null' default value.
     *
     * Generated from protobuf field <code>int32 link_index = 4;</code>
     * @return int
     */
    public function getLinkIndex()
    {
        return $this->link_index;
    }

    /**
     * Reference to link in ProfilesDictionary.link_table. [optional]
     * It can be unset / set to 0 if no link exists, as link_table[0] is always a 'null' default value.
     *
     * Generated from protobuf field <code>int32 link_index = 4;</code>
     * @param int $var
     * @return $this
     */
    public function setLinkIndex($var)
    {
        GPBUtil::checkInt32($var);
        $this->link_index = $var;

        return $this;
    }

    /**
     * Timestamps associated with Sample represented in nanoseconds. These
     * timestamps should fall within the Profile's time range.
     *
     * Generated from protobuf field <code>repeated fixed64 timestamps_unix_nano = 5;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getTimestampsUnixNano()
    {
        return $this->timestamps_unix_nano;
    }

    /**
     * Timestamps associated with Sample represented in nanoseconds. These
     * timestamps should fall within the Profile's time range.
     *
     * Generated from protobuf field <code>repeated fixed64 timestamps_unix_nano = 5;</code>
     * @param int[]|string[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setTimestampsUnixNano($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::FIXED64);
        $this->timestamps_unix_nano = $arr;

        return $this;
    }

}

