// ui/events/mojom/motion_event_android.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_EVENTS_MOJOM_MOTION_EVENT_ANDROID_MOJOM_H_
#define UI_EVENTS_MOJOM_MOTION_EVENT_ANDROID_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/events/mojom/motion_event_android.mojom-features.h"  // IWYU pragma: export
#include "ui/events/mojom/motion_event_android.mojom-shared.h"  // IWYU pragma: export
#include "ui/events/mojom/motion_event_android.mojom-forward.h"  // IWYU pragma: export
#include "mojo/public/mojom/base/time.mojom.h"
#include "ui/gfx/geometry/mojom/geometry.mojom.h"
#include <string>
#include <vector>




#include "ui/events/mojom/motion_event_android_mojom_traits.h"




namespace ui::mojom {











class  PointerCoordinates {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<PointerCoordinates, T>::value>;
  using DataView = PointerCoordinatesDataView;
  using Data_ = internal::PointerCoordinates_Data;

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

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

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


  PointerCoordinates();

  PointerCoordinates(
      const ::gfx::PointF& position,
      float touch_major);


  ~PointerCoordinates();

  // 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 = PointerCoordinatesPtr>
  PointerCoordinatesPtr 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, PointerCoordinates::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

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

  template <typename T, PointerCoordinates::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<
        PointerCoordinates::DataView, std::vector<uint8_t>, send_validation>(input);
  }

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

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        PointerCoordinates::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::PointerCoordinates_UnserializedMessageContext<
            UserType, PointerCoordinates::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<PointerCoordinates::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return PointerCoordinates::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::PointerCoordinates_UnserializedMessageContext<
            UserType, PointerCoordinates::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<PointerCoordinates::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  ::gfx::PointF position;
  
  float touch_major;

  // 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, PointerCoordinates::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

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

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

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





class  MotionEventAndroidCachedPointer {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<MotionEventAndroidCachedPointer, T>::value>;
  using DataView = MotionEventAndroidCachedPointerDataView;
  using Data_ = internal::MotionEventAndroidCachedPointer_Data;

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

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

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


  MotionEventAndroidCachedPointer();

  MotionEventAndroidCachedPointer(
      int32_t id,
      const ::ui::MotionEventAndroid::PointerCoordinates& pointer_data,
      float touch_minor,
      float pressure,
      float orientation,
      float tilt_x,
      float tilt_y,
      int32_t tool_type);


  ~MotionEventAndroidCachedPointer();

  // 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 = MotionEventAndroidCachedPointerPtr>
  MotionEventAndroidCachedPointerPtr 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, MotionEventAndroidCachedPointer::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

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

  template <typename T, MotionEventAndroidCachedPointer::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<
        MotionEventAndroidCachedPointer::DataView, std::vector<uint8_t>, send_validation>(input);
  }

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

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        MotionEventAndroidCachedPointer::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::MotionEventAndroidCachedPointer_UnserializedMessageContext<
            UserType, MotionEventAndroidCachedPointer::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<MotionEventAndroidCachedPointer::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return MotionEventAndroidCachedPointer::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::MotionEventAndroidCachedPointer_UnserializedMessageContext<
            UserType, MotionEventAndroidCachedPointer::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<MotionEventAndroidCachedPointer::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  int32_t id;
  
  ::ui::MotionEventAndroid::PointerCoordinates pointer_data;
  
  float touch_minor;
  
  float pressure;
  
  float orientation;
  
  float tilt_x;
  
  float tilt_y;
  
  int32_t tool_type;

  // 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, MotionEventAndroidCachedPointer::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

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

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

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





class  HistoricalCachedPointer {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<HistoricalCachedPointer, T>::value>;
  using DataView = HistoricalCachedPointerDataView;
  using Data_ = internal::HistoricalCachedPointer_Data;

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

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

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


  HistoricalCachedPointer();

  HistoricalCachedPointer(
      std::vector<::ui::MotionEventAndroid::PointerCoordinates> pointers,
      ::base::TimeTicks event_time);


  ~HistoricalCachedPointer();

  // 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 = HistoricalCachedPointerPtr>
  HistoricalCachedPointerPtr 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, HistoricalCachedPointer::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

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

  template <typename T, HistoricalCachedPointer::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<
        HistoricalCachedPointer::DataView, std::vector<uint8_t>, send_validation>(input);
  }

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

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        HistoricalCachedPointer::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::HistoricalCachedPointer_UnserializedMessageContext<
            UserType, HistoricalCachedPointer::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<HistoricalCachedPointer::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return HistoricalCachedPointer::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::HistoricalCachedPointer_UnserializedMessageContext<
            UserType, HistoricalCachedPointer::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<HistoricalCachedPointer::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  std::vector<::ui::MotionEventAndroid::PointerCoordinates> pointers;
  
  ::base::TimeTicks event_time;

  // 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, HistoricalCachedPointer::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

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

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

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





class  CachedMotionEventAndroid {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<CachedMotionEventAndroid, T>::value>;
  using DataView = CachedMotionEventAndroidDataView;
  using Data_ = internal::CachedMotionEventAndroid_Data;

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

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

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


  CachedMotionEventAndroid();

  CachedMotionEventAndroid(
      float pix_to_dip,
      float ticks_x,
      float ticks_y,
      float tick_multiplier,
      int32_t source,
      bool for_touch_handle,
      ::base::TimeTicks latest_event_time,
      ::base::TimeTicks down_time_ms,
      int32_t action,
      int32_t action_index,
      int32_t action_button,
      int32_t gesture_classification,
      int32_t button_state,
      int32_t flags,
      const ::gfx::Vector2dF& raw_position_offset,
      std::vector<::ui::MotionEventAndroid::CachedPointer> pointers,
      std::vector<::ui::CachedHistoricalEventSource::HistoricalCachedPointer> historical_events);


  ~CachedMotionEventAndroid();

  // 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 = CachedMotionEventAndroidPtr>
  CachedMotionEventAndroidPtr 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, CachedMotionEventAndroid::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

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

  template <typename T, CachedMotionEventAndroid::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<
        CachedMotionEventAndroid::DataView, std::vector<uint8_t>, send_validation>(input);
  }

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

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        CachedMotionEventAndroid::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::CachedMotionEventAndroid_UnserializedMessageContext<
            UserType, CachedMotionEventAndroid::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<CachedMotionEventAndroid::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return CachedMotionEventAndroid::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::CachedMotionEventAndroid_UnserializedMessageContext<
            UserType, CachedMotionEventAndroid::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<CachedMotionEventAndroid::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  float pix_to_dip;
  
  float ticks_x;
  
  float ticks_y;
  
  float tick_multiplier;
  
  int32_t source;
  
  bool for_touch_handle;
  
  ::base::TimeTicks latest_event_time;
  
  ::base::TimeTicks down_time_ms;
  
  int32_t action;
  
  int32_t action_index;
  
  int32_t action_button;
  
  int32_t gesture_classification;
  
  int32_t button_state;
  
  int32_t flags;
  
  ::gfx::Vector2dF raw_position_offset;
  
  std::vector<::ui::MotionEventAndroid::CachedPointer> pointers;
  
  std::vector<::ui::CachedHistoricalEventSource::HistoricalCachedPointer> historical_events;

  // 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, CachedMotionEventAndroid::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

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

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

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

template <typename StructPtrType>
PointerCoordinatesPtr PointerCoordinates::Clone() const {
  return New(
      mojo::Clone(position),
      mojo::Clone(touch_major)
  );
}

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

template <typename T, PointerCoordinates::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.position < rhs.position)
    return true;
  if (rhs.position < lhs.position)
    return false;
  if (lhs.touch_major < rhs.touch_major)
    return true;
  if (rhs.touch_major < lhs.touch_major)
    return false;
  return false;
}
template <typename StructPtrType>
MotionEventAndroidCachedPointerPtr MotionEventAndroidCachedPointer::Clone() const {
  return New(
      mojo::Clone(id),
      mojo::Clone(pointer_data),
      mojo::Clone(touch_minor),
      mojo::Clone(pressure),
      mojo::Clone(orientation),
      mojo::Clone(tilt_x),
      mojo::Clone(tilt_y),
      mojo::Clone(tool_type)
  );
}

template <typename T, MotionEventAndroidCachedPointer::EnableIfSame<T>*>
bool MotionEventAndroidCachedPointer::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->id, other_struct.id))
    return false;
  if (!mojo::Equals(this->pointer_data, other_struct.pointer_data))
    return false;
  if (!mojo::Equals(this->touch_minor, other_struct.touch_minor))
    return false;
  if (!mojo::Equals(this->pressure, other_struct.pressure))
    return false;
  if (!mojo::Equals(this->orientation, other_struct.orientation))
    return false;
  if (!mojo::Equals(this->tilt_x, other_struct.tilt_x))
    return false;
  if (!mojo::Equals(this->tilt_y, other_struct.tilt_y))
    return false;
  if (!mojo::Equals(this->tool_type, other_struct.tool_type))
    return false;
  return true;
}

template <typename T, MotionEventAndroidCachedPointer::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.id < rhs.id)
    return true;
  if (rhs.id < lhs.id)
    return false;
  if (lhs.pointer_data < rhs.pointer_data)
    return true;
  if (rhs.pointer_data < lhs.pointer_data)
    return false;
  if (lhs.touch_minor < rhs.touch_minor)
    return true;
  if (rhs.touch_minor < lhs.touch_minor)
    return false;
  if (lhs.pressure < rhs.pressure)
    return true;
  if (rhs.pressure < lhs.pressure)
    return false;
  if (lhs.orientation < rhs.orientation)
    return true;
  if (rhs.orientation < lhs.orientation)
    return false;
  if (lhs.tilt_x < rhs.tilt_x)
    return true;
  if (rhs.tilt_x < lhs.tilt_x)
    return false;
  if (lhs.tilt_y < rhs.tilt_y)
    return true;
  if (rhs.tilt_y < lhs.tilt_y)
    return false;
  if (lhs.tool_type < rhs.tool_type)
    return true;
  if (rhs.tool_type < lhs.tool_type)
    return false;
  return false;
}
template <typename StructPtrType>
HistoricalCachedPointerPtr HistoricalCachedPointer::Clone() const {
  return New(
      mojo::Clone(pointers),
      mojo::Clone(event_time)
  );
}

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

template <typename T, HistoricalCachedPointer::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.pointers < rhs.pointers)
    return true;
  if (rhs.pointers < lhs.pointers)
    return false;
  if (lhs.event_time < rhs.event_time)
    return true;
  if (rhs.event_time < lhs.event_time)
    return false;
  return false;
}
template <typename StructPtrType>
CachedMotionEventAndroidPtr CachedMotionEventAndroid::Clone() const {
  return New(
      mojo::Clone(pix_to_dip),
      mojo::Clone(ticks_x),
      mojo::Clone(ticks_y),
      mojo::Clone(tick_multiplier),
      mojo::Clone(source),
      mojo::Clone(for_touch_handle),
      mojo::Clone(latest_event_time),
      mojo::Clone(down_time_ms),
      mojo::Clone(action),
      mojo::Clone(action_index),
      mojo::Clone(action_button),
      mojo::Clone(gesture_classification),
      mojo::Clone(button_state),
      mojo::Clone(flags),
      mojo::Clone(raw_position_offset),
      mojo::Clone(pointers),
      mojo::Clone(historical_events)
  );
}

template <typename T, CachedMotionEventAndroid::EnableIfSame<T>*>
bool CachedMotionEventAndroid::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->pix_to_dip, other_struct.pix_to_dip))
    return false;
  if (!mojo::Equals(this->ticks_x, other_struct.ticks_x))
    return false;
  if (!mojo::Equals(this->ticks_y, other_struct.ticks_y))
    return false;
  if (!mojo::Equals(this->tick_multiplier, other_struct.tick_multiplier))
    return false;
  if (!mojo::Equals(this->source, other_struct.source))
    return false;
  if (!mojo::Equals(this->for_touch_handle, other_struct.for_touch_handle))
    return false;
  if (!mojo::Equals(this->latest_event_time, other_struct.latest_event_time))
    return false;
  if (!mojo::Equals(this->down_time_ms, other_struct.down_time_ms))
    return false;
  if (!mojo::Equals(this->action, other_struct.action))
    return false;
  if (!mojo::Equals(this->action_index, other_struct.action_index))
    return false;
  if (!mojo::Equals(this->action_button, other_struct.action_button))
    return false;
  if (!mojo::Equals(this->gesture_classification, other_struct.gesture_classification))
    return false;
  if (!mojo::Equals(this->button_state, other_struct.button_state))
    return false;
  if (!mojo::Equals(this->flags, other_struct.flags))
    return false;
  if (!mojo::Equals(this->raw_position_offset, other_struct.raw_position_offset))
    return false;
  if (!mojo::Equals(this->pointers, other_struct.pointers))
    return false;
  if (!mojo::Equals(this->historical_events, other_struct.historical_events))
    return false;
  return true;
}

template <typename T, CachedMotionEventAndroid::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.pix_to_dip < rhs.pix_to_dip)
    return true;
  if (rhs.pix_to_dip < lhs.pix_to_dip)
    return false;
  if (lhs.ticks_x < rhs.ticks_x)
    return true;
  if (rhs.ticks_x < lhs.ticks_x)
    return false;
  if (lhs.ticks_y < rhs.ticks_y)
    return true;
  if (rhs.ticks_y < lhs.ticks_y)
    return false;
  if (lhs.tick_multiplier < rhs.tick_multiplier)
    return true;
  if (rhs.tick_multiplier < lhs.tick_multiplier)
    return false;
  if (lhs.source < rhs.source)
    return true;
  if (rhs.source < lhs.source)
    return false;
  if (lhs.for_touch_handle < rhs.for_touch_handle)
    return true;
  if (rhs.for_touch_handle < lhs.for_touch_handle)
    return false;
  if (lhs.latest_event_time < rhs.latest_event_time)
    return true;
  if (rhs.latest_event_time < lhs.latest_event_time)
    return false;
  if (lhs.down_time_ms < rhs.down_time_ms)
    return true;
  if (rhs.down_time_ms < lhs.down_time_ms)
    return false;
  if (lhs.action < rhs.action)
    return true;
  if (rhs.action < lhs.action)
    return false;
  if (lhs.action_index < rhs.action_index)
    return true;
  if (rhs.action_index < lhs.action_index)
    return false;
  if (lhs.action_button < rhs.action_button)
    return true;
  if (rhs.action_button < lhs.action_button)
    return false;
  if (lhs.gesture_classification < rhs.gesture_classification)
    return true;
  if (rhs.gesture_classification < lhs.gesture_classification)
    return false;
  if (lhs.button_state < rhs.button_state)
    return true;
  if (rhs.button_state < lhs.button_state)
    return false;
  if (lhs.flags < rhs.flags)
    return true;
  if (rhs.flags < lhs.flags)
    return false;
  if (lhs.raw_position_offset < rhs.raw_position_offset)
    return true;
  if (rhs.raw_position_offset < lhs.raw_position_offset)
    return false;
  if (lhs.pointers < rhs.pointers)
    return true;
  if (rhs.pointers < lhs.pointers)
    return false;
  if (lhs.historical_events < rhs.historical_events)
    return true;
  if (rhs.historical_events < lhs.historical_events)
    return false;
  return false;
}


}  // ui::mojom

namespace mojo {


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

  static const decltype(::ui::mojom::PointerCoordinates::position)& position(
      const ::ui::mojom::PointerCoordinatesPtr& input) {
    return input->position;
  }

  static decltype(::ui::mojom::PointerCoordinates::touch_major) touch_major(
      const ::ui::mojom::PointerCoordinatesPtr& input) {
    return input->touch_major;
  }

  static bool Read(::ui::mojom::PointerCoordinates::DataView input, ::ui::mojom::PointerCoordinatesPtr* output);
};


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

  static decltype(::ui::mojom::MotionEventAndroidCachedPointer::id) id(
      const ::ui::mojom::MotionEventAndroidCachedPointerPtr& input) {
    return input->id;
  }

  static const decltype(::ui::mojom::MotionEventAndroidCachedPointer::pointer_data)& pointer_data(
      const ::ui::mojom::MotionEventAndroidCachedPointerPtr& input) {
    return input->pointer_data;
  }

  static decltype(::ui::mojom::MotionEventAndroidCachedPointer::touch_minor) touch_minor(
      const ::ui::mojom::MotionEventAndroidCachedPointerPtr& input) {
    return input->touch_minor;
  }

  static decltype(::ui::mojom::MotionEventAndroidCachedPointer::pressure) pressure(
      const ::ui::mojom::MotionEventAndroidCachedPointerPtr& input) {
    return input->pressure;
  }

  static decltype(::ui::mojom::MotionEventAndroidCachedPointer::orientation) orientation(
      const ::ui::mojom::MotionEventAndroidCachedPointerPtr& input) {
    return input->orientation;
  }

  static decltype(::ui::mojom::MotionEventAndroidCachedPointer::tilt_x) tilt_x(
      const ::ui::mojom::MotionEventAndroidCachedPointerPtr& input) {
    return input->tilt_x;
  }

  static decltype(::ui::mojom::MotionEventAndroidCachedPointer::tilt_y) tilt_y(
      const ::ui::mojom::MotionEventAndroidCachedPointerPtr& input) {
    return input->tilt_y;
  }

  static decltype(::ui::mojom::MotionEventAndroidCachedPointer::tool_type) tool_type(
      const ::ui::mojom::MotionEventAndroidCachedPointerPtr& input) {
    return input->tool_type;
  }

  static bool Read(::ui::mojom::MotionEventAndroidCachedPointer::DataView input, ::ui::mojom::MotionEventAndroidCachedPointerPtr* output);
};


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

  static const decltype(::ui::mojom::HistoricalCachedPointer::pointers)& pointers(
      const ::ui::mojom::HistoricalCachedPointerPtr& input) {
    return input->pointers;
  }

  static const decltype(::ui::mojom::HistoricalCachedPointer::event_time)& event_time(
      const ::ui::mojom::HistoricalCachedPointerPtr& input) {
    return input->event_time;
  }

  static bool Read(::ui::mojom::HistoricalCachedPointer::DataView input, ::ui::mojom::HistoricalCachedPointerPtr* output);
};


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

  static decltype(::ui::mojom::CachedMotionEventAndroid::pix_to_dip) pix_to_dip(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->pix_to_dip;
  }

  static decltype(::ui::mojom::CachedMotionEventAndroid::ticks_x) ticks_x(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->ticks_x;
  }

  static decltype(::ui::mojom::CachedMotionEventAndroid::ticks_y) ticks_y(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->ticks_y;
  }

  static decltype(::ui::mojom::CachedMotionEventAndroid::tick_multiplier) tick_multiplier(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->tick_multiplier;
  }

  static decltype(::ui::mojom::CachedMotionEventAndroid::source) source(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->source;
  }

  static decltype(::ui::mojom::CachedMotionEventAndroid::for_touch_handle) for_touch_handle(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->for_touch_handle;
  }

  static const decltype(::ui::mojom::CachedMotionEventAndroid::latest_event_time)& latest_event_time(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->latest_event_time;
  }

  static const decltype(::ui::mojom::CachedMotionEventAndroid::down_time_ms)& down_time_ms(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->down_time_ms;
  }

  static decltype(::ui::mojom::CachedMotionEventAndroid::action) action(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->action;
  }

  static decltype(::ui::mojom::CachedMotionEventAndroid::action_index) action_index(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->action_index;
  }

  static decltype(::ui::mojom::CachedMotionEventAndroid::action_button) action_button(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->action_button;
  }

  static decltype(::ui::mojom::CachedMotionEventAndroid::gesture_classification) gesture_classification(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->gesture_classification;
  }

  static decltype(::ui::mojom::CachedMotionEventAndroid::button_state) button_state(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->button_state;
  }

  static decltype(::ui::mojom::CachedMotionEventAndroid::flags) flags(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->flags;
  }

  static const decltype(::ui::mojom::CachedMotionEventAndroid::raw_position_offset)& raw_position_offset(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->raw_position_offset;
  }

  static const decltype(::ui::mojom::CachedMotionEventAndroid::pointers)& pointers(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->pointers;
  }

  static const decltype(::ui::mojom::CachedMotionEventAndroid::historical_events)& historical_events(
      const ::ui::mojom::CachedMotionEventAndroidPtr& input) {
    return input->historical_events;
  }

  static bool Read(::ui::mojom::CachedMotionEventAndroid::DataView input, ::ui::mojom::CachedMotionEventAndroidPtr* output);
};

}  // namespace mojo

#endif  // UI_EVENTS_MOJOM_MOTION_EVENT_ANDROID_MOJOM_H_