Program Listing for File DataReader.hpp

Return to documentation for file (/tmp/ws/src/fastrtps/include/dds/sub/DataReader.hpp)

/*
 * Copyright 2020, 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 OMG_DDS_SUB_DATAREADER_HPP_
#define OMG_DDS_SUB_DATAREADER_HPP_

#include <dds/sub/detail/DataReader.hpp>

#include <dds/core/Entity.hpp>
#include <dds/sub/qos/DataReaderQos.hpp>
#include <dds/sub/Subscriber.hpp>

namespace dds {
namespace sub {

class DataReaderListener;

//TODO: [ILG] Decide if we need to templatize the DataReader and derive from a AnyDataReader

class DataReader : public dds::core::TEntity<detail::DataReader>
{
public:

    typedef DataReaderListener Listener;

    OMG_DDS_REF_TYPE_PROTECTED_DC(
        DataReader,
        dds::core::TEntity,
        detail::DataReader)

    OMG_DDS_IMPLICIT_REF_BASE(
        DataReader)


    OMG_DDS_API DataReader(
            const dds::sub::Subscriber& sub,
            const dds::topic::Topic& topic);

    OMG_DDS_API DataReader(
            const dds::sub::Subscriber& sub,
            const dds::topic::Topic& topic,
            const qos::DataReaderQos& qos,
            DataReaderListener* listener = NULL,
            const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none());

    virtual OMG_DDS_API ~DataReader();
    //==========================================================================

    OMG_DDS_API const qos::DataReaderQos& qos() const;


    OMG_DDS_API void qos(
            const qos::DataReaderQos& qos);

    OMG_DDS_API DataReader& operator <<(
            const qos::DataReaderQos& qos);

    OMG_DDS_API DataReader& operator >>(
            qos::DataReaderQos& qos);

    //==========================================================================

    OMG_DDS_API void listener(
            Listener* plistener,
            const dds::core::status::StatusMask& mask);

    OMG_DDS_API Listener* listener() const;

    OMG_DDS_API const dds::sub::Subscriber& subscriber() const;

    dds::sub::Subscriber* subscriber_;

};

} //namespace sub
} //namespace dds

#endif //OMG_DDS_SUB_DATAREADER_HPP_