|
CuteHMI - Modbus (CuteHMI.Modbus.2)
|
1 #ifndef H_EXTENSIONS_CUTEHMI_MODBUS_2_INCLUDE_CUTEHMI_MODBUS_INTERNAL_DATACONTAINER_HPP
2 #define H_EXTENSIONS_CUTEHMI_MODBUS_2_INCLUDE_CUTEHMI_MODBUS_INTERNAL_DATACONTAINER_HPP
7 #include <QReadWriteLock>
20 template <
typename T, std::
size_t N = 65536>
79 const T *
at(
std::
size_t i) const;
90 T *
at(
std::
size_t i);
152 template <typename T,
std::
size_t N>
155 m_it(container->
keys())
159 template <
typename T, std::
size_t N>
164 return m_it.hasNext();
167 template <
typename T, std::
size_t N>
175 template <
typename T, std::
size_t N>
180 return m_it.previous();
183 template <
typename T, std::
size_t N>
190 template <
typename T, std::
size_t N>
196 return m_array.size();
200 template <
typename T, std::
size_t N>
205 return m_array.at(i);
208 template <
typename T, std::
size_t N>
213 return m_array.at(i);
216 template <
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) {
243 template <
typename T, std::
size_t N>
252 template <
typename T, std::
size_t N>
259 std::fill(m_array.begin(), m_array.end(),
nullptr);
262 template <
typename T, std::
size_t N>
268 delete m_array.at(*it);
272 std::fill(m_array.begin(), m_array.end(),
nullptr);
275 template <
typename T, std::
size_t N>
281 template <
typename T, std::
size_t N>
287 template <
typename T, std::
size_t N>
291 while (it != m_keys.end()) {
298 m_keys.insert(it, i);
QReadWriteLock & lock() const
Definition: DataContainer.hpp:282
bool hasNext() const
Definition: DataContainer.hpp:160
constexpr std::size_t size() const noexcept
Get container size.
Definition: DataContainer.hpp:191
const typedef T * const_pointer
Definition: DataContainer.hpp:31
KeysContainer::value_type previous()
Definition: DataContainer.hpp:176
void insertKey(std::size_t i)
Definition: DataContainer.hpp:288
void free()
Delete container contents.
Definition: DataContainer.hpp:263
KeysIterator(const DataContainer< T, N > *container)
Definition: DataContainer.hpp:153
KeysContainer::value_type next()
Definition: DataContainer.hpp:168
QLinkedList< std::size_t > KeysContainer
Definition: DataContainer.hpp:35
QReadWriteLock m_lock
Definition: DataContainer.hpp:149
DataContainer()
Definition: DataContainer.hpp:185
Keys iterator.
Definition: DataContainer.hpp:44
const typedef T & const_reference
Definition: DataContainer.hpp:29
void clear()
Clear container.
Definition: DataContainer.hpp:253
static constexpr std::size_t ADDRESS_SPACE
Definition: DataContainer.hpp:38
InternalContainer m_array
Definition: DataContainer.hpp:147
void insert(std::size_t i, T *value)
Insert value.
Definition: DataContainer.hpp:244
T value_type
Definition: DataContainer.hpp:27
const T * at(std::size_t i) const
Get value at given index.
Definition: DataContainer.hpp:201
const KeysContainer & keys() const
Get keys container.
Definition: DataContainer.hpp:276
Data container.
Definition: DataContainer.hpp:21
KeysContainer m_keys
Definition: DataContainer.hpp:148
T * pointer
Definition: DataContainer.hpp:30
T * value(std::size_t i)
Get value at given index.
Definition: DataContainer.hpp:217
T & reference
Definition: DataContainer.hpp:28