Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
UERANSIM
Commits
0d8eed32
Commit
0d8eed32
authored
May 17, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
L3 RRC/NAS developments
parent
db31bdad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
src/lib/nas/storage.hpp
src/lib/nas/storage.hpp
+17
-16
No files found.
src/lib/nas/storage.hpp
View file @
0d8eed32
...
@@ -43,39 +43,30 @@ class NasListT1
...
@@ -43,39 +43,30 @@ class NasListT1
public:
public:
void
add
(
const
T
&
item
)
void
add
(
const
T
&
item
)
{
{
touch
();
autoClearIfNecessary
();
autoClearIfNecessary
();
remove
(
item
);
remove
(
item
);
makeSlotForNewItem
();
makeSlotForNewItem
();
m_data
[
m_size
]
=
item
;
m_data
[
m_size
]
=
item
;
m_size
++
;
m_size
++
;
touch
();
}
}
void
add
(
T
&&
item
)
void
add
(
T
&&
item
)
{
{
touch
();
autoClearIfNecessary
();
autoClearIfNecessary
();
remove
(
item
);
remove
(
item
);
makeSlotForNewItem
();
makeSlotForNewItem
();
m_data
[
m_size
]
=
std
::
move
(
item
);
m_data
[
m_size
]
=
std
::
move
(
item
);
m_size
++
;
m_size
++
;
}
bool
contains
(
const
T
&
item
)
{
autoClearIfNecessary
();
for
(
size_t
i
=
0
;
i
<
m_size
;
i
++
)
touch
();
if
(
m_data
[
i
]
==
item
)
return
true
;
return
false
;
}
}
void
remove
(
const
T
&
item
)
void
remove
(
const
T
&
item
)
{
{
touch
();
autoClearIfNecessary
();
autoClearIfNecessary
();
size_t
index
=
~
0u
;
size_t
index
=
~
0u
;
...
@@ -92,6 +83,16 @@ class NasListT1
...
@@ -92,6 +83,16 @@ class NasListT1
removeAt
(
index
);
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
>
template
<
typename
Functor
>
void
forEach
(
Functor
&&
fun
)
void
forEach
(
Functor
&&
fun
)
{
{
...
@@ -104,24 +105,24 @@ class NasListT1
...
@@ -104,24 +105,24 @@ class NasListT1
template
<
typename
Functor
>
template
<
typename
Functor
>
void
mutateForEach
(
Functor
&&
fun
)
void
mutateForEach
(
Functor
&&
fun
)
{
{
touch
();
autoClearIfNecessary
();
autoClearIfNecessary
();
for
(
size_t
i
=
0
;
i
<
m_size
;
i
++
)
for
(
size_t
i
=
0
;
i
<
m_size
;
i
++
)
fun
(
m_data
[
i
]);
fun
(
m_data
[
i
]);
touch
();
}
}
void
clear
()
void
clear
()
{
{
touch
();
int64_t
currentTime
=
::
utils
::
CurrentTimeMillis
();
int64_t
currentTime
=
::
utils
::
CurrentTimeMillis
();
if
(
currentTime
-
m_lastAutoCleared
>=
m_autoClearingPeriod
)
if
(
currentTime
-
m_lastAutoCleared
>=
m_autoClearingPeriod
)
m_lastAutoCleared
=
currentTime
;
m_lastAutoCleared
=
currentTime
;
m_data
.
clear
();
m_data
.
clear
();
m_size
=
0
;
m_size
=
0
;
touch
();
}
}
[[
nodiscard
]]
size_t
size
()
const
[[
nodiscard
]]
size_t
size
()
const
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment