| // chromeos/services/machine_learning/public/mojom/model.mojom.h is auto generated by mojom_bindings_generator.py, do not edit |
| |
| // Copyright 2013 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef CHROMEOS_SERVICES_MACHINE_LEARNING_PUBLIC_MOJOM_MODEL_MOJOM_H_ |
| #define CHROMEOS_SERVICES_MACHINE_LEARNING_PUBLIC_MOJOM_MODEL_MOJOM_H_ |
| |
| #include <stdint.h> |
| |
| #include <limits> |
| #include <type_traits> |
| #include <utility> |
| |
| #include "third_party/abseil-cpp/absl/types/optional.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 "chromeos/services/machine_learning/public/mojom/model.mojom-shared.h" |
| #include "chromeos/services/machine_learning/public/mojom/model.mojom-forward.h" |
| #include "chromeos/services/machine_learning/public/mojom/graph_executor.mojom-forward.h" |
| #include <string> |
| #include <vector> |
| |
| #include "mojo/public/cpp/bindings/lib/control_message_handler.h" |
| #include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h" |
| |
| |
| #include "base/component_export.h" |
| |
| #ifdef KYTHE_IS_RUNNING |
| #pragma kythe_inline_metadata "Metadata comment" |
| #endif |
| |
| |
| namespace chromeos { |
| namespace machine_learning { |
| namespace mojom { |
| |
| class ModelProxy; |
| |
| template <typename ImplRefTraits> |
| class ModelStub; |
| |
| class ModelRequestValidator; |
| class ModelResponseValidator; |
| |
| |
| // @generated_from: chromeos.machine_learning.mojom.Model |
| class COMPONENT_EXPORT(MLSERVICE_MOJOM) Model |
| : public ModelInterfaceBase { |
| public: |
| static const char Name_[]; |
| static std::pair<uint32_t, const void*> MessageToMethodInfo_(mojo::Message& message); |
| static const char* MessageToMethodName_(mojo::Message& message); |
| static constexpr uint32_t Version_ = 0; |
| static constexpr bool PassesAssociatedKinds_ = false; |
| static constexpr bool HasSyncMethods_ = false; |
| static constexpr bool HasUninterruptableMethods_ = false; |
| |
| using Base_ = ModelInterfaceBase; |
| using Proxy_ = ModelProxy; |
| |
| template <typename ImplRefTraits> |
| using Stub_ = ModelStub<ImplRefTraits>; |
| |
| using RequestValidator_ = ModelRequestValidator; |
| using ResponseValidator_ = ModelResponseValidator; |
| enum MethodMinVersions : uint32_t { |
| kREMOVED_0MinVersion = 0, |
| kCreateGraphExecutorMinVersion = 0, |
| }; |
| |
| // crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK |
| // with not having this data in traces there. |
| #if !BUILDFLAG(IS_FUCHSIA) |
| struct REMOVED_0_Sym { |
| NOINLINE static void IPCSymbol(); |
| }; |
| struct CreateGraphExecutor_Sym { |
| NOINLINE static void IPCSymbol(); |
| }; |
| #endif // !BUILDFLAG(IS_FUCHSIA) |
| virtual ~Model() = default; |
| |
| |
| using REMOVED_0Callback = base::OnceCallback<void(CreateGraphExecutorResult)>; |
| |
| // @generated_from: chromeos.machine_learning.mojom.Model.REMOVED_0 |
| virtual void REMOVED_0(::mojo::PendingReceiver<::chromeos::machine_learning::mojom::GraphExecutor> receiver, REMOVED_0Callback callback) = 0; |
| |
| |
| using CreateGraphExecutorCallback = base::OnceCallback<void(CreateGraphExecutorResult)>; |
| |
| // @generated_from: chromeos.machine_learning.mojom.Model.CreateGraphExecutor |
| virtual void CreateGraphExecutor(GraphExecutorOptionsPtr options, ::mojo::PendingReceiver<::chromeos::machine_learning::mojom::GraphExecutor> receiver, CreateGraphExecutorCallback callback) = 0; |
| }; |
| |
| |
| |
| // @generated_from: chromeos.machine_learning.mojom.Model |
| class COMPONENT_EXPORT(MLSERVICE_MOJOM) ModelProxy |
| : public Model { |
| public: |
| using InterfaceType = Model; |
| |
| explicit ModelProxy(mojo::MessageReceiverWithResponder* receiver); |
| |
| // @generated_from: chromeos.machine_learning.mojom.Model.REMOVED_0 |
| void REMOVED_0(::mojo::PendingReceiver<::chromeos::machine_learning::mojom::GraphExecutor> receiver, REMOVED_0Callback callback) final; |
| |
| // @generated_from: chromeos.machine_learning.mojom.Model.CreateGraphExecutor |
| void CreateGraphExecutor(GraphExecutorOptionsPtr options, ::mojo::PendingReceiver<::chromeos::machine_learning::mojom::GraphExecutor> receiver, CreateGraphExecutorCallback callback) final; |
| |
| private: |
| mojo::MessageReceiverWithResponder* receiver_; |
| }; |
| class COMPONENT_EXPORT(MLSERVICE_MOJOM) ModelStubDispatch { |
| public: |
| static bool Accept(Model* impl, mojo::Message* message); |
| static bool AcceptWithResponder( |
| Model* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder); |
| }; |
| |
| template <typename ImplRefTraits = |
| mojo::RawPtrImplRefTraits<Model>> |
| class ModelStub |
| : public mojo::MessageReceiverWithResponderStatus { |
| public: |
| using ImplPointerType = typename ImplRefTraits::PointerType; |
| |
| ModelStub() = default; |
| ~ModelStub() override = default; |
| |
| void set_sink(ImplPointerType sink) { sink_ = std::move(sink); } |
| ImplPointerType& sink() { return sink_; } |
| |
| bool Accept(mojo::Message* message) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return ModelStubDispatch::Accept( |
| ImplRefTraits::GetRawPointer(&sink_), message); |
| } |
| |
| bool AcceptWithResponder( |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return ModelStubDispatch::AcceptWithResponder( |
| ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder)); |
| } |
| |
| private: |
| ImplPointerType sink_; |
| }; |
| class COMPONENT_EXPORT(MLSERVICE_MOJOM) ModelRequestValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| class COMPONENT_EXPORT(MLSERVICE_MOJOM) ModelResponseValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| |
| |
| |
| |
| |
| // @generated_from: chromeos.machine_learning.mojom.GraphExecutorOptions |
| class COMPONENT_EXPORT(MLSERVICE_MOJOM) GraphExecutorOptions { |
| public: |
| template <typename T> |
| using EnableIfSame = std::enable_if_t<std::is_same<GraphExecutorOptions, T>::value>; |
| using DataView = GraphExecutorOptionsDataView; |
| using Data_ = internal::GraphExecutorOptions_Data; |
| |
| template <typename... Args> |
| static GraphExecutorOptionsPtr New(Args&&... args) { |
| return GraphExecutorOptionsPtr( |
| absl::in_place, std::forward<Args>(args)...); |
| } |
| |
| template <typename U> |
| static GraphExecutorOptionsPtr From(const U& u) { |
| return mojo::TypeConverter<GraphExecutorOptionsPtr, U>::Convert(u); |
| } |
| |
| template <typename U> |
| U To() const { |
| return mojo::TypeConverter<U, GraphExecutorOptions>::Convert(*this); |
| } |
| |
| |
| GraphExecutorOptions(); |
| |
| explicit GraphExecutorOptions( |
| bool use_nnapi); |
| |
| GraphExecutorOptions( |
| bool use_nnapi, |
| bool use_gpu); |
| |
| GraphExecutorOptions( |
| bool use_nnapi, |
| bool use_gpu, |
| GpuDelegateApi gpu_delegate_api); |
| |
| |
| ~GraphExecutorOptions(); |
| |
| // 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 = GraphExecutorOptionsPtr> |
| GraphExecutorOptionsPtr 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, GraphExecutorOptions::EnableIfSame<T>* = nullptr> |
| bool Equals(const T& other) const; |
| |
| template <typename T, GraphExecutorOptions::EnableIfSame<T>* = nullptr> |
| bool operator==(const T& rhs) const { return Equals(rhs); } |
| size_t Hash(size_t seed) const; |
| template <typename UserType> |
| static std::vector<uint8_t> Serialize(UserType* input) { |
| return mojo::internal::SerializeImpl< |
| GraphExecutorOptions::DataView, std::vector<uint8_t>>(input); |
| } |
| |
| template <typename UserType> |
| static mojo::Message SerializeAsMessage(UserType* input) { |
| return mojo::internal::SerializeAsMessageImpl< |
| GraphExecutorOptions::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::GraphExecutorOptions_UnserializedMessageContext< |
| UserType, GraphExecutorOptions::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<GraphExecutorOptions::DataView>( |
| message, data, data_num_bytes, output, Validate); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const std::vector<uint8_t>& input, |
| UserType* output) { |
| return GraphExecutorOptions::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::GraphExecutorOptions_UnserializedMessageContext< |
| UserType, GraphExecutorOptions::DataView>>(); |
| if (context) { |
| *output = std::move(context->TakeData()); |
| return true; |
| } |
| input.SerializeIfNecessary(); |
| return mojo::internal::DeserializeImpl<GraphExecutorOptions::DataView>( |
| input, input.payload(), input.payload_num_bytes(), output, Validate); |
| } |
| |
| |
| // @generated_from: chromeos.machine_learning.mojom.GraphExecutorOptions.use_nnapi |
| bool use_nnapi; |
| |
| // @generated_from: chromeos.machine_learning.mojom.GraphExecutorOptions.use_gpu |
| bool use_gpu; |
| |
| // @generated_from: chromeos.machine_learning.mojom.GraphExecutorOptions.gpu_delegate_api |
| GpuDelegateApi gpu_delegate_api; |
| |
| // 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, GraphExecutorOptions::EnableIfSame<T>* = nullptr> |
| bool operator<(const T& lhs, const T& rhs); |
| |
| template <typename T, GraphExecutorOptions::EnableIfSame<T>* = nullptr> |
| bool operator<=(const T& lhs, const T& rhs) { |
| return !(rhs < lhs); |
| } |
| |
| template <typename T, GraphExecutorOptions::EnableIfSame<T>* = nullptr> |
| bool operator>(const T& lhs, const T& rhs) { |
| return rhs < lhs; |
| } |
| |
| template <typename T, GraphExecutorOptions::EnableIfSame<T>* = nullptr> |
| bool operator>=(const T& lhs, const T& rhs) { |
| return !(lhs < rhs); |
| } |
| |
| |
| |
| |
| |
| // @generated_from: chromeos.machine_learning.mojom.BuiltinModelSpec |
| class COMPONENT_EXPORT(MLSERVICE_MOJOM) BuiltinModelSpec { |
| public: |
| template <typename T> |
| using EnableIfSame = std::enable_if_t<std::is_same<BuiltinModelSpec, T>::value>; |
| using DataView = BuiltinModelSpecDataView; |
| using Data_ = internal::BuiltinModelSpec_Data; |
| |
| template <typename... Args> |
| static BuiltinModelSpecPtr New(Args&&... args) { |
| return BuiltinModelSpecPtr( |
| absl::in_place, std::forward<Args>(args)...); |
| } |
| |
| template <typename U> |
| static BuiltinModelSpecPtr From(const U& u) { |
| return mojo::TypeConverter<BuiltinModelSpecPtr, U>::Convert(u); |
| } |
| |
| template <typename U> |
| U To() const { |
| return mojo::TypeConverter<U, BuiltinModelSpec>::Convert(*this); |
| } |
| |
| |
| BuiltinModelSpec(); |
| |
| explicit BuiltinModelSpec( |
| BuiltinModelId id); |
| |
| |
| ~BuiltinModelSpec(); |
| |
| // 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 = BuiltinModelSpecPtr> |
| BuiltinModelSpecPtr 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, BuiltinModelSpec::EnableIfSame<T>* = nullptr> |
| bool Equals(const T& other) const; |
| |
| template <typename T, BuiltinModelSpec::EnableIfSame<T>* = nullptr> |
| bool operator==(const T& rhs) const { return Equals(rhs); } |
| size_t Hash(size_t seed) const; |
| template <typename UserType> |
| static std::vector<uint8_t> Serialize(UserType* input) { |
| return mojo::internal::SerializeImpl< |
| BuiltinModelSpec::DataView, std::vector<uint8_t>>(input); |
| } |
| |
| template <typename UserType> |
| static mojo::Message SerializeAsMessage(UserType* input) { |
| return mojo::internal::SerializeAsMessageImpl< |
| BuiltinModelSpec::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::BuiltinModelSpec_UnserializedMessageContext< |
| UserType, BuiltinModelSpec::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<BuiltinModelSpec::DataView>( |
| message, data, data_num_bytes, output, Validate); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const std::vector<uint8_t>& input, |
| UserType* output) { |
| return BuiltinModelSpec::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::BuiltinModelSpec_UnserializedMessageContext< |
| UserType, BuiltinModelSpec::DataView>>(); |
| if (context) { |
| *output = std::move(context->TakeData()); |
| return true; |
| } |
| input.SerializeIfNecessary(); |
| return mojo::internal::DeserializeImpl<BuiltinModelSpec::DataView>( |
| input, input.payload(), input.payload_num_bytes(), output, Validate); |
| } |
| |
| |
| // @generated_from: chromeos.machine_learning.mojom.BuiltinModelSpec.id |
| BuiltinModelId id; |
| |
| // 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, BuiltinModelSpec::EnableIfSame<T>* = nullptr> |
| bool operator<(const T& lhs, const T& rhs); |
| |
| template <typename T, BuiltinModelSpec::EnableIfSame<T>* = nullptr> |
| bool operator<=(const T& lhs, const T& rhs) { |
| return !(rhs < lhs); |
| } |
| |
| template <typename T, BuiltinModelSpec::EnableIfSame<T>* = nullptr> |
| bool operator>(const T& lhs, const T& rhs) { |
| return rhs < lhs; |
| } |
| |
| template <typename T, BuiltinModelSpec::EnableIfSame<T>* = nullptr> |
| bool operator>=(const T& lhs, const T& rhs) { |
| return !(lhs < rhs); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| // @generated_from: chromeos.machine_learning.mojom.FlatBufferModelSpec |
| class COMPONENT_EXPORT(MLSERVICE_MOJOM) FlatBufferModelSpec { |
| public: |
| template <typename T> |
| using EnableIfSame = std::enable_if_t<std::is_same<FlatBufferModelSpec, T>::value>; |
| using DataView = FlatBufferModelSpecDataView; |
| using Data_ = internal::FlatBufferModelSpec_Data; |
| |
| template <typename... Args> |
| static FlatBufferModelSpecPtr New(Args&&... args) { |
| return FlatBufferModelSpecPtr( |
| absl::in_place, std::forward<Args>(args)...); |
| } |
| |
| template <typename U> |
| static FlatBufferModelSpecPtr From(const U& u) { |
| return mojo::TypeConverter<FlatBufferModelSpecPtr, U>::Convert(u); |
| } |
| |
| template <typename U> |
| U To() const { |
| return mojo::TypeConverter<U, FlatBufferModelSpec>::Convert(*this); |
| } |
| |
| |
| FlatBufferModelSpec(); |
| |
| FlatBufferModelSpec( |
| const std::string& model_string, |
| const base::flat_map<std::string, int32_t>& inputs, |
| const base::flat_map<std::string, int32_t>& outputs, |
| const std::string& metrics_model_name); |
| |
| |
| ~FlatBufferModelSpec(); |
| |
| // 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 = FlatBufferModelSpecPtr> |
| FlatBufferModelSpecPtr 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, FlatBufferModelSpec::EnableIfSame<T>* = nullptr> |
| bool Equals(const T& other) const; |
| |
| template <typename T, FlatBufferModelSpec::EnableIfSame<T>* = nullptr> |
| bool operator==(const T& rhs) const { return Equals(rhs); } |
| template <typename UserType> |
| static std::vector<uint8_t> Serialize(UserType* input) { |
| return mojo::internal::SerializeImpl< |
| FlatBufferModelSpec::DataView, std::vector<uint8_t>>(input); |
| } |
| |
| template <typename UserType> |
| static mojo::Message SerializeAsMessage(UserType* input) { |
| return mojo::internal::SerializeAsMessageImpl< |
| FlatBufferModelSpec::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::FlatBufferModelSpec_UnserializedMessageContext< |
| UserType, FlatBufferModelSpec::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<FlatBufferModelSpec::DataView>( |
| message, data, data_num_bytes, output, Validate); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const std::vector<uint8_t>& input, |
| UserType* output) { |
| return FlatBufferModelSpec::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::FlatBufferModelSpec_UnserializedMessageContext< |
| UserType, FlatBufferModelSpec::DataView>>(); |
| if (context) { |
| *output = std::move(context->TakeData()); |
| return true; |
| } |
| input.SerializeIfNecessary(); |
| return mojo::internal::DeserializeImpl<FlatBufferModelSpec::DataView>( |
| input, input.payload(), input.payload_num_bytes(), output, Validate); |
| } |
| |
| |
| // @generated_from: chromeos.machine_learning.mojom.FlatBufferModelSpec.model_string |
| std::string model_string; |
| |
| // @generated_from: chromeos.machine_learning.mojom.FlatBufferModelSpec.inputs |
| base::flat_map<std::string, int32_t> inputs; |
| |
| // @generated_from: chromeos.machine_learning.mojom.FlatBufferModelSpec.outputs |
| base::flat_map<std::string, int32_t> outputs; |
| |
| // @generated_from: chromeos.machine_learning.mojom.FlatBufferModelSpec.metrics_model_name |
| std::string metrics_model_name; |
| |
| // 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, FlatBufferModelSpec::EnableIfSame<T>* = nullptr> |
| bool operator<(const T& lhs, const T& rhs); |
| |
| template <typename T, FlatBufferModelSpec::EnableIfSame<T>* = nullptr> |
| bool operator<=(const T& lhs, const T& rhs) { |
| return !(rhs < lhs); |
| } |
| |
| template <typename T, FlatBufferModelSpec::EnableIfSame<T>* = nullptr> |
| bool operator>(const T& lhs, const T& rhs) { |
| return rhs < lhs; |
| } |
| |
| template <typename T, FlatBufferModelSpec::EnableIfSame<T>* = nullptr> |
| bool operator>=(const T& lhs, const T& rhs) { |
| return !(lhs < rhs); |
| } |
| |
| template <typename StructPtrType> |
| GraphExecutorOptionsPtr GraphExecutorOptions::Clone() const { |
| return New( |
| mojo::Clone(use_nnapi), |
| mojo::Clone(use_gpu), |
| mojo::Clone(gpu_delegate_api) |
| ); |
| } |
| |
| template <typename T, GraphExecutorOptions::EnableIfSame<T>*> |
| bool GraphExecutorOptions::Equals(const T& other_struct) const { |
| if (!mojo::Equals(this->use_nnapi, other_struct.use_nnapi)) |
| return false; |
| if (!mojo::Equals(this->use_gpu, other_struct.use_gpu)) |
| return false; |
| if (!mojo::Equals(this->gpu_delegate_api, other_struct.gpu_delegate_api)) |
| return false; |
| return true; |
| } |
| |
| template <typename T, GraphExecutorOptions::EnableIfSame<T>*> |
| bool operator<(const T& lhs, const T& rhs) { |
| if (lhs.use_nnapi < rhs.use_nnapi) |
| return true; |
| if (rhs.use_nnapi < lhs.use_nnapi) |
| return false; |
| if (lhs.use_gpu < rhs.use_gpu) |
| return true; |
| if (rhs.use_gpu < lhs.use_gpu) |
| return false; |
| if (lhs.gpu_delegate_api < rhs.gpu_delegate_api) |
| return true; |
| if (rhs.gpu_delegate_api < lhs.gpu_delegate_api) |
| return false; |
| return false; |
| } |
| template <typename StructPtrType> |
| BuiltinModelSpecPtr BuiltinModelSpec::Clone() const { |
| return New( |
| mojo::Clone(id) |
| ); |
| } |
| |
| template <typename T, BuiltinModelSpec::EnableIfSame<T>*> |
| bool BuiltinModelSpec::Equals(const T& other_struct) const { |
| if (!mojo::Equals(this->id, other_struct.id)) |
| return false; |
| return true; |
| } |
| |
| template <typename T, BuiltinModelSpec::EnableIfSame<T>*> |
| bool operator<(const T& lhs, const T& rhs) { |
| if (lhs.id < rhs.id) |
| return true; |
| if (rhs.id < lhs.id) |
| return false; |
| return false; |
| } |
| template <typename StructPtrType> |
| FlatBufferModelSpecPtr FlatBufferModelSpec::Clone() const { |
| return New( |
| mojo::Clone(model_string), |
| mojo::Clone(inputs), |
| mojo::Clone(outputs), |
| mojo::Clone(metrics_model_name) |
| ); |
| } |
| |
| template <typename T, FlatBufferModelSpec::EnableIfSame<T>*> |
| bool FlatBufferModelSpec::Equals(const T& other_struct) const { |
| if (!mojo::Equals(this->model_string, other_struct.model_string)) |
| return false; |
| if (!mojo::Equals(this->inputs, other_struct.inputs)) |
| return false; |
| if (!mojo::Equals(this->outputs, other_struct.outputs)) |
| return false; |
| if (!mojo::Equals(this->metrics_model_name, other_struct.metrics_model_name)) |
| return false; |
| return true; |
| } |
| |
| template <typename T, FlatBufferModelSpec::EnableIfSame<T>*> |
| bool operator<(const T& lhs, const T& rhs) { |
| if (lhs.model_string < rhs.model_string) |
| return true; |
| if (rhs.model_string < lhs.model_string) |
| return false; |
| if (lhs.inputs < rhs.inputs) |
| return true; |
| if (rhs.inputs < lhs.inputs) |
| return false; |
| if (lhs.outputs < rhs.outputs) |
| return true; |
| if (rhs.outputs < lhs.outputs) |
| return false; |
| if (lhs.metrics_model_name < rhs.metrics_model_name) |
| return true; |
| if (rhs.metrics_model_name < lhs.metrics_model_name) |
| return false; |
| return false; |
| } |
| |
| |
| } // namespace mojom |
| } // namespace machine_learning |
| } // namespace chromeos |
| |
| namespace mojo { |
| |
| |
| template <> |
| struct COMPONENT_EXPORT(MLSERVICE_MOJOM) StructTraits<::chromeos::machine_learning::mojom::GraphExecutorOptions::DataView, |
| ::chromeos::machine_learning::mojom::GraphExecutorOptionsPtr> { |
| static bool IsNull(const ::chromeos::machine_learning::mojom::GraphExecutorOptionsPtr& input) { return !input; } |
| static void SetToNull(::chromeos::machine_learning::mojom::GraphExecutorOptionsPtr* output) { output->reset(); } |
| |
| static decltype(::chromeos::machine_learning::mojom::GraphExecutorOptions::use_nnapi) use_nnapi( |
| const ::chromeos::machine_learning::mojom::GraphExecutorOptionsPtr& input) { |
| return input->use_nnapi; |
| } |
| |
| static decltype(::chromeos::machine_learning::mojom::GraphExecutorOptions::use_gpu) use_gpu( |
| const ::chromeos::machine_learning::mojom::GraphExecutorOptionsPtr& input) { |
| return input->use_gpu; |
| } |
| |
| static decltype(::chromeos::machine_learning::mojom::GraphExecutorOptions::gpu_delegate_api) gpu_delegate_api( |
| const ::chromeos::machine_learning::mojom::GraphExecutorOptionsPtr& input) { |
| return input->gpu_delegate_api; |
| } |
| |
| static bool Read(::chromeos::machine_learning::mojom::GraphExecutorOptions::DataView input, ::chromeos::machine_learning::mojom::GraphExecutorOptionsPtr* output); |
| }; |
| |
| |
| template <> |
| struct COMPONENT_EXPORT(MLSERVICE_MOJOM) StructTraits<::chromeos::machine_learning::mojom::BuiltinModelSpec::DataView, |
| ::chromeos::machine_learning::mojom::BuiltinModelSpecPtr> { |
| static bool IsNull(const ::chromeos::machine_learning::mojom::BuiltinModelSpecPtr& input) { return !input; } |
| static void SetToNull(::chromeos::machine_learning::mojom::BuiltinModelSpecPtr* output) { output->reset(); } |
| |
| static decltype(::chromeos::machine_learning::mojom::BuiltinModelSpec::id) id( |
| const ::chromeos::machine_learning::mojom::BuiltinModelSpecPtr& input) { |
| return input->id; |
| } |
| |
| static bool Read(::chromeos::machine_learning::mojom::BuiltinModelSpec::DataView input, ::chromeos::machine_learning::mojom::BuiltinModelSpecPtr* output); |
| }; |
| |
| |
| template <> |
| struct COMPONENT_EXPORT(MLSERVICE_MOJOM) StructTraits<::chromeos::machine_learning::mojom::FlatBufferModelSpec::DataView, |
| ::chromeos::machine_learning::mojom::FlatBufferModelSpecPtr> { |
| static bool IsNull(const ::chromeos::machine_learning::mojom::FlatBufferModelSpecPtr& input) { return !input; } |
| static void SetToNull(::chromeos::machine_learning::mojom::FlatBufferModelSpecPtr* output) { output->reset(); } |
| |
| static const decltype(::chromeos::machine_learning::mojom::FlatBufferModelSpec::model_string)& model_string( |
| const ::chromeos::machine_learning::mojom::FlatBufferModelSpecPtr& input) { |
| return input->model_string; |
| } |
| |
| static const decltype(::chromeos::machine_learning::mojom::FlatBufferModelSpec::inputs)& inputs( |
| const ::chromeos::machine_learning::mojom::FlatBufferModelSpecPtr& input) { |
| return input->inputs; |
| } |
| |
| static const decltype(::chromeos::machine_learning::mojom::FlatBufferModelSpec::outputs)& outputs( |
| const ::chromeos::machine_learning::mojom::FlatBufferModelSpecPtr& input) { |
| return input->outputs; |
| } |
| |
| static const decltype(::chromeos::machine_learning::mojom::FlatBufferModelSpec::metrics_model_name)& metrics_model_name( |
| const ::chromeos::machine_learning::mojom::FlatBufferModelSpecPtr& input) { |
| return input->metrics_model_name; |
| } |
| |
| static bool Read(::chromeos::machine_learning::mojom::FlatBufferModelSpec::DataView input, ::chromeos::machine_learning::mojom::FlatBufferModelSpecPtr* output); |
| }; |
| |
| } // namespace mojo |
| |
| #endif // CHROMEOS_SERVICES_MACHINE_LEARNING_PUBLIC_MOJOM_MODEL_MOJOM_H_ |
| |
| /* Metadata comment |
| eyJtZXRhIjogW3siZW5kIjogMTgwOCwgImJlZ2luIjogMTgwMywgImVkZ2UiOiAiJS9reXRoZS9l |
| ZGdlL2dlbmVyYXRlcyIsICJ0eXBlIjogImFuY2hvcl9kZWZpbmVzIiwgInZuYW1lIjogeyJjb3Jw |
| dXMiOiAiY2hyb21pdW0uZ29vZ2xlc291cmNlLmNvbS9jaHJvbWl1bS9zcmMiLCAibGFuZ3VhZ2Ui |
| OiAibW9qb20iLCAic2lnbmF0dXJlIjogImNocm9tZW9zLm1hY2hpbmVfbGVhcm5pbmcubW9qb20u |
| TW9kZWwifX0sIHsiZW5kIjogMzE0NSwgImJlZ2luIjogMzEzNiwgImVkZ2UiOiAiJS9reXRoZS9l |
| ZGdlL2dlbmVyYXRlcyIsICJ0eXBlIjogImFuY2hvcl9kZWZpbmVzIiwgInZuYW1lIjoge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