NVIDIA Holoscan SDK v3.6.1

Program Listing for File pose_tree_ucx_server.hpp

Return to documentation for file (include/holoscan/pose_tree/pose_tree_ucx_server.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_SERVER_HPP #define HOLOSCAN_POSE_TREE_UCX_SERVER_HPP #include <ucp/api/ucp.h> #include <atomic> #include <condition_variable> #include <cstdint> #include <memory> #include <mutex> #include <thread> #include "holoscan/core/expected.hpp" #include "holoscan/pose_tree/pose_tree.hpp" namespace holoscan { class PoseTree; struct PoseTreeUCXServerConfig { int64_t worker_progress_sleep_us{ 100}; int64_t shutdown_timeout_ms{1000}; int64_t shutdown_poll_sleep_ms{10}; int64_t maximum_clients{1024}; }; class PoseTreeUCXServer { public: enum class Error { kAlreadyRunning = 0, kInvalidArgument = 1, kStartupFailed = 2, kNotRunning = 3, kShutdownTimeout = 4, kInternalError = 5, }; template <typename T> using expected = holoscan::expected<T, Error>; using unexpected = holoscan::unexpected<Error>; explicit PoseTreeUCXServer(std::shared_ptr<PoseTree> pose_tree, PoseTreeUCXServerConfig config = PoseTreeUCXServerConfig{}); ~PoseTreeUCXServer(); // Deleted copy/move operations ensure clean ownership PoseTreeUCXServer(const PoseTreeUCXServer&) = delete; PoseTreeUCXServer& operator=(const PoseTreeUCXServer&) = delete; PoseTreeUCXServer(PoseTreeUCXServer&&) = delete; // Delete move constructor PoseTreeUCXServer& operator=(PoseTreeUCXServer&&) = delete; // Delete move assignment expected<void> start(uint16_t port); expected<void> stop(); bool is_running() const { return running_.load(); } static const char* error_to_str(Error error); friend void connection_callback(ucp_conn_request_h req, void* arg); private: void run(); struct ServerImpl; std::unique_ptr<ServerImpl> impl_; std::shared_ptr<PoseTree> pose_tree_; PoseTree::InitParameters pose_tree_init_params_; uint16_t port_{}; std::atomic<bool> running_{false}; std::thread server_thread_; std::mutex ready_mutex_; std::condition_variable ready_cv_; std::atomic<bool> ready_{ false}; PoseTreeUCXServerConfig config_; }; } // namespace holoscan #endif/* HOLOSCAN_POSE_TREE_UCX_SERVER_HPP */

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