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
283daeb7
Commit
283daeb7
authored
May 13, 2017
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make stream_id comparable
parent
ef5181c4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
10 deletions
+55
-10
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+1
-0
libcaf_core/caf/fwd.hpp
libcaf_core/caf/fwd.hpp
+1
-1
libcaf_core/caf/stream_id.hpp
libcaf_core/caf/stream_id.hpp
+14
-9
libcaf_core/src/stream_id.cpp
libcaf_core/src/stream_id.cpp
+39
-0
No files found.
libcaf_core/CMakeLists.txt
View file @
283daeb7
...
@@ -95,6 +95,7 @@ set (LIBCAF_CORE_SRCS
...
@@ -95,6 +95,7 @@ set (LIBCAF_CORE_SRCS
src/skip.cpp
src/skip.cpp
src/splitter.cpp
src/splitter.cpp
src/stream.cpp
src/stream.cpp
src/stream_id.cpp
src/stream_handler.cpp
src/stream_handler.cpp
src/stream_msg_visitor.cpp
src/stream_msg_visitor.cpp
src/stream_multiplexer.cpp
src/stream_multiplexer.cpp
...
...
libcaf_core/caf/fwd.hpp
View file @
283daeb7
...
@@ -67,6 +67,7 @@ class node_id;
...
@@ -67,6 +67,7 @@ class node_id;
class
behavior
;
class
behavior
;
class
duration
;
class
duration
;
class
resumable
;
class
resumable
;
class
stream_id
;
class
actor_addr
;
class
actor_addr
;
class
actor_pool
;
class
actor_pool
;
class
message_id
;
class
message_id
;
...
@@ -115,7 +116,6 @@ class forwarding_actor_proxy;
...
@@ -115,7 +116,6 @@ class forwarding_actor_proxy;
struct
unit_t
;
struct
unit_t
;
struct
exit_msg
;
struct
exit_msg
;
struct
down_msg
;
struct
down_msg
;
struct
stream_id
;
struct
stream_msg
;
struct
stream_msg
;
struct
timeout_msg
;
struct
timeout_msg
;
struct
group_down_msg
;
struct
group_down_msg
;
...
...
libcaf_core/caf/stream_id.hpp
View file @
283daeb7
...
@@ -25,21 +25,26 @@
...
@@ -25,21 +25,26 @@
#include "caf/meta/type_name.hpp"
#include "caf/meta/type_name.hpp"
#include "caf/actor_control_block.hpp"
#include "caf/actor_control_block.hpp"
#include "caf/detail/comparable.hpp"
namespace
caf
{
namespace
caf
{
struct
stream_id
{
class
stream_id
:
detail
::
comparable
<
stream_id
>
{
public:
stream_id
()
=
default
;
stream_id
(
stream_id
&&
)
=
default
;
stream_id
(
const
stream_id
&
)
=
default
;
stream_id
&
operator
=
(
stream_id
&&
)
=
default
;
stream_id
&
operator
=
(
const
stream_id
&
)
=
default
;
stream_id
(
strong_actor_ptr
origin_actor
,
uint64_t
origin_nr
);
int64_t
compare
(
const
stream_id
&
other
)
const
;
strong_actor_ptr
origin
;
strong_actor_ptr
origin
;
uint64_t
nr
;
uint64_t
nr
;
};
};
inline
bool
operator
==
(
const
stream_id
&
x
,
const
stream_id
&
y
)
{
return
x
.
origin
==
y
.
origin
&&
x
.
nr
==
y
.
nr
;
}
inline
bool
operator
<
(
const
stream_id
&
x
,
const
stream_id
&
y
)
{
return
x
.
origin
==
y
.
origin
?
x
.
nr
<
y
.
nr
:
x
.
origin
<
y
.
origin
;
}
template
<
class
Inspector
>
template
<
class
Inspector
>
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
stream_id
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
stream_id
&
x
)
{
return
f
(
meta
::
type_name
(
"stream_id"
),
x
.
origin
,
x
.
nr
);
return
f
(
meta
::
type_name
(
"stream_id"
),
x
.
origin
,
x
.
nr
);
...
...
libcaf_core/src/stream_id.cpp
0 → 100644
View file @
283daeb7
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2017 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/stream_id.hpp"
#include <cstddef>
namespace
caf
{
stream_id
::
stream_id
(
strong_actor_ptr
origin_actor
,
uint64_t
origin_nr
)
:
origin
(
std
::
move
(
origin_actor
)),
nr
(
origin_nr
)
{
// nop
}
int64_t
stream_id
::
compare
(
const
stream_id
&
other
)
const
{
auto
r0
=
static_cast
<
ptrdiff_t
>
(
origin
.
get
()
-
other
.
origin
.
get
());
if
(
r0
!=
0
)
return
static_cast
<
int64_t
>
(
r0
);
return
static_cast
<
int64_t
>
(
nr
)
-
static_cast
<
int64_t
>
(
other
.
nr
);
}
}
// namespace caf
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