1#ifndef H_EXTENSIONS_CUTEHMI_MODBUS_4_INCLUDE_CUTEHMI_MODBUS_INTERNAL_DATACONTAINER_HPP
2#define H_EXTENSIONS_CUTEHMI_MODBUS_4_INCLUDE_CUTEHMI_MODBUS_INTERNAL_DATACONTAINER_HPP
4#include <QReadWriteLock>
18template <
typename T, std::
size_t N = 65536>
49 KeysContainer::value_type
next();
51 KeysContainer::value_type
previous();
56 KeysContainer::const_iterator m_it;
78 const T *
at(
std::
size_t i) const;
89 T *
at(
std::
size_t i);
151template <typename T,
std::
size_t N>
154 m_keysContainer(& container->
keys()),
155 m_it(container->
keys().begin())
159template <
typename T, std::
size_t N>
164 return m_it != m_keysContainer->end();
167template <
typename T, std::
size_t N>
175template <
typename T, std::
size_t N>
183template <
typename T, std::
size_t N>
190template <
typename T, std::
size_t N>
196 return m_array.size();
200template <
typename T, std::
size_t N>
205 return m_array.at(i);
208template <
typename T, std::
size_t N>
213 return m_array.at(i);
216template <
typename T, std::
size_t N>
224 result = m_array.at(i);
227 if (result ==
nullptr) {
231 result = m_array.at(i);
233 if (result ==
nullptr) {
243template <
typename T, std::
size_t N>
252template <
typename T, std::
size_t N>
259 std::fill(m_array.begin(), m_array.end(),
nullptr);
262template <
typename T, std::
size_t N>
268 delete m_array.at(*it);
272 std::fill(m_array.begin(), m_array.end(),
nullptr);
275template <
typename T, std::
size_t N>
281template <
typename T, std::
size_t N>
287template <
typename T, std::
size_t N>
290 KeysContainer::iterator it = m_keys.begin();
291 while (it != m_keys.end()) {
298 m_keys.insert(it, i);
Keys iterator.
Definition: DataContainer.hpp:43
KeysIterator(const DataContainer< T, N > *container)
Definition: DataContainer.hpp:152
KeysContainer::value_type next()
Definition: DataContainer.hpp:168
bool hasNext() const
Definition: DataContainer.hpp:160
KeysContainer::value_type previous()
Definition: DataContainer.hpp:176
Data container.
Definition: DataContainer.hpp:20
const T * at(std::size_t i) const
Get value at given index.
Definition: DataContainer.hpp:201
const T * const_pointer
Definition: DataContainer.hpp:29
static constexpr std::size_t ADDRESS_SPACE
Definition: DataContainer.hpp:36
T * value(std::size_t i)
Get value at given index.
Definition: DataContainer.hpp:217
void clear()
Clear container.
Definition: DataContainer.hpp:253
const KeysContainer & keys() const
Get keys container.
Definition: DataContainer.hpp:276
InternalContainer m_array
Definition: DataContainer.hpp:146
void insertKey(std::size_t i)
Definition: DataContainer.hpp:288
T * pointer
Definition: DataContainer.hpp:28
std::list< std::size_t > KeysContainer
Definition: DataContainer.hpp:33
KeysContainer m_keys
Definition: DataContainer.hpp:147
QReadWriteLock m_lock
Definition: DataContainer.hpp:148
const T & const_reference
Definition: DataContainer.hpp:27
DataContainer()
Definition: DataContainer.hpp:185
T & reference
Definition: DataContainer.hpp:26
void free()
Delete container contents.
Definition: DataContainer.hpp:263
void insert(std::size_t i, T *value)
Insert value.
Definition: DataContainer.hpp:244
QReadWriteLock & lock() const
Definition: DataContainer.hpp:282
T value_type
Definition: DataContainer.hpp:25
constexpr std::size_t size() const noexcept
Get container size.
Definition: DataContainer.hpp:191