blob: 07c7a52ea7d473bd6ef566dcd73cbd0b236c80c5 [file] [log] [blame]
// camera/mojo/effects/effects_pipeline.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 CAMERA_MOJO_EFFECTS_EFFECTS_PIPELINE_MOJOM_H_
#define CAMERA_MOJO_EFFECTS_EFFECTS_PIPELINE_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 "camera/mojo/effects/effects_pipeline.mojom-features.h"
#include "camera/mojo/effects/effects_pipeline.mojom-shared.h"
#include "camera/mojo/effects/effects_pipeline.mojom-forward.h"
#include "camera/mojo/file_path.mojom.h"
#include <string>
#include <vector>
namespace cros::mojom {
class EffectsConfig {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<EffectsConfig, T>::value>;
using DataView = EffectsConfigDataView;
using Data_ = internal::EffectsConfig_Data;
template <typename... Args>
static EffectsConfigPtr New(Args&&... args) {
return EffectsConfigPtr(
std::in_place, std::forward<Args>(args)...);
}
template <typename U>
static EffectsConfigPtr From(const U& u) {
return mojo::TypeConverter<EffectsConfigPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, EffectsConfig>::Convert(*this);
}
EffectsConfig();
EffectsConfig(
CameraEffect effect,
BlurLevel blur_level,
GpuApi segmentation_gpu_api,
uint16_t graph_max_frames_in_flight);
EffectsConfig(
CameraEffect effect,
BlurLevel blur_level,
GpuApi segmentation_gpu_api,
uint16_t graph_max_frames_in_flight,
bool blur_enabled,
bool replace_enabled,
bool relight_enabled);
EffectsConfig(
CameraEffect effect,
BlurLevel blur_level,
GpuApi segmentation_gpu_api,
uint16_t graph_max_frames_in_flight,
bool blur_enabled,
bool replace_enabled,
bool relight_enabled,
SegmentationModel segmentation_model);
EffectsConfig(
CameraEffect effect,
BlurLevel blur_level,
GpuApi segmentation_gpu_api,
uint16_t graph_max_frames_in_flight,
bool blur_enabled,
bool replace_enabled,
bool relight_enabled,
SegmentationModel segmentation_model,
::mojo_base::mojom::RelativeFilePathPtr background_filepath);
EffectsConfig(
CameraEffect effect,
BlurLevel blur_level,
GpuApi segmentation_gpu_api,
uint16_t graph_max_frames_in_flight,
bool blur_enabled,
bool replace_enabled,
bool relight_enabled,
SegmentationModel segmentation_model,
::mojo_base::mojom::RelativeFilePathPtr background_filepath,
std::optional<float> light_intensity);
EffectsConfig(const EffectsConfig&) = delete;
EffectsConfig& operator=(const EffectsConfig&) = delete;
~EffectsConfig();
// 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 = EffectsConfigPtr>
EffectsConfigPtr 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, EffectsConfig::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, EffectsConfig::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
template <typename T, EffectsConfig::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<
EffectsConfig::DataView, std::vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
EffectsConfig::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::EffectsConfig_UnserializedMessageContext<
UserType, EffectsConfig::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<EffectsConfig::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const std::vector<uint8_t>& input,
UserType* output) {
return EffectsConfig::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::EffectsConfig_UnserializedMessageContext<
UserType, EffectsConfig::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<EffectsConfig::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
CameraEffect effect;
BlurLevel blur_level;
GpuApi segmentation_gpu_api;
uint16_t graph_max_frames_in_flight;
bool blur_enabled;
bool replace_enabled;
bool relight_enabled;
SegmentationModel segmentation_model;
::mojo_base::mojom::RelativeFilePathPtr background_filepath;
std::optional<float> light_intensity;
// 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, EffectsConfig::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, EffectsConfig::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, EffectsConfig::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, EffectsConfig::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
template <typename StructPtrType>
EffectsConfigPtr EffectsConfig::Clone() const {
return New(
mojo::Clone(effect),
mojo::Clone(blur_level),
mojo::Clone(segmentation_gpu_api),
mojo::Clone(graph_max_frames_in_flight),
mojo::Clone(blur_enabled),
mojo::Clone(replace_enabled),
mojo::Clone(relight_enabled),
mojo::Clone(segmentation_model),
mojo::Clone(background_filepath),
mojo::Clone(light_intensity)
);
}
template <typename T, EffectsConfig::EnableIfSame<T>*>
bool EffectsConfig::Equals(const T& other_struct) const {
if (!mojo::Equals(this->effect, other_struct.effect))
return false;
if (!mojo::Equals(this->blur_level, other_struct.blur_level))
return false;
if (!mojo::Equals(this->segmentation_gpu_api, other_struct.segmentation_gpu_api))
return false;
if (!mojo::Equals(this->graph_max_frames_in_flight, other_struct.graph_max_frames_in_flight))
return false;
if (!mojo::Equals(this->blur_enabled, other_struct.blur_enabled))
return false;
if (!mojo::Equals(this->replace_enabled, other_struct.replace_enabled))
return false;
if (!mojo::Equals(this->relight_enabled, other_struct.relight_enabled))
return false;
if (!mojo::Equals(this->segmentation_model, other_struct.segmentation_model))
return false;
if (!mojo::Equals(this->background_filepath, other_struct.background_filepath))
return false;
if (!mojo::Equals(this->light_intensity, other_struct.light_intensity))
return false;
return true;
}
template <typename T, EffectsConfig::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.effect < rhs.effect)
return true;
if (rhs.effect < lhs.effect)
return false;
if (lhs.blur_level < rhs.blur_level)
return true;
if (rhs.blur_level < lhs.blur_level)
return false;
if (lhs.segmentation_gpu_api < rhs.segmentation_gpu_api)
return true;
if (rhs.segmentation_gpu_api < lhs.segmentation_gpu_api)
return false;
if (lhs.graph_max_frames_in_flight < rhs.graph_max_frames_in_flight)
return true;
if (rhs.graph_max_frames_in_flight < lhs.graph_max_frames_in_flight)
return false;
if (lhs.blur_enabled < rhs.blur_enabled)
return true;
if (rhs.blur_enabled < lhs.blur_enabled)
return false;
if (lhs.replace_enabled < rhs.replace_enabled)
return true;
if (rhs.replace_enabled < lhs.replace_enabled)
return false;
if (lhs.relight_enabled < rhs.relight_enabled)
return true;
if (rhs.relight_enabled < lhs.relight_enabled)
return false;
if (lhs.segmentation_model < rhs.segmentation_model)
return true;
if (rhs.segmentation_model < lhs.segmentation_model)
return false;
if (lhs.background_filepath < rhs.background_filepath)
return true;
if (rhs.background_filepath < lhs.background_filepath)
return false;
if (lhs.light_intensity < rhs.light_intensity)
return true;
if (rhs.light_intensity < lhs.light_intensity)
return false;
return false;
}
} // cros::mojom
namespace mojo {
template <>
struct StructTraits<::cros::mojom::EffectsConfig::DataView,
::cros::mojom::EffectsConfigPtr> {
static bool IsNull(const ::cros::mojom::EffectsConfigPtr& input) { return !input; }
static void SetToNull(::cros::mojom::EffectsConfigPtr* output) { output->reset(); }
static decltype(::cros::mojom::EffectsConfig::effect) effect(
const ::cros::mojom::EffectsConfigPtr& input) {
return input->effect;
}
static decltype(::cros::mojom::EffectsConfig::blur_level) blur_level(
const ::cros::mojom::EffectsConfigPtr& input) {
return input->blur_level;
}
static decltype(::cros::mojom::EffectsConfig::segmentation_gpu_api) segmentation_gpu_api(
const ::cros::mojom::EffectsConfigPtr& input) {
return input->segmentation_gpu_api;
}
static decltype(::cros::mojom::EffectsConfig::graph_max_frames_in_flight) graph_max_frames_in_flight(
const ::cros::mojom::EffectsConfigPtr& input) {
return input->graph_max_frames_in_flight;
}
static decltype(::cros::mojom::EffectsConfig::blur_enabled) blur_enabled(
const ::cros::mojom::EffectsConfigPtr& input) {
return input->blur_enabled;
}
static decltype(::cros::mojom::EffectsConfig::replace_enabled) replace_enabled(
const ::cros::mojom::EffectsConfigPtr& input) {
return input->replace_enabled;
}
static decltype(::cros::mojom::EffectsConfig::relight_enabled) relight_enabled(
const ::cros::mojom::EffectsConfigPtr& input) {
return input->relight_enabled;
}
static decltype(::cros::mojom::EffectsConfig::segmentation_model) segmentation_model(
const ::cros::mojom::EffectsConfigPtr& input) {
return input->segmentation_model;
}
static const decltype(::cros::mojom::EffectsConfig::background_filepath)& background_filepath(
const ::cros::mojom::EffectsConfigPtr& input) {
return input->background_filepath;
}
static decltype(::cros::mojom::EffectsConfig::light_intensity) light_intensity(
const ::cros::mojom::EffectsConfigPtr& input) {
return input->light_intensity;
}
static bool Read(::cros::mojom::EffectsConfig::DataView input, ::cros::mojom::EffectsConfigPtr* output);
};
} // namespace mojo
#endif // CAMERA_MOJO_EFFECTS_EFFECTS_PIPELINE_MOJOM_H_