Ensure that C header don't import C++ types

PiperOrigin-RevId: 564435119
This commit is contained in:
Sebastian Schmidt
2023-09-11 10:47:27 -07:00
committed by Copybara-Service
parent e206f9acdb
commit 315982df0f
18 changed files with 194 additions and 49 deletions
@@ -0,0 +1,41 @@
/* 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.
==============================================================================*/
#include <cstdint>
#include <vector>
#include "mediapipe/tasks/c/components/processors/classifier_options.h"
#include "mediapipe/tasks/cc/components/processors/classifier_options.h"
namespace mediapie::c::components::processors {
void CppConvertToClassifierOptions(
ClassifierOptions in,
mediapipe::tasks::components::processors::ClassifierOptions* out) {
out->display_names_locale = in.display_names_locale;
out->max_results = in.max_results;
out->score_threshold = in.score_threshold;
out->category_allowlist =
std::vector<std::string>(in.category_allowlist_count);
for (uint32_t i = 0; i < in.category_allowlist_count; ++i) {
out->category_allowlist[i] = in.category_allowlist[i];
}
out->category_denylist = std::vector<std::string>(in.category_denylist_count);
for (uint32_t i = 0; i < in.category_denylist_count; ++i) {
out->category_denylist[i] = in.category_denylist[i];
}
}
} // namespace mediapie::c::components::processors