/src/Fast-DDS/include/fastdds/rtps/attributes/HistoryAttributes.hpp
Line | Count | Source (jump to first uncovered line) |
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 | | /** |
16 | | * @file HistoryAttributes.hpp |
17 | | * |
18 | | */ |
19 | | |
20 | | #ifndef FASTDDS_RTPS_ATTRIBUTES__HISTORYATTRIBUTES_HPP |
21 | | #define FASTDDS_RTPS_ATTRIBUTES__HISTORYATTRIBUTES_HPP |
22 | | |
23 | | #include <fastdds/rtps/attributes/ResourceManagement.hpp> |
24 | | #include <fastdds/fastdds_dll.hpp> |
25 | | |
26 | | #include <cstdint> |
27 | | |
28 | | namespace eprosima { |
29 | | namespace fastdds { |
30 | | namespace rtps { |
31 | | |
32 | | /** |
33 | | * Class HistoryAttributes, to specify the attributes of a WriterHistory or a ReaderHistory. |
34 | | * This class is only intended to be used with the RTPS API. |
35 | | * The Publisher-Subscriber API has other fields to define this values (HistoryQosPolicy and ResourceLimitsQosPolicy). |
36 | | * @ingroup RTPS_ATTRIBUTES_MODULE |
37 | | */ |
38 | | class FASTDDS_EXPORTED_API HistoryAttributes |
39 | | { |
40 | | public: |
41 | | |
42 | | //!Memory management policy. |
43 | | MemoryManagementPolicy_t memoryPolicy; |
44 | | |
45 | | //!Maximum payload size of the history, default value 500. |
46 | | uint32_t payloadMaxSize; |
47 | | |
48 | | //!Number of the initial Reserved Caches, default value 500. |
49 | | int32_t initialReservedCaches; |
50 | | |
51 | | /** |
52 | | * Maximum number of reserved caches. Default value is 0 that indicates to keep reserving until something |
53 | | * breaks. |
54 | | */ |
55 | | int32_t maximumReservedCaches; |
56 | | |
57 | | /** |
58 | | * Number of extra caches that can be reserved for other purposes than the history. |
59 | | * For example, on a full history, the writer could give as many as these to be used by the application |
60 | | * but they will not be able to be inserted in the history unless some cache from the history is released. |
61 | | * |
62 | | * Default value is 1. |
63 | | */ |
64 | | int32_t extraReservedCaches; |
65 | | |
66 | | //! Default constructor |
67 | | HistoryAttributes() |
68 | 0 | : memoryPolicy(PREALLOCATED_WITH_REALLOC_MEMORY_MODE) |
69 | 0 | , payloadMaxSize(500) |
70 | 0 | , initialReservedCaches(500) |
71 | 0 | , maximumReservedCaches(0) |
72 | 0 | , extraReservedCaches(1) |
73 | 0 | { |
74 | 0 | } |
75 | | |
76 | | /** Constructor |
77 | | * @param memoryPolicy Set whether memory can be dynamically reallocated or not |
78 | | * @param payload Maximum payload size. It is used when memory management policy is |
79 | | * PREALLOCATED_MEMORY_MODE or PREALLOCATED_WITH_REALLOC_MEMORY_MODE. |
80 | | * @param initial Initial reserved caches. It is used when memory management policy is |
81 | | * PREALLOCATED_MEMORY_MODE or PREALLOCATED_WITH_REALLOC_MEMORY_MODE. |
82 | | * @param maxRes Maximum reserved caches. |
83 | | */ |
84 | | HistoryAttributes( |
85 | | MemoryManagementPolicy_t memoryPolicy, |
86 | | uint32_t payload, |
87 | | int32_t initial, |
88 | | int32_t maxRes) |
89 | 0 | : memoryPolicy(memoryPolicy) |
90 | 0 | , payloadMaxSize(payload) |
91 | 0 | , initialReservedCaches(initial) |
92 | 0 | , maximumReservedCaches(maxRes) |
93 | 0 | , extraReservedCaches(1) |
94 | 0 | { |
95 | 0 | } |
96 | | |
97 | | /** Constructor |
98 | | * @param memoryPolicy Set whether memory can be dynamically reallocated or not |
99 | | * @param payload Maximum payload size. It is used when memory management policy is |
100 | | * PREALLOCATED_MEMORY_MODE or PREALLOCATED_WITH_REALLOC_MEMORY_MODE. |
101 | | * @param initial Initial reserved caches. It is used when memory management policy is |
102 | | * PREALLOCATED_MEMORY_MODE or PREALLOCATED_WITH_REALLOC_MEMORY_MODE. |
103 | | * @param maxRes Maximum reserved caches. |
104 | | * @param extra Extra reserved caches. |
105 | | */ |
106 | | HistoryAttributes( |
107 | | MemoryManagementPolicy_t memoryPolicy, |
108 | | uint32_t payload, |
109 | | int32_t initial, |
110 | | int32_t maxRes, |
111 | | int32_t extra) |
112 | 0 | : memoryPolicy(memoryPolicy) |
113 | 0 | , payloadMaxSize(payload) |
114 | 0 | , initialReservedCaches(initial) |
115 | 0 | , maximumReservedCaches(maxRes) |
116 | 0 | , extraReservedCaches(extra) |
117 | 0 | { |
118 | 0 | } |
119 | | |
120 | | virtual ~HistoryAttributes() |
121 | 0 | { |
122 | 0 | } |
123 | | |
124 | | }; |
125 | | |
126 | | } // namespace rtps |
127 | | } // namespace fastdds |
128 | | } // namespace eprosima |
129 | | |
130 | | #endif // FASTDDS_RTPS_ATTRIBUTES__HISTORYATTRIBUTES_HPP |