NVIDIA DeepStream SDK API Reference

9.2 Release
includes/opentelemetry/baggage/baggage_context.h
Go to the documentation of this file.
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3 
4 #pragma once
5 
6 #include "opentelemetry/baggage/baggage.h"
7 #include "opentelemetry/context/context.h"
8 #include "opentelemetry/nostd/shared_ptr.h"
9 #include "opentelemetry/version.h"
10 
12 
13 namespace baggage
14 {
15 
16 static const std::string kBaggageHeader = "baggage";
17 
19 {
20  context::ContextValue context_value = context.GetValue(kBaggageHeader);
22  {
23  return nostd::get<nostd::shared_ptr<Baggage>>(context_value);
24  }
25  static nostd::shared_ptr<Baggage> empty_baggage{new Baggage()};
26  return empty_baggage;
27 }
28 
30  const nostd::shared_ptr<Baggage> &baggage) noexcept
31 {
32  return context.SetValue(kBaggageHeader, baggage);
33 }
34 
35 } // namespace baggage
baggage::GetBaggage
nostd::shared_ptr< Baggage > GetBaggage(const context::Context &context) noexcept
Definition: includes/opentelemetry/baggage/baggage_context.h:18
absl::OTABSL_OPTION_NAMESPACE_NAME::variant
Definition: includes/opentelemetry/nostd/variant.h:61
baggage
Definition: includes/opentelemetry/baggage/baggage.h:16
nostd::shared_ptr
Provide a type-erased version of std::shared_ptr that has ABI stability.
Definition: includes/opentelemetry/nostd/shared_ptr.h:28
OPENTELEMETRY_BEGIN_NAMESPACE
#define OPENTELEMETRY_BEGIN_NAMESPACE
Definition: includes/opentelemetry/version.h:21
context
Definition: includes/opentelemetry/context/context.h:16
baggage::Baggage
Definition: includes/opentelemetry/baggage/baggage.h:19
baggage::SetBaggage
context::Context SetBaggage(context::Context &context, const nostd::shared_ptr< Baggage > &baggage) noexcept
Definition: includes/opentelemetry/baggage/baggage_context.h:29
baggage::kBaggageHeader
static const std::string kBaggageHeader
Definition: includes/opentelemetry/baggage/baggage_context.h:16
OPENTELEMETRY_END_NAMESPACE
#define OPENTELEMETRY_END_NAMESPACE
Definition: includes/opentelemetry/version.h:24
context::Context
Definition: includes/opentelemetry/context/context.h:23
nostd::holds_alternative
constexpr bool holds_alternative(const variant< Ts... > &v) noexcept
Definition: includes/opentelemetry/std/variant.h:218