Program Listing for File WriterAttributes.hpp

Return to documentation for file (include/fastdds/rtps/attributes/WriterAttributes.hpp)

// Copyright 2016 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_RTPS_ATTRIBUTES__WRITERATTRIBUTES_HPP
#define FASTDDS_RTPS_ATTRIBUTES__WRITERATTRIBUTES_HPP

#include <functional>

#include <fastdds/dds/core/policy/QosPolicies.hpp>
#include <fastdds/rtps/attributes/EndpointAttributes.hpp>
#include <fastdds/rtps/common/Guid.hpp>
#include <fastdds/rtps/common/Time_t.hpp>
#include <fastdds/rtps/flowcontrol/FlowControllerConsts.hpp>
#include <fastdds/utils/collections/ResourceLimitedContainerConfig.hpp>

namespace eprosima {
namespace fastdds {
namespace rtps {

typedef enum RTPSWriterPublishMode : octet
{
    SYNCHRONOUS_WRITER,
    ASYNCHRONOUS_WRITER
} RTPSWriterPublishMode;


struct WriterTimes
{
    bool operator ==(
            const WriterTimes& b) const
    {
        return (initial_heartbeat_delay == b.initial_heartbeat_delay) &&
               (heartbeat_period == b.heartbeat_period) &&
               (nack_response_delay == b.nack_response_delay) &&
               (nack_supression_duration == b.nack_supression_duration);
    }

    dds::Duration_t initial_heartbeat_delay {0, 12 * 1000 * 1000};
    dds::Duration_t heartbeat_period {3, 0};
    dds::Duration_t nack_response_delay {0, 5 * 1000 * 1000};
    dds::Duration_t nack_supression_duration {0, 0};

};

class WriterAttributes
{
public:

    WriterAttributes()
        : liveliness_kind(fastdds::dds::LivelinessQosPolicyKind::AUTOMATIC_LIVELINESS_QOS)
        , liveliness_lease_duration(TIME_T_INFINITE_SECONDS, TIME_T_INFINITE_NANOSECONDS)
        , liveliness_announcement_period(TIME_T_INFINITE_SECONDS, TIME_T_INFINITE_NANOSECONDS)
        , mode(SYNCHRONOUS_WRITER)
        , disable_heartbeat_piggyback(false)
        , disable_positive_acks(false)
        , keep_duration(TIME_T_INFINITE_SECONDS, TIME_T_INFINITE_NANOSECONDS)
    {
        endpoint.endpointKind = WRITER;
        endpoint.durabilityKind = TRANSIENT_LOCAL;
        endpoint.reliabilityKind = RELIABLE;
    }

    virtual ~WriterAttributes()
    {
    }

    EndpointAttributes endpoint;

    WriterTimes times;

    fastdds::dds::LivelinessQosPolicyKind liveliness_kind;

    dds::Duration_t liveliness_lease_duration;

    dds::Duration_t liveliness_announcement_period;

    RTPSWriterPublishMode mode;

    bool disable_heartbeat_piggyback;

    ResourceLimitedContainerConfig matched_readers_allocation;

    bool disable_positive_acks;

    dds::Duration_t keep_duration;

    std::string flow_controller_name = fastdds::rtps::FASTDDS_FLOW_CONTROLLER_DEFAULT;

    bool separate_sending = false;
};

} // namespace rtps
} // namespace fastdds
} // namespace eprosima

#endif // FASTDDS_RTPS_ATTRIBUTES__WRITERATTRIBUTES_HPP