Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
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
cpp-libs
Actor Framework
Commits
1d73fb39
Commit
1d73fb39
authored
Oct 02, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always promote node pointers to the full type
parent
b53a25ea
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
24 deletions
+35
-24
libcaf_core/caf/intrusive/drr_cached_queue.hpp
libcaf_core/caf/intrusive/drr_cached_queue.hpp
+1
-2
libcaf_core/caf/intrusive/drr_queue.hpp
libcaf_core/caf/intrusive/drr_queue.hpp
+0
-7
libcaf_core/caf/intrusive/fifo_inbox.hpp
libcaf_core/caf/intrusive/fifo_inbox.hpp
+1
-1
libcaf_core/caf/intrusive/forward_iterator.hpp
libcaf_core/caf/intrusive/forward_iterator.hpp
+7
-0
libcaf_core/caf/intrusive/lifo_inbox.hpp
libcaf_core/caf/intrusive/lifo_inbox.hpp
+11
-0
libcaf_core/caf/intrusive/singly_linked.hpp
libcaf_core/caf/intrusive/singly_linked.hpp
+0
-13
libcaf_core/caf/intrusive/task_queue.hpp
libcaf_core/caf/intrusive/task_queue.hpp
+14
-0
libcaf_core/test/intrusive/lifo_inbox.cpp
libcaf_core/test/intrusive/lifo_inbox.cpp
+1
-1
No files found.
libcaf_core/caf/intrusive/drr_cached_queue.hpp
View file @
1d73fb39
...
@@ -116,8 +116,7 @@ public:
...
@@ -116,8 +116,7 @@ public:
/// Applies `f` to each element in the queue, excluding cached elements.
/// Applies `f` to each element in the queue, excluding cached elements.
template
<
class
F
>
template
<
class
F
>
void
peek_all
(
F
f
)
const
{
void
peek_all
(
F
f
)
const
{
for
(
auto
i
=
list_
.
begin
();
i
!=
list_
.
end
();
++
i
)
list_
.
peek_all
(
f
);
f
(
*
promote
(
i
.
ptr
));
}
}
// -- modifiers -------------------------------------------------------------
// -- modifiers -------------------------------------------------------------
...
...
libcaf_core/caf/intrusive/drr_queue.hpp
View file @
1d73fb39
...
@@ -65,13 +65,6 @@ public:
...
@@ -65,13 +65,6 @@ public:
return
deficit_
;
return
deficit_
;
}
}
/// Applies `f` to each element in the queue.
template
<
class
F
>
void
peek_all
(
F
f
)
const
{
for
(
auto
i
=
super
::
begin
();
i
!=
super
::
end
();
++
i
)
f
(
*
promote
(
i
.
ptr
));
}
// -- modifiers --------------------------------------------------------------
// -- modifiers --------------------------------------------------------------
void
inc_deficit
(
deficit_type
x
)
noexcept
{
void
inc_deficit
(
deficit_type
x
)
noexcept
{
...
...
libcaf_core/caf/intrusive/fifo_inbox.hpp
View file @
1d73fb39
...
@@ -140,7 +140,7 @@ public:
...
@@ -140,7 +140,7 @@ public:
return
false
;
return
false
;
do
{
do
{
auto
next
=
head
->
next
;
auto
next
=
head
->
next
;
queue_
.
lifo_append
(
promote
(
head
));
queue_
.
lifo_append
(
lifo_inbox_type
::
promote
(
head
));
head
=
next
;
head
=
next
;
}
while
(
head
!=
nullptr
);
}
while
(
head
!=
nullptr
);
queue_
.
stop_lifo_append
();
queue_
.
stop_lifo_append
();
...
...
libcaf_core/caf/intrusive/forward_iterator.hpp
View file @
1d73fb39
...
@@ -55,6 +55,13 @@ public:
...
@@ -55,6 +55,13 @@ public:
using
iterator_category
=
std
::
forward_iterator_tag
;
using
iterator_category
=
std
::
forward_iterator_tag
;
// -- static utility functions -----------------------------------------------
/// Casts a node type to its value type.
static
pointer
promote
(
node_pointer
ptr
)
noexcept
{
return
static_cast
<
pointer
>
(
ptr
);
}
// -- member variables -------------------------------------------------------
// -- member variables -------------------------------------------------------
node_pointer
ptr
;
node_pointer
ptr
;
...
...
libcaf_core/caf/intrusive/lifo_inbox.hpp
View file @
1d73fb39
...
@@ -35,6 +35,8 @@ namespace intrusive {
...
@@ -35,6 +35,8 @@ namespace intrusive {
template
<
class
Policy
>
template
<
class
Policy
>
class
lifo_inbox
{
class
lifo_inbox
{
public:
public:
// -- member types -----------------------------------------------------------
using
policy_type
=
Policy
;
using
policy_type
=
Policy
;
using
value_type
=
typename
policy_type
::
mapped_type
;
using
value_type
=
typename
policy_type
::
mapped_type
;
...
@@ -49,6 +51,15 @@ public:
...
@@ -49,6 +51,15 @@ public:
using
deleter_type
=
typename
unique_pointer
::
deleter_type
;
using
deleter_type
=
typename
unique_pointer
::
deleter_type
;
// -- static utility functions -----------------------------------------------
/// Casts a node type to its value type.
static
pointer
promote
(
node_pointer
ptr
)
noexcept
{
return
static_cast
<
pointer
>
(
ptr
);
}
// -- modifiers --------------------------------------------------------------
/// Tries to enqueue a new element to the inbox.
/// Tries to enqueue a new element to the inbox.
/// @threadsafe
/// @threadsafe
inbox_result
push_front
(
pointer
new_element
)
noexcept
{
inbox_result
push_front
(
pointer
new_element
)
noexcept
{
...
...
libcaf_core/caf/intrusive/singly_linked.hpp
View file @
1d73fb39
...
@@ -46,18 +46,5 @@ struct singly_linked {
...
@@ -46,18 +46,5 @@ struct singly_linked {
node_pointer
next
;
node_pointer
next
;
};
};
/// Casts a node type to its value type.
template
<
class
T
>
T
*
promote
(
singly_linked
<
T
>*
ptr
)
{
return
static_cast
<
T
*>
(
ptr
);
}
/// Casts a node type to its value type.
template
<
class
T
>
const
T
*
promote
(
const
singly_linked
<
T
>*
ptr
)
{
return
static_cast
<
const
T
*>
(
ptr
);
}
}
// namespace intrusive
}
// namespace intrusive
}
// namespace caf
}
// namespace caf
libcaf_core/caf/intrusive/task_queue.hpp
View file @
1d73fb39
...
@@ -60,6 +60,13 @@ public:
...
@@ -60,6 +60,13 @@ public:
using
const_iterator
=
forward_iterator
<
const
value_type
>
;
using
const_iterator
=
forward_iterator
<
const
value_type
>
;
// -- static utility functions -----------------------------------------------
/// Casts a node type to its value type.
static
pointer
promote
(
node_pointer
ptr
)
noexcept
{
return
static_cast
<
pointer
>
(
ptr
);
}
// -- constructors, destructors, and assignment operators -------------------
// -- constructors, destructors, and assignment operators -------------------
task_queue
(
policy_type
p
)
task_queue
(
policy_type
p
)
...
@@ -128,6 +135,13 @@ public:
...
@@ -128,6 +135,13 @@ public:
return
ptr
!=
&
tail_
?
promote
(
ptr
)
:
nullptr
;
return
ptr
!=
&
tail_
?
promote
(
ptr
)
:
nullptr
;
}
}
/// Applies `f` to each element in the queue.
template
<
class
F
>
void
peek_all
(
F
f
)
const
{
for
(
auto
i
=
begin
();
i
!=
end
();
++
i
)
f
(
*
i
);
}
// -- modifiers -------------------------------------------------------------
// -- modifiers -------------------------------------------------------------
/// Removes all elements from the queue.
/// Removes all elements from the queue.
...
...
libcaf_core/test/intrusive/lifo_inbox.cpp
View file @
1d73fb39
...
@@ -77,7 +77,7 @@ struct fixture {
...
@@ -77,7 +77,7 @@ struct fixture {
while
(
ptr
!=
nullptr
)
{
while
(
ptr
!=
nullptr
)
{
auto
next
=
ptr
->
next
;
auto
next
=
ptr
->
next
;
result
+=
to_string
(
*
ptr
);
result
+=
to_string
(
*
ptr
);
ptr
.
reset
(
promote
(
next
));
ptr
.
reset
(
inbox_type
::
promote
(
next
));
}
}
return
result
;
return
result
;
}
}
...
...
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