Program Listing for File in_memory_pubsub_network_context.hpp
↰ Return to documentation for file (include/holoscan/pubsub/in_memory/network_contexts/gxf/in_memory_pubsub_network_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_PUBSUB_IN_MEMORY_NETWORK_CONTEXTS_GXF_IN_MEMORY_PUBSUB_NETWORK_CONTEXT_HPP
#define HOLOSCAN_PUBSUB_IN_MEMORY_NETWORK_CONTEXTS_GXF_IN_MEMORY_PUBSUB_NETWORK_CONTEXT_HPP
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
#include <gxf/pubsub/in_memory_pubsub_context.hpp> // nvidia::gxf::InMemoryPubSubContext
#include <gxf/pubsub/in_memory_serializer.hpp>
#include <holoscan/core/network_contexts/gxf/pubsub_context.hpp>
#include <holoscan/core/resources/gxf/serialization_buffer.hpp>
#include <holoscan/core/resources/gxf/std_component_serializer.hpp>
#include <holoscan/core/resources/gxf/std_entity_serializer.hpp>
#include <holoscan/core/resources/gxf/ucx_holoscan_component_serializer.hpp>
#include <holoscan/pubsub/in_memory/network_contexts/gxf/in_memory_pubsub_session.hpp>
namespace holoscan {
class InMemoryPubSubNetworkContext : public PubSubContext {
public:
HOLOSCAN_NETWORK_CONTEXT_FORWARD_ARGS_SUPER(InMemoryPubSubNetworkContext, PubSubContext)
InMemoryPubSubNetworkContext() = default;
~InMemoryPubSubNetworkContext() override;
const char* gxf_typename() const override { return "nvidia::gxf::InMemoryPubSubContext"; }
void setup(ComponentSpec& spec) override;
void initialize() override;
protected:
void setup_backend() override;
private:
void setup_private_backend();
void setup_session_backend(const std::string& sid);
Parameter<std::string> session_id_;
Parameter<int32_t> serializer_mode_;
Parameter<std::vector<int32_t>> drop_pattern_;
Parameter<std::vector<int32_t>> reorder_pattern_;
Parameter<size_t> serialization_buffer_size_;
// Session mode state (held to keep shared backends alive)
std::shared_ptr<InMemoryPubSubSession> session_;
std::shared_ptr<nvidia::gxf::PubSubDiscovery> discovery_frontend_;
std::shared_ptr<nvidia::gxf::PubSubTransport> transport_frontend_;
std::shared_ptr<nvidia::gxf::InMemorySerializer> serializer_;
std::shared_ptr<UcxHoloscanComponentSerializer> holoscan_component_serializer_;
std::shared_ptr<StdComponentSerializer> std_component_serializer_;
std::shared_ptr<StdEntitySerializer> std_entity_serializer_;
std::shared_ptr<SerializationBuffer> serialize_buffer_;
std::shared_ptr<SerializationBuffer> deserialize_buffer_;
std::shared_ptr<StdPubSubEntitySerializer> delegate_serializer_;
};
} // namespace holoscan
#endif// HOLOSCAN_PUBSUB_IN_MEMORY_NETWORK_CONTEXTS_GXF_IN_MEMORY_PUBSUB_NETWORK_CONTEXT_HPP