TransportDescriptorInterface.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef _FASTDDS_TRANSPORT_DESCRIPTOR_INTERFACE_H_
  15. #define _FASTDDS_TRANSPORT_DESCRIPTOR_INTERFACE_H_
  16. #ifdef _WIN32
  17. #include <cstdint>
  18. #endif
  19. #include <vector>
  20. #include <string>
  21. namespace eprosima{
  22. namespace fastdds{
  23. namespace rtps{
  24. class TransportInterface;
  25. /**
  26. * Virtual base class for the data type used to define transport configuration.
  27. * @ingroup RTPS_MODULE
  28. * */
  29. struct TransportDescriptorInterface
  30. {
  31. TransportDescriptorInterface(uint32_t maximumMessageSize, uint32_t maximumInitialPeersRange)
  32. : maxMessageSize(maximumMessageSize)
  33. , maxInitialPeersRange(maximumInitialPeersRange)
  34. {}
  35. TransportDescriptorInterface(const TransportDescriptorInterface& t)
  36. : maxMessageSize(t.maxMessageSize)
  37. , maxInitialPeersRange(t.maxInitialPeersRange)
  38. {}
  39. virtual ~TransportDescriptorInterface(){}
  40. /**
  41. * Factory method pattern. It will create and return a TransportInterface
  42. * corresponding to this descriptor. This provides an interface to the NetworkFactory
  43. * to create the transports without the need to know about their type
  44. */
  45. virtual TransportInterface* create_transport() const = 0;
  46. //! Returns the minimum size required for a send operation.
  47. virtual uint32_t min_send_buffer_size() const = 0;
  48. //! Returns the maximum size expected for received messages.
  49. virtual uint32_t max_message_size() const { return maxMessageSize; }
  50. virtual uint32_t max_initial_peers_range() const { return maxInitialPeersRange; }
  51. uint32_t maxMessageSize;
  52. uint32_t maxInitialPeersRange;
  53. };
  54. } // namespace rtps
  55. } // namespace fastdds
  56. } // namespace eprosima
  57. #endif // _FASTDDS_TRANSPORT_DESCRIPTOR_INTERFACE_H_