iceoryx_posh 2.0.3
mepoo_config.hpp
1// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
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// SPDX-License-Identifier: Apache-2.0
16#ifndef IOX_POSH_MEPOO_MEPOO_CONFIG_HPP
17#define IOX_POSH_MEPOO_MEPOO_CONFIG_HPP
18
19#include "iceoryx_hoofs/cxx/vector.hpp"
20#include "iceoryx_posh/iceoryx_posh_types.hpp"
21
22#include <cstdint>
23
24namespace iox
25{
26namespace roudi
27{
28class PortManager;
29}
30namespace mepoo
31{
33{
34 public:
35 struct Entry
36 {
38 Entry(uint32_t f_size, uint32_t f_chunkCount) noexcept
39 : m_size(f_size)
40 , m_chunkCount(f_chunkCount)
41 {
42 }
43 uint32_t m_size{0};
44 uint32_t m_chunkCount{0};
45 };
46
47 using MePooConfigContainerType = cxx::vector<Entry, MAX_NUMBER_OF_MEMPOOLS>;
48 MePooConfigContainerType m_mempoolConfig;
49
51 MePooConfig() noexcept = default;
52
55 const MePooConfigContainerType* getMemPoolConfig() const noexcept;
56
59 void addMemPool(Entry f_entry) noexcept;
60
63
65 MePooConfig& optimize() noexcept;
66};
67
68} // namespace mepoo
69} // namespace iox
70
71#endif // IOX_POSH_MEPOO_MEPOO_CONFIG_HPP
Definition: mepoo_config.hpp:36
Entry(uint32_t f_size, uint32_t f_chunkCount) noexcept
set the size and count of memory chunks
Definition: mepoo_config.hpp:38
Definition: mepoo_config.hpp:33
void addMemPool(Entry f_entry) noexcept
Function for adding new entry.
MePooConfig() noexcept=default
Default constructor to set the configuration for memory pools.
MePooConfig & optimize() noexcept
Function for optimizing the size of memory pool according to new entry.
MePooConfig & setDefaults() noexcept
Function for creating default memory pools.
const MePooConfigContainerType * getMemPoolConfig() const noexcept
Get function for receiving memory pool configuration.