Program Listing for File Publisher.hpp

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

// 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 _FASTDDS_PUBLISHER_HPP_
#define _FASTDDS_PUBLISHER_HPP_

#include <fastdds/dds/core/Entity.hpp>
#include <fastdds/dds/publisher/qos/DataWriterQos.hpp>
#include <fastdds/dds/publisher/qos/PublisherQos.hpp>
#include <fastdds/dds/topic/TypeSupport.hpp>
#include <fastdds/rtps/common/Time_t.h>

#include <fastrtps/fastrtps_dll.h>
#include <fastrtps/types/TypesBase.h>

using eprosima::fastrtps::types::ReturnCode_t;

namespace dds {
namespace pub {
class Publisher;
} // namespace pub
} // namespace dds

namespace eprosima {
namespace fastrtps {

class TopicAttributes;

} // namespace fastrtps

namespace fastdds {
namespace dds {

class DomainParticipant;
class PublisherListener;
class PublisherImpl;
class DataWriter;
class DataWriterListener;
class Topic;

class Publisher : public DomainEntity
{
protected:

    friend class PublisherImpl;
    friend class DomainParticipantImpl;

    Publisher(
            PublisherImpl* p,
            const StatusMask& mask = StatusMask::all());

    Publisher(
            DomainParticipant* dp,
            const PublisherQos& qos = PUBLISHER_QOS_DEFAULT,
            PublisherListener* listener = nullptr,
            const StatusMask& mask = StatusMask::all());

public:

    virtual ~Publisher();

    RTPS_DllAPI ReturnCode_t enable() override;

    RTPS_DllAPI const PublisherQos& get_qos() const;

    RTPS_DllAPI ReturnCode_t get_qos(
            PublisherQos& qos) const;

    RTPS_DllAPI ReturnCode_t set_qos(
            const PublisherQos& qos);

    RTPS_DllAPI const PublisherListener* get_listener() const;

    RTPS_DllAPI ReturnCode_t set_listener(
            PublisherListener* listener);

    RTPS_DllAPI ReturnCode_t set_listener(
            PublisherListener* listener,
            const StatusMask& mask);

    RTPS_DllAPI DataWriter* create_datawriter(
            Topic* topic,
            const DataWriterQos& qos,
            DataWriterListener* listener = nullptr,
            const StatusMask& mask = StatusMask::all());

    RTPS_DllAPI DataWriter* create_datawriter_with_profile(
            Topic* topic,
            const std::string& profile_name,
            DataWriterListener* listener = nullptr,
            const StatusMask& mask = StatusMask::all());

    RTPS_DllAPI ReturnCode_t delete_datawriter(
            const DataWriter* writer);

    RTPS_DllAPI DataWriter* lookup_datawriter(
            const std::string& topic_name) const;

    RTPS_DllAPI ReturnCode_t suspend_publications();

    RTPS_DllAPI ReturnCode_t resume_publications();

    RTPS_DllAPI ReturnCode_t begin_coherent_changes();

    RTPS_DllAPI ReturnCode_t end_coherent_changes();

    RTPS_DllAPI ReturnCode_t wait_for_acknowledgments(
            const fastrtps::Duration_t& max_wait);

    RTPS_DllAPI const DomainParticipant* get_participant() const;

    RTPS_DllAPI ReturnCode_t delete_contained_entities();

    RTPS_DllAPI ReturnCode_t set_default_datawriter_qos(
            const DataWriterQos& qos);

    RTPS_DllAPI const DataWriterQos& get_default_datawriter_qos() const;

    RTPS_DllAPI ReturnCode_t get_default_datawriter_qos(
            DataWriterQos& qos) const;

    RTPS_DllAPI ReturnCode_t copy_from_topic_qos(
            fastdds::dds::DataWriterQos& writer_qos,
            const fastdds::dds::TopicQos& topic_qos) const;

    RTPS_DllAPI ReturnCode_t get_datawriter_qos_from_profile(
            const std::string& profile_name,
            DataWriterQos& qos) const;

    RTPS_DllAPI const InstanceHandle_t& get_instance_handle() const;

    RTPS_DllAPI bool get_datawriters(
            std::vector<DataWriter*>& writers) const;

    RTPS_DllAPI bool has_datawriters() const;

protected:

    PublisherImpl* impl_;

    friend class ::dds::pub::Publisher;
};

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

#endif /* _FASTDDS_PUBLISHER_HPP_ */