blob: fc0a1bc5961ac6b5b6cd0da63e62355d2b9848bc [file] [log] [blame]
// media/capture/video/chromeos/mojom/camera_metadata.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 MEDIA_CAPTURE_VIDEO_CHROMEOS_MOJOM_CAMERA_METADATA_MOJOM_H_
#define MEDIA_CAPTURE_VIDEO_CHROMEOS_MOJOM_CAMERA_METADATA_MOJOM_H_
#include <stdint.h>
#include <limits>
#include <optional>
#include <type_traits>
#include <utility>
#include "base/types/cxx23_to_underlying.h"
#include "mojo/public/cpp/bindings/clone_traits.h"
#include "mojo/public/cpp/bindings/equals_traits.h"
#include "mojo/public/cpp/bindings/lib/serialization.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 "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"
#include "media/capture/video/chromeos/mojom/camera_metadata.mojom-features.h"
#include "media/capture/video/chromeos/mojom/camera_metadata.mojom-shared.h"
#include "media/capture/video/chromeos/mojom/camera_metadata.mojom-forward.h"
#include "media/capture/video/chromeos/mojom/camera_metadata_tags.mojom-forward.h"
#include <string>
#include <vector>
namespace cros::mojom {
class CameraMetadataEntry {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<CameraMetadataEntry, T>::value>;
using DataView = CameraMetadataEntryDataView;
using Data_ = internal::CameraMetadataEntry_Data;
template <typename... Args>
static CameraMetadataEntryPtr New(Args&&... args) {
return CameraMetadataEntryPtr(
std::in_place, std::forward<Args>(args)...);
}
template <typename U>
static CameraMetadataEntryPtr From(const U& u) {
return mojo::TypeConverter<CameraMetadataEntryPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, CameraMetadataEntry>::Convert(*this);
}
CameraMetadataEntry();
CameraMetadataEntry(
uint32_t index,
::cros::mojom::CameraMetadataTag tag,
EntryType type,
uint32_t count,
std::vector<uint8_t> data);
~CameraMetadataEntry();
// 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 = CameraMetadataEntryPtr>
CameraMetadataEntryPtr 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, CameraMetadataEntry::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, CameraMetadataEntry::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
template <typename T, CameraMetadataEntry::EnableIfSame<T>* = nullptr>
bool operator!=(const T& rhs) const { return !operator==(rhs); }
template <typename UserType>
static std::vector<uint8_t> Serialize(UserType* input) {
return mojo::internal::SerializeImpl<
CameraMetadataEntry::DataView, std::vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
CameraMetadataEntry::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::CameraMetadataEntry_UnserializedMessageContext<
UserType, CameraMetadataEntry::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<CameraMetadataEntry::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const std::vector<uint8_t>& input,
UserType* output) {
return CameraMetadataEntry::Deserialize(
input.size() == 0 ? nullptr : &input.front(), input.size(), output);
}
template <typename UserType>
static bool DeserializeFromMessage(mojo::Message input,
UserType* output) {
auto context = input.TakeUnserializedContext<
internal::CameraMetadataEntry_UnserializedMessageContext<
UserType, CameraMetadataEntry::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<CameraMetadataEntry::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
uint32_t index;
::cros::mojom::CameraMetadataTag tag;
EntryType type;
uint32_t count;
std::vector<uint8_t> data;
// 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, CameraMetadataEntry::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, CameraMetadataEntry::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, CameraMetadataEntry::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, CameraMetadataEntry::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
class CameraMetadata {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<CameraMetadata, T>::value>;
using DataView = CameraMetadataDataView;
using Data_ = internal::CameraMetadata_Data;
template <typename... Args>
static CameraMetadataPtr New(Args&&... args) {
return CameraMetadataPtr(
std::in_place, std::forward<Args>(args)...);
}
template <typename U>
static CameraMetadataPtr From(const U& u) {
return mojo::TypeConverter<CameraMetadataPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, CameraMetadata>::Convert(*this);
}
CameraMetadata();
CameraMetadata(
uint32_t size,
uint32_t entry_count,
uint32_t entry_capacity,
uint32_t data_count,
uint32_t data_capacity,
std::optional<std::vector<CameraMetadataEntryPtr>> entries);
CameraMetadata(const CameraMetadata&) = delete;
CameraMetadata& operator=(const CameraMetadata&) = delete;
~CameraMetadata();
// 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 = CameraMetadataPtr>
CameraMetadataPtr 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, CameraMetadata::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, CameraMetadata::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
template <typename T, CameraMetadata::EnableIfSame<T>* = nullptr>
bool operator!=(const T& rhs) const { return !operator==(rhs); }
template <typename UserType>
static std::vector<uint8_t> Serialize(UserType* input) {
return mojo::internal::SerializeImpl<
CameraMetadata::DataView, std::vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
CameraMetadata::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::CameraMetadata_UnserializedMessageContext<
UserType, CameraMetadata::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<CameraMetadata::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const std::vector<uint8_t>& input,
UserType* output) {
return CameraMetadata::Deserialize(
input.size() == 0 ? nullptr : &input.front(), input.size(), output);
}
template <typename UserType>
static bool DeserializeFromMessage(mojo::Message input,
UserType* output) {
auto context = input.TakeUnserializedContext<
internal::CameraMetadata_UnserializedMessageContext<
UserType, CameraMetadata::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<CameraMetadata::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
uint32_t size;
uint32_t entry_count;
uint32_t entry_capacity;
uint32_t data_count;
uint32_t data_capacity;
std::optional<std::vector<CameraMetadataEntryPtr>> entries;
// 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, CameraMetadata::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, CameraMetadata::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, CameraMetadata::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, CameraMetadata::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
template <typename StructPtrType>
CameraMetadataEntryPtr CameraMetadataEntry::Clone() const {
return New(
mojo::Clone(index),
mojo::Clone(tag),
mojo::Clone(type),
mojo::Clone(count),
mojo::Clone(data)
);
}
template <typename T, CameraMetadataEntry::EnableIfSame<T>*>
bool CameraMetadataEntry::Equals(const T& other_struct) const {
if (!mojo::Equals(this->index, other_struct.index))
return false;
if (!mojo::Equals(this->tag, other_struct.tag))
return false;
if (!mojo::Equals(this->type, other_struct.type))
return false;
if (!mojo::Equals(this->count, other_struct.count))
return false;
if (!mojo::Equals(this->data, other_struct.data))
return false;
return true;
}
template <typename T, CameraMetadataEntry::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.index < rhs.index)
return true;
if (rhs.index < lhs.index)
return false;
if (lhs.tag < rhs.tag)
return true;
if (rhs.tag < lhs.tag)
return false;
if (lhs.type < rhs.type)
return true;
if (rhs.type < lhs.type)
return false;
if (lhs.count < rhs.count)
return true;
if (rhs.count < lhs.count)
return false;
if (lhs.data < rhs.data)
return true;
if (rhs.data < lhs.data)
return false;
return false;
}
template <typename StructPtrType>
CameraMetadataPtr CameraMetadata::Clone() const {
return New(
mojo::Clone(size),
mojo::Clone(entry_count),
mojo::Clone(entry_capacity),
mojo::Clone(data_count),
mojo::Clone(data_capacity),
mojo::Clone(entries)
);
}
template <typename T, CameraMetadata::EnableIfSame<T>*>
bool CameraMetadata::Equals(const T& other_struct) const {
if (!mojo::Equals(this->size, other_struct.size))
return false;
if (!mojo::Equals(this->entry_count, other_struct.entry_count))
return false;
if (!mojo::Equals(this->entry_capacity, other_struct.entry_capacity))
return false;
if (!mojo::Equals(this->data_count, other_struct.data_count))
return false;
if (!mojo::Equals(this->data_capacity, other_struct.data_capacity))
return false;
if (!mojo::Equals(this->entries, other_struct.entries))
return false;
return true;
}
template <typename T, CameraMetadata::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.size < rhs.size)
return true;
if (rhs.size < lhs.size)
return false;
if (lhs.entry_count < rhs.entry_count)
return true;
if (rhs.entry_count < lhs.entry_count)
return false;
if (lhs.entry_capacity < rhs.entry_capacity)
return true;
if (rhs.entry_capacity < lhs.entry_capacity)
return false;
if (lhs.data_count < rhs.data_count)
return true;
if (rhs.data_count < lhs.data_count)
return false;
if (lhs.data_capacity < rhs.data_capacity)
return true;
if (rhs.data_capacity < lhs.data_capacity)
return false;
if (lhs.entries < rhs.entries)
return true;
if (rhs.entries < lhs.entries)
return false;
return false;
}
} // cros::mojom
namespace mojo {
template <>
struct StructTraits<::cros::mojom::CameraMetadataEntry::DataView,
::cros::mojom::CameraMetadataEntryPtr> {
static bool IsNull(const ::cros::mojom::CameraMetadataEntryPtr& input) { return !input; }
static void SetToNull(::cros::mojom::CameraMetadataEntryPtr* output) { output->reset(); }
static decltype(::cros::mojom::CameraMetadataEntry::index) index(
const ::cros::mojom::CameraMetadataEntryPtr& input) {
return input->index;
}
static decltype(::cros::mojom::CameraMetadataEntry::tag) tag(
const ::cros::mojom::CameraMetadataEntryPtr& input) {
return input->tag;
}
static decltype(::cros::mojom::CameraMetadataEntry::type) type(
const ::cros::mojom::CameraMetadataEntryPtr& input) {
return input->type;
}
static decltype(::cros::mojom::CameraMetadataEntry::count) count(
const ::cros::mojom::CameraMetadataEntryPtr& input) {
return input->count;
}
static const decltype(::cros::mojom::CameraMetadataEntry::data)& data(
const ::cros::mojom::CameraMetadataEntryPtr& input) {
return input->data;
}
static bool Read(::cros::mojom::CameraMetadataEntry::DataView input, ::cros::mojom::CameraMetadataEntryPtr* output);
};
template <>
struct StructTraits<::cros::mojom::CameraMetadata::DataView,
::cros::mojom::CameraMetadataPtr> {
static bool IsNull(const ::cros::mojom::CameraMetadataPtr& input) { return !input; }
static void SetToNull(::cros::mojom::CameraMetadataPtr* output) { output->reset(); }
static decltype(::cros::mojom::CameraMetadata::size) size(
const ::cros::mojom::CameraMetadataPtr& input) {
return input->size;
}
static decltype(::cros::mojom::CameraMetadata::entry_count) entry_count(
const ::cros::mojom::CameraMetadataPtr& input) {
return input->entry_count;
}
static decltype(::cros::mojom::CameraMetadata::entry_capacity) entry_capacity(
const ::cros::mojom::CameraMetadataPtr& input) {
return input->entry_capacity;
}
static decltype(::cros::mojom::CameraMetadata::data_count) data_count(
const ::cros::mojom::CameraMetadataPtr& input) {
return input->data_count;
}
static decltype(::cros::mojom::CameraMetadata::data_capacity) data_capacity(
const ::cros::mojom::CameraMetadataPtr& input) {
return input->data_capacity;
}
static const decltype(::cros::mojom::CameraMetadata::entries)& entries(
const ::cros::mojom::CameraMetadataPtr& input) {
return input->entries;
}
static bool Read(::cros::mojom::CameraMetadata::DataView input, ::cros::mojom::CameraMetadataPtr* output);
};
} // namespace mojo
#endif // MEDIA_CAPTURE_VIDEO_CHROMEOS_MOJOM_CAMERA_METADATA_MOJOM_H_