|
|
NVIDIA DeepStream SDK API Reference
|
9.2 Release
|
Go to the documentation of this file.
7 #include <initializer_list>
10 #include <unordered_map>
14 #include "opentelemetry/common/attribute_value.h"
15 #include "opentelemetry/common/key_value_iterable.h"
16 #include "opentelemetry/nostd/span.h"
17 #include "opentelemetry/nostd/string_view.h"
18 #include "opentelemetry/nostd/variant.h"
19 #include "opentelemetry/version.h"
44 std::vector<uint32_t>,
47 std::vector<std::string>,
49 std::vector<uint64_t>,
50 std::vector<uint8_t>>;
74 struct AttributeConverter
97 return convertSpan<std::string>(v);
100 template <
typename T,
typename U = T>
103 const std::vector<T> copy(vals.
begin(), vals.
end());
113 struct AttributeEqualToVisitor
116 template <
typename T,
typename U>
123 template <
typename T>
124 bool operator()(
const T &owned_value,
const T &value)
const noexcept
126 return owned_value == value;
130 bool operator()(
const std::string &owned_value,
const char *value)
const noexcept
132 return owned_value == value;
138 return owned_value == value;
145 return owned_value.size() == value.size() &&
146 std::equal(owned_value.begin(), owned_value.end(), value.begin(),
148 return owned_element == element;
153 template <
typename T>
157 return owned_value.size() == value.size() &&
158 std::equal(owned_value.begin(), owned_value.end(), value.begin());
165 class AttributeMap :
public std::unordered_map<std::string, OwnedAttributeValue>
174 attributes.ForEachKeyValue(
184 if (attributes !=
nullptr)
186 attributes->ForEachKeyValue(
196 std::initializer_list<std::pair<nostd::string_view, opentelemetry::common::AttributeValue>>
200 for (
auto &kv : attributes)
207 const std::unordered_map<std::string, OwnedAttributeValue> &
GetAttributes() const noexcept
216 (*this)[std::string(key)] =
nostd::visit(converter_, value);
220 bool EqualTo(
const opentelemetry::common::KeyValueIterable &attributes)
const noexcept
222 if (attributes.size() != this->size())
227 const bool is_equal = attributes.ForEachKeyValue(
232 for (
const auto &kv : *
this)
238 return nostd::visit(equal_to_visitor_, kv.second, value);
255 class OrderedAttributeMap :
public std::map<std::string, OwnedAttributeValue>
265 attributes.ForEachKeyValue(
274 std::initializer_list<std::pair<nostd::string_view, opentelemetry::common::AttributeValue>>
278 for (
auto &kv : attributes)
285 const std::map<std::string, OwnedAttributeValue> &
GetAttributes() const noexcept
294 (*this)[std::string(key)] =
nostd::visit(converter_, value);
AttributeMap(const opentelemetry::common::KeyValueIterable *attributes)
Class for storing attributes.
OwnedAttributeValue operator()(nostd::span< const bool > v)
OwnedAttributeValue operator()(nostd::string_view v)
OwnedAttributeValue operator()(int32_t v)
bool EqualTo(const opentelemetry::common::KeyValueIterable &attributes) const noexcept
T * begin() const noexcept
void SetAttribute(nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept
#define OPENTELEMETRY_BEGIN_NAMESPACE
nostd::variant< bool, int32_t, int64_t, uint32_t, double, const char *, nostd::string_view, nostd::span< const bool >, nostd::span< const int32_t >, nostd::span< const int64_t >, nostd::span< const uint32_t >, nostd::span< const double >, nostd::span< const nostd::string_view >, uint64_t, nostd::span< const uint64_t >, nostd::span< const uint8_t > > AttributeValue
OpenTelemetry signals can be enriched by adding attributes.
AttributeMap(std::initializer_list< std::pair< nostd::string_view, opentelemetry::common::AttributeValue >> attributes)
const std::unordered_map< std::string, OwnedAttributeValue > & GetAttributes() const noexcept
OwnedAttributeValue operator()(std::string v)
void SetAttribute(nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept
#define OPENTELEMETRY_END_NAMESPACE
bool operator()(const std::string &owned_value, nostd::string_view value) const noexcept
OwnedAttributeValue operator()(nostd::span< const uint64_t > v)
Creates an owned copy (OwnedAttributeValue) of a non-owning AttributeValue.
bool operator()(const std::vector< T > &owned_value, const nostd::span< const T > &value) const noexcept
constexpr absl::OTABSL_OPTION_NAMESPACE_NAME::remove_reference_t< T > && move(T &&t) noexcept
OwnedAttributeValue convertSpan(nostd::span< const U > vals)
Evaluates if an owned value (from an OwnedAttributeValue) is equal to another value (from a non-ownin...
AttributeMap(const opentelemetry::common::KeyValueIterable &attributes)
bool operator()(const std::vector< std::string > &owned_value, const nostd::span< const nostd::string_view > &value) const noexcept
OwnedAttributeValue operator()(int64_t v)
OwnedAttributeValue operator()(nostd::span< const uint8_t > v)
OwnedAttributeValue operator()(nostd::span< const int32_t > v)
constexpr auto visit(_Callable &&_Obj, _Variants &&..._Args)
nostd::variant< bool, int32_t, uint32_t, int64_t, double, std::string, std::vector< bool >, std::vector< int32_t >, std::vector< uint32_t >, std::vector< int64_t >, std::vector< double >, std::vector< std::string >, uint64_t, std::vector< uint64_t >, std::vector< uint8_t > > OwnedAttributeValue
A counterpart to AttributeValue that makes sure a value is owned.
OwnedAttributeValue operator()(nostd::span< const double > v)
Extensions to the C++ standard library.
OwnedAttributeValue operator()(const char *v)
OwnedAttributeValue operator()(uint32_t v)
OwnedAttributeValue operator()(nostd::span< const nostd::string_view > v)
OwnedAttributeValue operator()(nostd::span< const uint32_t > v)
OrderedAttributeMap(std::initializer_list< std::pair< nostd::string_view, opentelemetry::common::AttributeValue >> attributes)
OrderedAttributeMap(const opentelemetry::common::KeyValueIterable &attributes)
OwnedAttributeValue operator()(double v)
const std::map< std::string, OwnedAttributeValue > & GetAttributes() const noexcept
OwnedAttributeValue operator()(uint64_t v)
bool operator()(const T &owned_value, const T &value) const noexcept
OwnedAttributeValue operator()(bool v)
Class for storing attributes.
OwnedAttributeValue operator()(nostd::span< const int64_t > v)
bool operator()(const std::string &owned_value, const char *value) const noexcept
Back port of std::string_view to work with pre-cpp-17 compilers.
bool operator()(const T &, const U &) const noexcept