// ui/gfx/mojom/gpu_extra_info.mojom.h is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_GFX_MOJOM_GPU_EXTRA_INFO_MOJOM_H_
#define UI_GFX_MOJOM_GPU_EXTRA_INFO_MOJOM_H_

#include <stdint.h>

#include <limits>
#include <optional>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/clone_traits.h"
#include "mojo/public/cpp/bindings/equals_traits.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "mojo/public/cpp/bindings/union_traits.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"

#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"

#include "ui/gfx/mojom/gpu_extra_info.mojom-features.h"  // IWYU pragma: export
#include "ui/gfx/mojom/gpu_extra_info.mojom-shared.h"  // IWYU pragma: export
#include "ui/gfx/mojom/gpu_extra_info.mojom-forward.h"  // IWYU pragma: export
#include <string>
#include <vector>




#include "ui/gfx/mojom/gpu_extra_info_mojom_traits.h"




namespace gfx::mojom {





class  ANGLEFeature {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<ANGLEFeature, T>::value>;
  using DataView = ANGLEFeatureDataView;
  using Data_ = internal::ANGLEFeature_Data;

  template <typename... Args>
  static ANGLEFeaturePtr New(Args&&... args) {
    return ANGLEFeaturePtr(
        std::in_place, std::forward<Args>(args)...);
  }

  template <typename U>
  static ANGLEFeaturePtr From(const U& u) {
    return mojo::TypeConverter<ANGLEFeaturePtr, U>::Convert(u);
  }

  template <typename U>
  U To() const {
    return mojo::TypeConverter<U, ANGLEFeature>::Convert(*this);
  }


  ANGLEFeature();

  ANGLEFeature(
      const std::string& name,
      const std::string& category,
      const std::string& status);


  ~ANGLEFeature();

  // Clone() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Clone() or copy
  // constructor/assignment are available for members.
  template <typename StructPtrType = ANGLEFeaturePtr>
  ANGLEFeaturePtr Clone() const;

  // Equals() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Equals() or == operator
  // are available for members.
  template <typename T, ANGLEFeature::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

  template <typename T, ANGLEFeature::EnableIfSame<T>* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  template <typename T, ANGLEFeature::EnableIfSame<T>* = nullptr>
  bool operator!=(const T& rhs) const { return !operator==(rhs); }

  template <mojo::internal::SendValidation send_validation, typename UserType>
  static std::vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        ANGLEFeature::DataView, std::vector<uint8_t>, send_validation>(input);
  }

  template <typename UserType>
  static std::vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        ANGLEFeature::DataView, std::vector<uint8_t>>(input);
  }

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        ANGLEFeature::DataView>(input);
  }

  // The returned Message is serialized only if the message is moved
  // cross-process or cross-language. Otherwise if the message is Deserialized
  // as the same UserType |input| will just be moved to |output| in
  // DeserializeFromMessage.
  template <typename UserType>
  static mojo::Message WrapAsMessage(UserType input) {
    return mojo::Message(std::make_unique<
        internal::ANGLEFeature_UnserializedMessageContext<
            UserType, ANGLEFeature::DataView>>(0, 0, std::move(input)),
        MOJO_CREATE_MESSAGE_FLAG_NONE);
  }

  template <typename UserType>
  static bool Deserialize(const void* data,
                          size_t data_num_bytes,
                          UserType* output) {
    mojo::Message message;
    return mojo::internal::DeserializeImpl<ANGLEFeature::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return ANGLEFeature::Deserialize(
        input.empty() ? nullptr : input.data(), input.size(), output);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    auto context = input.TakeUnserializedContext<
        internal::ANGLEFeature_UnserializedMessageContext<
            UserType, ANGLEFeature::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<ANGLEFeature::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  std::string name;
  
  std::string category;
  
  std::string status;

  // Serialise this struct into a trace.
  void WriteIntoTrace(perfetto::TracedValue traced_context) const;

 private:
  static bool Validate(const void* data,
                       mojo::internal::ValidationContext* validation_context);
};

// The comparison operators are templates, so they are only instantiated if they
// are used. Thus, the bindings generator does not need to know whether
// comparison operators are available for members.
template <typename T, ANGLEFeature::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

template <typename T, ANGLEFeature::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
  return !(rhs < lhs);
}

template <typename T, ANGLEFeature::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
  return rhs < lhs;
}

template <typename T, ANGLEFeature::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
  return !(lhs < rhs);
}









class  GpuExtraInfo {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<GpuExtraInfo, T>::value>;
  using DataView = GpuExtraInfoDataView;
  using Data_ = internal::GpuExtraInfo_Data;

  template <typename... Args>
  static GpuExtraInfoPtr New(Args&&... args) {
    return GpuExtraInfoPtr(
        std::in_place, std::forward<Args>(args)...);
  }

  template <typename U>
  static GpuExtraInfoPtr From(const U& u) {
    return mojo::TypeConverter<GpuExtraInfoPtr, U>::Convert(u);
  }

  template <typename U>
  U To() const {
    return mojo::TypeConverter<U, GpuExtraInfo>::Convert(*this);
  }


  GpuExtraInfo();

  explicit GpuExtraInfo(
      std::vector<::gfx::ANGLEFeature> angle_features);


  ~GpuExtraInfo();

  // Clone() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Clone() or copy
  // constructor/assignment are available for members.
  template <typename StructPtrType = GpuExtraInfoPtr>
  GpuExtraInfoPtr Clone() const;

  // Equals() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Equals() or == operator
  // are available for members.
  template <typename T, GpuExtraInfo::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

