HistoryAttributes.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // Copyright 2016 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. /**
  15. * @file HistoryAttributes.h
  16. *
  17. */
  18. #ifndef _FASTDDS_HISTORYATTRIBUTES_H_
  19. #define _FASTDDS_HISTORYATTRIBUTES_H_
  20. #include <fastdds/rtps/resources/ResourceManagement.h>
  21. #include <fastrtps/fastrtps_dll.h>
  22. #include <cstdint>
  23. namespace eprosima{
  24. namespace fastrtps{
  25. namespace rtps{
  26. /**
  27. * Class HistoryAttributes, to specify the attributes of a WriterHistory or a ReaderHistory.
  28. * This class is only intended to be used with the RTPS API.
  29. * The Publsiher-Subscriber API has other fields to define this values (HistoryQosPolicy and ResourceLimitsQosPolicy).
  30. * @ingroup RTPS_ATTRIBUTES_MODULE
  31. */
  32. class RTPS_DllAPI HistoryAttributes
  33. {
  34. public:
  35. //!Memory management policy.
  36. MemoryManagementPolicy_t memoryPolicy;
  37. //!Maximum payload size of the history, default value 500.
  38. uint32_t payloadMaxSize;
  39. //!Number of the initial Reserved Caches, default value 500.
  40. int32_t initialReservedCaches;
  41. /**
  42. * Maximum number of reserved caches. Default value is 0 that indicates to keep reserving until something
  43. * breaks.
  44. */
  45. int32_t maximumReservedCaches;
  46. //! Default constructor
  47. HistoryAttributes()
  48. : memoryPolicy(PREALLOCATED_MEMORY_MODE)
  49. , payloadMaxSize(500)
  50. , initialReservedCaches(500)
  51. , maximumReservedCaches(0)
  52. {}
  53. /** Constructor
  54. * @param memoryPolicy Set wether memory can be dynamically reallocated or not
  55. * @param payload Maximum payload size. It is used when memory management polycy is
  56. * PREALLOCATED_MEMORY_MODE or PREALLOCATED_WITH_REALLOC_MEMORY_MODE.
  57. * @param initial Initial reserved caches. It is used when memory management policy is
  58. * PREALLOCATED_MEMORY_MODE or PREALLOCATED_WITH_REALLOC_MEMORY_MODE.
  59. * @param maxRes Maximum reserved caches.
  60. */
  61. HistoryAttributes(
  62. MemoryManagementPolicy_t memoryPolicy,
  63. uint32_t payload,
  64. int32_t initial,
  65. int32_t maxRes)
  66. : memoryPolicy(memoryPolicy)
  67. , payloadMaxSize(payload)
  68. , initialReservedCaches(initial)
  69. , maximumReservedCaches(maxRes)
  70. {}
  71. virtual ~HistoryAttributes(){}
  72. };
  73. }
  74. }
  75. }
  76. #endif /* _FASTDDS_HISTORYATTRIBUTES_H_ */