/src/Fast-DDS/src/cpp/rtps/reader/ReaderHistoryState.hpp
Line | Count | Source |
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 | | |
15 | | /** |
16 | | * @file ReaderHistoryState.hpp |
17 | | */ |
18 | | |
19 | | #ifndef FASTDDS_RTPS_READER_READERHISTORYSTATE_HPP_ |
20 | | #define FASTDDS_RTPS_READER_READERHISTORYSTATE_HPP_ |
21 | | |
22 | | #include <fastdds/rtps/common/Guid.hpp> |
23 | | #include <fastdds/rtps/common/SequenceNumber.hpp> |
24 | | |
25 | | #include <foonathan/memory/container.hpp> |
26 | | #include <foonathan/memory/memory_pool.hpp> |
27 | | |
28 | | #include "utils/collections/node_size_helpers.hpp" |
29 | | |
30 | | #include <map> |
31 | | |
32 | | namespace eprosima { |
33 | | namespace fastdds { |
34 | | namespace rtps { |
35 | | |
36 | | using guid_map_helper = utilities::collections::map_size_helper<GUID_t, GUID_t>; |
37 | | using guid_count_helper = utilities::collections::map_size_helper<GUID_t, uint16_t>; |
38 | | using history_record_helper = utilities::collections::map_size_helper<GUID_t, SequenceNumber_t>; |
39 | | |
40 | | /** |
41 | | * Class RTPSReader, manages the reception of data from its matched writers. |
42 | | * @ingroup READER_MODULE |
43 | | */ |
44 | | struct ReaderHistoryState |
45 | | { |
46 | | using pool_allocator_t = |
47 | | foonathan::memory::memory_pool<foonathan::memory::node_pool, foonathan::memory::heap_allocator>; |
48 | | |
49 | | explicit ReaderHistoryState( |
50 | | size_t initial_writers_allocation) |
51 | 0 | : persistence_guid_map_allocator( |
52 | 0 | guid_map_helper::node_size, |
53 | 0 | guid_map_helper::min_pool_size<pool_allocator_t>(initial_writers_allocation)) |
54 | 0 | , persistence_guid_count_allocator( |
55 | 0 | guid_count_helper::node_size, |
56 | 0 | guid_count_helper::min_pool_size<pool_allocator_t>(initial_writers_allocation)) |
57 | 0 | , history_record_allocator( |
58 | 0 | history_record_helper::node_size, |
59 | 0 | history_record_helper::min_pool_size<pool_allocator_t>(initial_writers_allocation)) |
60 | 0 | , persistence_guid_map(persistence_guid_map_allocator) |
61 | 0 | , persistence_guid_count(persistence_guid_count_allocator) |
62 | 0 | , history_record(history_record_allocator) |
63 | 0 | { |
64 | 0 | } |
65 | | |
66 | | pool_allocator_t persistence_guid_map_allocator; |
67 | | pool_allocator_t persistence_guid_count_allocator; |
68 | | pool_allocator_t history_record_allocator; |
69 | | |
70 | | //!Physical GUID to persistence GUID map |
71 | | foonathan::memory::map<GUID_t, GUID_t, pool_allocator_t> persistence_guid_map; |
72 | | //!Persistence GUID count map |
73 | | foonathan::memory::map<GUID_t, uint16_t, pool_allocator_t> persistence_guid_count; |
74 | | //!Information about max notified change |
75 | | foonathan::memory::map<GUID_t, SequenceNumber_t, pool_allocator_t> history_record; |
76 | | }; |
77 | | |
78 | | } /* namespace rtps */ |
79 | | } /* namespace fastdds */ |
80 | | } /* namespace eprosima */ |
81 | | |
82 | | #endif /* FASTDDS_RTPS_READER_READERHISTORYSTATE_HPP_ */ |