  template <typename T, GpuExtraInfo::EnableIfSame<T>* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  template <typename T, GpuExtraInfo::EnableIfSame<T>* = nullptr>
  bool operator!=(const T& rhs) const { return !operator==(rhs); }

  template <mojo::internal::SendValidation send_validation, typename UserType>
  static std::vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        GpuExtraInfo::DataView, std::vector<uint8_t>, send_validation>(input);
  }

  template <typename UserType>
  static std::vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        GpuExtraInfo::DataView, std::vector<uint8_t>>(input);
  }

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        GpuExtraInfo::DataView>(input);
  }

  // The returned Message is serialized only if the message is moved
  // cross-process or cross-language. Otherwise if the message is Deserialized
  // as the same UserType |input| will just be moved to |output| in
  // DeserializeFromMessage.
  template <typename UserType>
  static mojo::Message WrapAsMessage(UserType input) {
    return mojo::Message(std::make_unique<
        internal::GpuExtraInfo_UnserializedMessageContext<
            UserType, GpuExtraInfo::DataView>>(0, 0, std::move(input)),
        MOJO_CREATE_MESSAGE_FLAG_NONE);
  }

  template <typename UserType>
  static bool Deserialize(const void* data,
                          size_t data_num_bytes,
                          UserType* output) {
    mojo::Message message;
    return mojo::internal::DeserializeImpl<GpuExtraInfo::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return GpuExtraInfo::Deserialize(
        input.empty() ? nullptr : input.data(), input.size(), output);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    auto context = input.TakeUnserializedContext<
        internal::GpuExtraInfo_UnserializedMessageContext<
            UserType, GpuExtraInfo::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<GpuExtraInfo::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  std::vector<::gfx::ANGLEFeature> angle_features;

  // Serialise this struct into a trace.
  void WriteIntoTrace(perfetto::TracedValue traced_context) const;

 private:
  static bool Validate(const void* data,
                       mojo::internal::ValidationContext* validation_context);
};

// The comparison operators are templates, so they are only instantiated if they
// are used. Thus, the bindings generator does not need to know whether
// comparison operators are available for members.
template <typename T, GpuExtraInfo::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

template <typename T, GpuExtraInfo::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
  return !(rhs < lhs);
}

template <typename T, GpuExtraInfo::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
  return rhs < lhs;
}

template <typename T, GpuExtraInfo::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
  return !(lhs < rhs);
}

template <typename StructPtrType>
ANGLEFeaturePtr ANGLEFeature::Clone() const {
  return New(
      mojo::Clone(name),
      mojo::Clone(category),
      mojo::Clone(status)
  );
}

template <typename T, ANGLEFeature::EnableIfSame<T>*>
bool ANGLEFeature::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->name, other_struct.name))
    return false;
  if (!mojo::Equals(this->category, other_struct.category))
    return false;
  if (!mojo::Equals(this->status, other_struct.status))
    return false;
  return true;
}

template <typename T, ANGLEFeature::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.name < rhs.name)
    return true;
  if (rhs.name < lhs.name)
    return false;
  if (lhs.category < rhs.category)
    return true;
  if (rhs.category < lhs.category)
    return false;
  if (lhs.status < rhs.status)
    return true;
  if (rhs.status < lhs.status)
    return false;
  return false;
}
template <typename StructPtrType>
GpuExtraInfoPtr GpuExtraInfo::Clone() const {
  return New(
      mojo::Clone(angle_features)
  );
}

template <typename T, GpuExtraInfo::EnableIfSame<T>*>
bool GpuExtraInfo::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->angle_features, other_struct.angle_features))
    return false;
  return true;
}

template <typename T, GpuExtraInfo::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.angle_features < rhs.angle_features)
    return true;
  if (rhs.angle_features < lhs.angle_features)
    return false;
  return false;
}


}  // gfx::mojom

namespace mojo {


template <>
struct  StructTraits<::gfx::mojom::ANGLEFeature::DataView,
                                         ::gfx::mojom::ANGLEFeaturePtr> {
  static bool IsNull(const ::gfx::mojom::ANGLEFeaturePtr& input) { return !input; }
  static void SetToNull(::gfx::mojom::ANGLEFeaturePtr* output) { output->reset(); }

  static const decltype(::gfx::mojom::ANGLEFeature::name)& name(
      const ::gfx::mojom::ANGLEFeaturePtr& input) {
    return input->name;
  }

  static const decltype(::gfx::mojom::ANGLEFeature::category)& category(
      const ::gfx::mojom::ANGLEFeaturePtr& input) {
    return input->category;
  }

  static const decltype(::gfx::mojom::ANGLEFeature::status)& status(
      const ::gfx::mojom::ANGLEFeaturePtr& input) {
    return input->status;
  }

  static bool Read(::gfx::mojom::ANGLEFeature::DataView input, ::gfx::mojom::ANGLEFeaturePtr* output);
};


template <>
struct  StructTraits<::gfx::mojom::GpuExtraInfo::DataView,
                                         ::gfx::mojom::GpuExtraInfoPtr> {
  static bool IsNull(const ::gfx::mojom::GpuExtraInfoPtr& input) { return !input; }
  static void SetToNull(::gfx::mojom::GpuExtraInfoPtr* output) { output->reset(); }

  static const decltype(::gfx::mojom::GpuExtraInfo::angle_features)& angle_features(
      const ::gfx::mojom::GpuExtraInfoPtr& input) {
    return input->angle_features;
  }

  static bool Read(::gfx::mojom::GpuExtraInfo::DataView input, ::gfx::mojom::GpuExtraInfoPtr* output);
};

}  // namespace mojo

#endif  // UI_GFX_MOJOM_GPU_EXTRA_INFO_MOJOM_H_