From ad499c170afd6e450ec1cc2872328b656efc9be9 Mon Sep 17 00:00:00 2001 From: Prianka Liz Kariat Date: Wed, 31 May 2023 20:43:24 +0530 Subject: [PATCH] Added MPPConnection --- .../tasks/ios/components/containers/BUILD | 6 +++ .../containers/sources/MPPConnection.h | 44 +++++++++++++++++++ .../containers/sources/MPPConnection.m | 28 ++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 mediapipe/tasks/ios/components/containers/sources/MPPConnection.h create mode 100644 mediapipe/tasks/ios/components/containers/sources/MPPConnection.m diff --git a/mediapipe/tasks/ios/components/containers/BUILD b/mediapipe/tasks/ios/components/containers/BUILD index 9ad5c22fd..0477d288a 100644 --- a/mediapipe/tasks/ios/components/containers/BUILD +++ b/mediapipe/tasks/ios/components/containers/BUILD @@ -60,3 +60,9 @@ objc_library( srcs = ["sources/MPPLandmark.m"], hdrs = ["sources/MPPLandmark.h"], ) + +objc_library( + name = "MPPConnection", + srcs = ["sources/MPPConnection.m"], + hdrs = ["sources/MPPConnection.h"], +) diff --git a/mediapipe/tasks/ios/components/containers/sources/MPPConnection.h b/mediapipe/tasks/ios/components/containers/sources/MPPConnection.h new file mode 100644 index 000000000..923599ee2 --- /dev/null +++ b/mediapipe/tasks/ios/components/containers/sources/MPPConnection.h @@ -0,0 +1,44 @@ +// Copyright 2023 The MediaPipe Authors. +// +// 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 + +NS_ASSUME_NONNULL_BEGIN + +/** The value class representing a landmark connection. */ +NS_SWIFT_NAME(Connection) +@interface MPPConnection : NSObject + +@property(nonatomic, readonly) NSInteger start; + +@property(nonatomic, readonly) NSInteger end; + +/** + * Initializes a new `MPPConnection` with the start and end landmarks integer constants. + * + * @param start The integer representing the starting landmark of the connection. + * @param end The integer representing the ending landmark of the connection. + * + * @return An instance of `MPPConnection` initialized with the given start and end landmarks integer + * constants. + */ +- (instancetype)initWithStart:(NSInteger)star end:(NSInteger)end NS_DESIGNATED_INITIALIZER; + +- (instancetype)init NS_UNAVAILABLE; + ++ (instancetype)new NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/mediapipe/tasks/ios/components/containers/sources/MPPConnection.m b/mediapipe/tasks/ios/components/containers/sources/MPPConnection.m new file mode 100644 index 000000000..803ca4ca8 --- /dev/null +++ b/mediapipe/tasks/ios/components/containers/sources/MPPConnection.m @@ -0,0 +1,28 @@ +// Copyright 2023 The MediaPipe Authors. +// +// 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 "mediapipe/tasks/ios/components/containers/sources/MPPConnection.h" + +@implementation MPPConnection + +- (instancetype)initWithStart:(NSInteger)start end:(NSInteger)end { + self = [super init]; + if (self) { + _start = start; + _end = end; + } + return self; +} + +@end