NVIDIA Holoscan SDK v3.6.1

Program Listing for File pose_tree_ucx_client.hpp

Return to documentation for file (include/holoscan/pose_tree/pose_tree_ucx_client.hpp)

Copy
Copied!
            

/* * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * 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. */ #ifndef HOLOSCAN_POSE_TREE_UCX_CLIENT_HPP #define HOLOSCAN_POSE_TREE_UCX_CLIENT_HPP #include <atomic> #include <condition_variable> #include <cstdint> #include <memory> #include <mutex> #include <string> #include <string_view> #include <thread> #include "holoscan/core/expected.hpp" namespace holoscan { class PoseTree; struct PoseTreeUCXClientConfig { int64_t request_timeout_ms{5000}; int64_t request_poll_sleep_us{ 10}; int64_t worker_progress_sleep_us{ 100}; }; class PoseTreeUCXClient { public: enum class Error { kAlreadyConnected = 0, kInvalidArgument = 1, kConnectionFailed = 2, kNotConnected = 3, kThreadError = 4, kShutdownError = 5, kInternalError = 6, }; template <typename T> using expected = holoscan::expected<T, Error>; using unexpected = holoscan::unexpected<Error>; explicit PoseTreeUCXClient(std::shared_ptr<PoseTree> pose_tree, PoseTreeUCXClientConfig config = PoseTreeUCXClientConfig{}); ~PoseTreeUCXClient(); // Deleted copy/move operations ensure clean ownership PoseTreeUCXClient(const PoseTreeUCXClient&) = delete; PoseTreeUCXClient& operator=(const PoseTreeUCXClient&) = delete; PoseTreeUCXClient(PoseTreeUCXClient&&) = delete; // Delete move constructor PoseTreeUCXClient& operator=(PoseTreeUCXClient&&) = delete; // Delete move assignment expected<void> connect(std::string_view host, uint16_t port, bool request_snapshot); expected<void> disconnect(); bool is_running() const { return running_.load(); } static const char* error_to_str(Error error); private: void run(); struct ClientImpl; std::unique_ptr<ClientImpl> impl_; std::shared_ptr<PoseTree> pose_tree_; std::string host_; uint16_t port_{}; bool request_snapshot_; std::atomic<bool> running_{false}; std::thread client_thread_; std::atomic<bool> is_external_pose_tree_update_{ false}; std::mutex ready_mutex_; std::condition_variable ready_cv_; std::atomic<bool> ready_{false}; std::atomic<bool> connect_failed_{false}; PoseTreeUCXClientConfig config_; }; } // namespace holoscan #endif/* HOLOSCAN_POSE_TREE_UCX_CLIENT_HPP */

© Copyright 2022-2025, NVIDIA. Last updated on Oct 3, 2025