Program Listing for File publisher_available.hpp
↰ Return to documentation for file (include/holoscan/pubsub/runtime/conditions/publisher_available.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_RUNTIME_CONDITIONS_PUBLISHER_AVAILABLE_HPP
#define HOLOSCAN_PUBSUB_RUNTIME_CONDITIONS_PUBLISHER_AVAILABLE_HPP
#include <atomic>
#include <cstdint>
#include <memory>
#include <holoscan/core/condition.hpp>
#include <holoscan/core/resources/gxf/pubsub_receiver.hpp>
#include <holoscan/core/resources/gxf/receiver.hpp>
namespace holoscan {
class PublisherAvailableCondition : public Condition {
public:
HOLOSCAN_CONDITION_FORWARD_ARGS(PublisherAvailableCondition)
PublisherAvailableCondition() = default;
void setup(ComponentSpec& spec) override;
void initialize() override;
void update_state(int64_t timestamp) override;
void check(int64_t timestamp, SchedulingStatusType* status_type,
int64_t* target_timestamp) const override;
void on_execute(int64_t timestamp) override;
private:
void resolve_pubsub_receiver();
Parameter<std::shared_ptr<Receiver>> receiver_;
Parameter<uint64_t> min_publisher_count_;
Parameter<bool> require_pubsub_connector_;
Parameter<int64_t> poll_period_ms_;
Parameter<bool> latch_ready_;
std::shared_ptr<PubSubReceiver> pubsub_receiver_;
std::atomic<SchedulingStatusType> current_state_{SchedulingStatusType::kWaitTime};
std::atomic<int64_t> target_timestamp_{0};
std::atomic<bool> latched_ready_{false};
};
} // namespace holoscan
#endif/* HOLOSCAN_PUBSUB_RUNTIME_CONDITIONS_PUBLISHER_AVAILABLE_HPP */