Program Listing for File Publisher.hpp

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

/*
 * Copyright 2010, Object Management Group, Inc.
 * Copyright 2010, PrismTech, Corp.
 * Copyright 2010, Real-Time Innovations, Inc.
 * Copyright 2019, 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_PUB_PUBLISHER_HPP_
#define OMG_DDS_PUB_PUBLISHER_HPP_

#include <dds/pub/detail/Publisher.hpp>

#include <dds/core/Entity.hpp>
#include <dds/pub/qos/DataWriterQos.hpp>
#include <dds/pub/qos/PublisherQos.hpp>
#include <dds/domain/DomainParticipant.hpp>

namespace dds {
namespace pub {

class PublisherListener;

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

    typedef PublisherListener Listener;

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

    OMG_DDS_IMPLICIT_REF_BASE(
        Publisher)


    OMG_DDS_API Publisher(
            const dds::domain::DomainParticipant& dp);

    OMG_DDS_API Publisher(
            const dds::domain::DomainParticipant& dp,
            const qos::PublisherQos& qos,
            PublisherListener* listener = NULL,
            const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none());

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

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


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

    OMG_DDS_API Publisher& operator <<(
            const qos::PublisherQos& qos);

    OMG_DDS_API Publisher& operator >>(
            qos::PublisherQos& qos);

    OMG_DDS_API Publisher& default_datawriter_qos(
            const qos::DataWriterQos& qos);

    OMG_DDS_API qos::DataWriterQos default_datawriter_qos() const;

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

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

    OMG_DDS_API Listener* listener() const;

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

    OMG_DDS_API void wait_for_acknowledgments(
            const dds::core::Duration& timeout);

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

    OMG_DDS_API const dds::domain::DomainParticipant& participant() const;

    const dds::domain::DomainParticipant* participant_;

};

} //namespace pub
} //namespace dds

#endif //OMG_DDS_PUB_PUBLISHER_HPP_