Commit 0d8eed32 authored by aligungr's avatar aligungr

L3 RRC/NAS developments

parent db31bdad
......@@ -43,39 +43,30 @@ class NasListT1
public:
void add(const T &item)
{
touch();
autoClearIfNecessary();
remove(item);
makeSlotForNewItem();
m_data[m_size] = item;
m_size++;
touch();
}
void add(T &&item)
{
touch();
autoClearIfNecessary();
remove(item);
makeSlotForNewItem();
m_data[m_size] = std::move(item);
m_size++;
}
bool contains(const T &item)
{
autoClearIfNecessary();
for (size_t i = 0; i < m_size; i++)
if (m_data[i] == item)
return true;
return false;
touch();
}
void remove(const T &item)
{
touch();
autoClearIfNecessary();
size_t index = ~0u;
......@@ -92,6 +83,16 @@ class NasListT1
removeAt(index);
}
bool contains(const T &item)
{
autoClearIfNecessary();
for (size_t i = 0; i < m_size; i++)
if (m_data[i] == item)
return true;
return false;
}
template <typename Functor>
void forEach(Functor &&fun)
{
......@@ -104,24 +105,24 @@ class NasListT1
template <typename Functor>
void mutateForEach(Functor &&fun)
{
touch();
autoClearIfNecessary();
for (size_t i = 0; i < m_size; i++)
fun(m_data[i]);
touch();
}
void clear()
{
touch();
int64_t currentTime = ::utils::CurrentTimeMillis();
if (currentTime - m_lastAutoCleared >= m_autoClearingPeriod)
m_lastAutoCleared = currentTime;
m_data.clear();
m_size = 0;
touch();
}
[[nodiscard]] size_t size() const
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment