/src/Fast-DDS/include/fastdds/rtps/history/IChangePool.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright 2020 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 IChangePool.hpp |
17 | | */ |
18 | | |
19 | | #ifndef FASTDDS_RTPS_HISTORY__ICHANGEPOOL_HPP |
20 | | #define FASTDDS_RTPS_HISTORY__ICHANGEPOOL_HPP |
21 | | |
22 | | namespace eprosima { |
23 | | namespace fastdds { |
24 | | namespace rtps { |
25 | | |
26 | | struct CacheChange_t; |
27 | | |
28 | | /** |
29 | | * An interface for classes responsible of cache changes allocation management. |
30 | | */ |
31 | | class IChangePool |
32 | | { |
33 | | public: |
34 | | |
35 | 0 | virtual ~IChangePool() = default; |
36 | | |
37 | | /** |
38 | | * @brief Get a new cache change from the pool |
39 | | * |
40 | | * @param [out] cache_change Pointer to the new cache change. |
41 | | * |
42 | | * @returns whether the operation succeeded or not |
43 | | * |
44 | | * @pre @c cache_change is @c nullptr |
45 | | * |
46 | | * @post |
47 | | * @li @c cache_change is not nullptr |
48 | | * @li @c *cache_change equals @c CacheChange_t() except for the contents of @c serializedPayload |
49 | | */ |
50 | | virtual bool reserve_cache( |
51 | | CacheChange_t*& cache_change) = 0; |
52 | | |
53 | | /** |
54 | | * @brief Return a cache change to the pool |
55 | | * |
56 | | * @param [in] cache_change Pointer to the cache change to release. |
57 | | * |
58 | | * @returns whether the operation succeeded or not |
59 | | * |
60 | | * @pre |
61 | | * @li @c cache_change is not @c nullptr |
62 | | * @li @c cache_change points to a cache change obtained from a call to @c this->reserve_cache |
63 | | */ |
64 | | virtual bool release_cache( |
65 | | CacheChange_t* cache_change) = 0; |
66 | | }; |
67 | | |
68 | | } // namespace rtps |
69 | | } // namespace fastdds |
70 | | } // namespace eprosima |
71 | | |
72 | | |
73 | | #endif // FASTDDS_RTPS_HISTORY__ICHANGEPOOL_HPP |