From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- .../opentracing-cpp/include/opentracing/value.h | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/jaegertracing/opentracing-cpp/include/opentracing/value.h (limited to 'src/jaegertracing/opentracing-cpp/include/opentracing/value.h') diff --git a/src/jaegertracing/opentracing-cpp/include/opentracing/value.h b/src/jaegertracing/opentracing-cpp/include/opentracing/value.h new file mode 100644 index 000000000..1c91f8b9d --- /dev/null +++ b/src/jaegertracing/opentracing-cpp/include/opentracing/value.h @@ -0,0 +1,68 @@ +#ifndef OPENTRACING_VALUE_H +#define OPENTRACING_VALUE_H + +#include +#include +#include +#include +#include +#include +#include + +namespace opentracing { +BEGIN_OPENTRACING_ABI_NAMESPACE +// Variant value types for span tags and log payloads. +class Value; + +typedef std::unordered_map Dictionary; +typedef std::vector Values; +typedef util::variant, + util::recursive_wrapper> + variant_type; + +class Value : public variant_type { + public: + Value() noexcept : variant_type(nullptr) {} + Value(std::nullptr_t) noexcept : variant_type(nullptr) {} + + // variant_type's constructors will do some undesirable casting, for example + // variant_type(123) + // will construct a bool variant; hence, constructors are expanded + // out so as to provide more sensible behavior. + Value(bool x) noexcept : variant_type(x) {} + + template ::value && + std::is_signed::value>::type* = nullptr> + Value(T t) noexcept : variant_type(static_cast(t)) {} + + template ::value && + std::is_unsigned::value>::type* = nullptr> + Value(T t) noexcept : variant_type(static_cast(t)) {} + + template ::value>::type* = nullptr> + Value(T t) noexcept : variant_type(static_cast(t)) {} + + Value(const char* s) noexcept : variant_type(s) {} + + template + Value(const char (&cstr)[N]) : variant_type(std::string(cstr)) {} + + Value(const std::string& s) : variant_type(s) {} + Value(std::string&& s) : variant_type(std::move(s)) {} + Value(opentracing::string_view s) noexcept : variant_type(s) {} + + Value(const Values& values) : variant_type(values) {} + Value(Values&& values) : variant_type(std::move(values)) {} + + Value(const Dictionary& values) : variant_type(values) {} + Value(Dictionary&& values) : variant_type(std::move(values)) {} +}; +END_OPENTRACING_ABI_NAMESPACE +} // namespace opentracing + +#endif // OPENTRACING_VALUE_H -- cgit v1.2.3