Program Listing for File ReadCondition.hpp

Return to documentation for file (/tmp/ws/src/fastrtps/include/fastdds/dds/subscriber/ReadCondition.hpp)

// Copyright 2022 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// 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 _FASTDDS_DDS_SUBSCRIBER_READCONDITION_HPP_
#define _FASTDDS_DDS_SUBSCRIBER_READCONDITION_HPP_

#include <cassert>

#include <fastdds/dds/core/condition/Condition.hpp>
#include <fastdds/dds/subscriber/InstanceState.hpp>
#include <fastdds/dds/subscriber/SampleState.hpp>
#include <fastdds/dds/subscriber/ViewState.hpp>
#include <fastrtps/fastrtps_dll.h>

namespace eprosima {
namespace fastdds {
namespace dds {

namespace detail {

class ReadConditionImpl;

} // namespace detail

class DataReader;

class ReadCondition : public Condition
{
    friend class detail::ReadConditionImpl;

public:

    ReadCondition();

    ~ReadCondition() override;

    // Non-copyable
    ReadCondition(
            const ReadCondition&) = delete;
    ReadCondition& operator =(
            const ReadCondition&) = delete;

    // Non-movable
    ReadCondition(
            ReadCondition&&) = delete;
    ReadCondition& operator =(
            ReadCondition&&) = delete;

    RTPS_DllAPI bool get_trigger_value() const noexcept override;

    RTPS_DllAPI DataReader* get_datareader() const noexcept;

    RTPS_DllAPI SampleStateMask get_sample_state_mask() const noexcept;

    RTPS_DllAPI ViewStateMask get_view_state_mask() const noexcept;

    RTPS_DllAPI InstanceStateMask get_instance_state_mask() const noexcept;

    detail::ReadConditionImpl* get_impl() const noexcept
    {
        assert((bool)impl_);
        return impl_.get();
    }

protected:

    std::shared_ptr<detail::ReadConditionImpl> impl_;

};

} // namespace dds
} // namespace fastdds
} // namespace eprosima

#endif // _FASTDDS_DDS_SUBSCRIBER_READCONDITION_HPP_