<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/devtools/cloudtrace/v2/trace.proto

namespace Google\Cloud\Trace\V2;

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

/**
 * A call stack appearing in a trace.
 *
 * Generated from protobuf message <code>google.devtools.cloudtrace.v2.StackTrace</code>
 */
class StackTrace extends \Google\Protobuf\Internal\Message
{
    /**
     * Stack frames in this stack trace. A maximum of 128 frames are allowed.
     *
     * Generated from protobuf field <code>.google.devtools.cloudtrace.v2.StackTrace.StackFrames stack_frames = 1;</code>
     */
    private $stack_frames = null;
    /**
     * The hash ID is used to conserve network bandwidth for duplicate
     * stack traces within a single trace.
     * Often multiple spans will have identical stack traces.
     * The first occurrence of a stack trace should contain both the
     * `stackFrame` content and a value in `stackTraceHashId`.
     * Subsequent spans within the same request can refer
     * to that stack trace by only setting `stackTraceHashId`.
     *
     * Generated from protobuf field <code>int64 stack_trace_hash_id = 2;</code>
     */
    private $stack_trace_hash_id = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Trace\V2\StackTrace\StackFrames $stack_frames
     *           Stack frames in this stack trace. A maximum of 128 frames are allowed.
     *     @type int|string $stack_trace_hash_id
     *           The hash ID is used to conserve network bandwidth for duplicate
     *           stack traces within a single trace.
     *           Often multiple spans will have identical stack traces.
     *           The first occurrence of a stack trace should contain both the
     *           `stackFrame` content and a value in `stackTraceHashId`.
     *           Subsequent spans within the same request can refer
     *           to that stack trace by only setting `stackTraceHashId`.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce();
        parent::__construct($data);
    }

    /**
     * Stack frames in this stack trace. A maximum of 128 frames are allowed.
     *
     * Generated from protobuf field <code>.google.devtools.cloudtrace.v2.StackTrace.StackFrames stack_frames = 1;</code>
     * @return \Google\Cloud\Trace\V2\StackTrace\StackFrames|null
     */
    public function getStackFrames()
    {
        return isset($this->stack_frames) ? $this->stack_frames : null;
    }

    public function hasStackFrames()
    {
        return isset($this->stack_frames);
    }

    public function clearStackFrames()
    {
        unset($this->stack_frames);
    }

    /**
     * Stack frames in this stack trace. A maximum of 128 frames are allowed.
     *
     * Generated from protobuf field <code>.google.devtools.cloudtrace.v2.StackTrace.StackFrames stack_frames = 1;</code>
     * @param \Google\Cloud\Trace\V2\StackTrace\StackFrames $var
     * @return $this
     */
    public function setStackFrames($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\StackTrace\StackFrames::class);
        $this->stack_frames = $var;

        return $this;
    }

    /**
     * The hash ID is used to conserve network bandwidth for duplicate
     * stack traces within a single trace.
     * Often multiple spans will have identical stack traces.
     * The first occurrence of a stack trace should contain both the
     * `stackFrame` content and a value in `stackTraceHashId`.
     * Subsequent spans within the same request can refer
     * to that stack trace by only setting `stackTraceHashId`.
     *
     * Generated from protobuf field <code>int64 stack_trace_hash_id = 2;</code>
     * @return int|string
     */
    public function getStackTraceHashId()
    {
        return $this->stack_trace_hash_id;
    }

    /**
     * The hash ID is used to conserve network bandwidth for duplicate
     * stack traces within a single trace.
     * Often multiple spans will have identical stack traces.
     * The first occurrence of a stack trace should contain both the
     * `stackFrame` content and a value in `stackTraceHashId`.
     * Subsequent spans within the same request can refer
     * to that stack trace by only setting `stackTraceHashId`.
     *
     * Generated from protobuf field <code>int64 stack_trace_hash_id = 2;</code>
     * @param int|string $var
     * @return $this
     */
    public function setStackTraceHashId($var)
    {
        GPBUtil::checkInt64($var);
        $this->stack_trace_hash_id = $var;

        return $this;
    }

}

