Program Listing for File TransportDescriptorInterface.h

Return to documentation for file (/tmp/ws/src/fastrtps/include/fastdds/rtps/transport/TransportDescriptorInterface.h)

// 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_TRANSPORT_DESCRIPTOR_INTERFACE_H_
#define _FASTDDS_TRANSPORT_DESCRIPTOR_INTERFACE_H_

#include <fastrtps/fastrtps_dll.h>

#ifdef _WIN32
#include <cstdint>
#endif // ifdef _WIN32
#include <vector>
#include <string>

namespace eprosima {
namespace fastdds {
namespace rtps {

class TransportInterface;

struct RTPS_DllAPI TransportDescriptorInterface
{
    TransportDescriptorInterface(
            uint32_t maximumMessageSize,
            uint32_t maximumInitialPeersRange)
        : maxMessageSize(maximumMessageSize)
        , maxInitialPeersRange(maximumInitialPeersRange)
    {
    }

    TransportDescriptorInterface(
            const TransportDescriptorInterface& t) = default;

    TransportDescriptorInterface& operator =(
            const TransportDescriptorInterface& t) = default;

    virtual ~TransportDescriptorInterface() = default;

    virtual TransportInterface* create_transport() const = 0;

    virtual uint32_t min_send_buffer_size() const = 0;

    virtual uint32_t max_message_size() const
    {
        return maxMessageSize;
    }

    virtual uint32_t max_initial_peers_range() const
    {
        return maxInitialPeersRange;
    }

    bool operator ==(
            const TransportDescriptorInterface& t) const
    {
        return (this->maxMessageSize == t.max_message_size() &&
               this->maxInitialPeersRange == t.max_initial_peers_range());
    }

    uint32_t maxMessageSize;

    uint32_t maxInitialPeersRange;
};

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

#endif // _FASTDDS_TRANSPORT_DESCRIPTOR_INTERFACE_H_