From dea0e21aeca8095cf8915f71b188976c48b84126 Mon Sep 17 00:00:00 2001 From: Prianka Liz Kariat Date: Wed, 14 Dec 2022 11:28:21 +0530 Subject: [PATCH] Separated task options protocol --- mediapipe/tasks/ios/core/BUILD | 9 +++++- .../tasks/ios/core/sources/MPPTaskOptions.h | 13 --------- .../ios/core/sources/MPPTaskOptionsProtocol.h | 29 +++++++++++++++++++ .../ios/text/text_classifier/utils/BUILD | 2 +- .../MPPTextClassifierOptions+Helpers.h | 2 +- 5 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 mediapipe/tasks/ios/core/sources/MPPTaskOptionsProtocol.h diff --git a/mediapipe/tasks/ios/core/BUILD b/mediapipe/tasks/ios/core/BUILD index e8ce47818..73fcacc37 100644 --- a/mediapipe/tasks/ios/core/BUILD +++ b/mediapipe/tasks/ios/core/BUILD @@ -25,7 +25,6 @@ objc_library( "-std=c++17", ], deps = [ - "//mediapipe/framework:calculator_options_cc_proto", ":MPPBaseOptions", ], ) @@ -74,3 +73,11 @@ objc_library( srcs = ["sources/MPPBaseOptions.m"], hdrs = ["sources/MPPBaseOptions.h"], ) + +objc_library( + name = "MPPTaskOptionsProtocol", + hdrs = ["sources/MPPTaskOptionsProtocol.h"], + deps = [ + "//mediapipe/framework:calculator_options_cc_proto", + ], +) diff --git a/mediapipe/tasks/ios/core/sources/MPPTaskOptions.h b/mediapipe/tasks/ios/core/sources/MPPTaskOptions.h index e40e92657..fa11cd38e 100644 --- a/mediapipe/tasks/ios/core/sources/MPPTaskOptions.h +++ b/mediapipe/tasks/ios/core/sources/MPPTaskOptions.h @@ -10,7 +10,6 @@ limitations under the License. ==============================================================================*/ #import -#include "mediapipe/framework/calculator_options.pb.h" #import "mediapipe/tasks/ios/core/sources/MPPBaseOptions.h" NS_ASSUME_NONNULL_BEGIN @@ -43,16 +42,4 @@ NS_SWIFT_NAME(TaskOptions) @end -/** - * Any mediapipe task options should confirm to this protocol. - */ -@protocol MPPTaskOptionsProtocol - -/** - * Copies the iOS Mediapipe task options to an object of mediapipe::CalculatorOptions proto. - */ -- (void)copyToProto:(mediapipe::CalculatorOptions *)optionsProto; - -@end - NS_ASSUME_NONNULL_END diff --git a/mediapipe/tasks/ios/core/sources/MPPTaskOptionsProtocol.h b/mediapipe/tasks/ios/core/sources/MPPTaskOptionsProtocol.h new file mode 100644 index 000000000..18543e9ef --- /dev/null +++ b/mediapipe/tasks/ios/core/sources/MPPTaskOptionsProtocol.h @@ -0,0 +1,29 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ==============================================================================*/ +#import +#include "mediapipe/framework/calculator_options.pb.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Any mediapipe task options should confirm to this protocol. + */ +@protocol MPPTaskOptionsProtocol + +/** + * Copies the iOS Mediapipe task options to an object of mediapipe::CalculatorOptions proto. + */ +- (void)copyToProto:(mediapipe::CalculatorOptions *)optionsProto; + +@end + +NS_ASSUME_NONNULL_END diff --git a/mediapipe/tasks/ios/text/text_classifier/utils/BUILD b/mediapipe/tasks/ios/text/text_classifier/utils/BUILD index 453a30f54..662e76c2a 100644 --- a/mediapipe/tasks/ios/text/text_classifier/utils/BUILD +++ b/mediapipe/tasks/ios/text/text_classifier/utils/BUILD @@ -23,8 +23,8 @@ objc_library( deps = [ "//mediapipe/tasks/ios/text/text_classifier:MPPTextClassifierOptions", "//mediapipe/tasks/ios/core/utils:MPPBaseOptionsHelpers", + "//mediapipe/tasks/ios/core:MPPTaskOptionsProtocol", "//mediapipe/tasks/ios/components/processors/utils:MPPClassifierOptionsHelpers", "//mediapipe/tasks/cc/text/text_classifier/proto:text_classifier_graph_options_cc_proto", - "//mediapipe/framework:calculator_options_cc_proto", ], ) diff --git a/mediapipe/tasks/ios/text/text_classifier/utils/sources/MPPTextClassifierOptions+Helpers.h b/mediapipe/tasks/ios/text/text_classifier/utils/sources/MPPTextClassifierOptions+Helpers.h index 8df471d05..71076da26 100644 --- a/mediapipe/tasks/ios/text/text_classifier/utils/sources/MPPTextClassifierOptions+Helpers.h +++ b/mediapipe/tasks/ios/text/text_classifier/utils/sources/MPPTextClassifierOptions+Helpers.h @@ -12,8 +12,8 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -#include "mediapipe/framework/calculator_options.pb.h" #import "mediapipe/tasks/ios/text/text_classifier/sources/MPPTextClassifierOptions.h" +#import "mediapipe/tasks/ios/core/sources/MPPTaskOptionsProtocol.h" NS_ASSUME_NONNULL_BEGIN