Program Listing for File pubsub_context.hpp
↰ Return to documentation for file (include/holoscan/core/network_contexts/gxf/pubsub_context.hpp)
/*
* SPDX-FileCopyrightText: Copyright (c) 2026 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_CORE_NETWORK_CONTEXTS_GXF_PUBSUB_CONTEXT_HPP
#define HOLOSCAN_CORE_NETWORK_CONTEXTS_GXF_PUBSUB_CONTEXT_HPP
#include <memory>
#include <string>
#include <vector>
#include <gxf/pubsub/endpoint_info.hpp>
#include <gxf/pubsub/gid.hpp>
#include <gxf/pubsub/pubsub_context.hpp>
#include "../../gxf/gxf_network_context.hpp"
#include "../../resources/gxf/clock.hpp"
namespace holoscan {
class PubSubContext : public gxf::GXFNetworkContext {
public:
HOLOSCAN_NETWORK_CONTEXT_FORWARD_ARGS_SUPER(PubSubContext, gxf::GXFNetworkContext)
PubSubContext() = default;
const char* gxf_typename() const override { return "nvidia::gxf::PubSubContext"; }
void setup(ComponentSpec& spec) override;
void initialize() override;
std::shared_ptr<Clock> clock() override;
nvidia::gxf::PubSubContext* get() const;
std::string node_name() const;
std::vector<nvidia::gxf::TopicInfo> get_topics() const;
size_t get_publisher_count(const std::string& topic) const;
size_t get_subscriber_count(const std::string& topic) const;
std::vector<nvidia::gxf::Gid> registered_publisher_gids() const;
std::vector<nvidia::gxf::Gid> registered_subscriber_gids() const;
nvidia::gxf::Expected<nvidia::gxf::Handle<nvidia::gxf::Transmitter>> get_publisher_transmitter(
const nvidia::gxf::Gid& gid) const;
nvidia::gxf::Expected<nvidia::gxf::Handle<nvidia::gxf::Receiver>> get_subscriber_receiver(
const nvidia::gxf::Gid& gid) const;
protected:
virtual void setup_backend();
private:
Parameter<std::string> node_name_;
Parameter<std::shared_ptr<gxf::Clock>> clock_;
};
} // namespace holoscan
#endif/* HOLOSCAN_CORE_NETWORK_CONTEXTS_GXF_PUBSUB_CONTEXT_HPP */