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
7fec52d0
Commit
7fec52d0
authored
Dec 01, 2017
by
Dominik Charousset
Committed by
Dominik Charousset
Feb 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test scaffold for new streaming infrastructure
parent
d6f6bfa3
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
598 additions
and
2 deletions
+598
-2
libcaf_core/caf/detail/overload.hpp
libcaf_core/caf/detail/overload.hpp
+54
-0
libcaf_core/caf/stream_slot.hpp
libcaf_core/caf/stream_slot.hpp
+41
-2
libcaf_core/test/mock_streaming_classes.cpp
libcaf_core/test/mock_streaming_classes.cpp
+503
-0
No files found.
libcaf_core/caf/detail/overload.hpp
0 → 100644
View file @
7fec52d0
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| 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. *
******************************************************************************/
#ifndef CAF_DETAIL_OVERLOAD_HPP
#define CAF_DETAIL_OVERLOAD_HPP
namespace
caf
{
namespace
detail
{
template
<
class
...
Fs
>
struct
overload
;
template
<
class
F
>
struct
overload
<
F
>
:
F
{
using
F
::
operator
();
overload
(
F
f
)
:
F
(
f
)
{
// nop
}
};
template
<
class
F
,
class
...
Fs
>
struct
overload
<
F
,
Fs
...
>
:
F
,
overload
<
Fs
...
>
{
using
F
::
operator
();
using
overload
<
Fs
...
>::
operator
();
overload
(
F
f
,
Fs
...
fs
)
:
F
(
f
),
overload
<
Fs
...
>
(
fs
...)
{
// nop
}
};
template
<
class
...
Fs
>
overload
<
Fs
...
>
make_overload
(
Fs
...
fs
)
{
return
{
fs
...};
}
}
// namespace detail
}
// namespace caf
#endif // CAF_DETAIL_OVERLOAD_HPP
libcaf_core/caf/stream_slot.hpp
View file @
7fec52d0
...
...
@@ -20,11 +20,50 @@
#define CAF_STREAM_SLOT_HPP
#include <cstdint>
#include <tuple>
#include "caf/detail/comparable.hpp"
namespace
caf
{
/// Actor-specific identifier for stream traffic.
using
stream_slot
=
uint64_t
;
/// Identifies a single stream path in the same way a TCP port identifies a
/// connection over IP.
using
stream_slot
=
uint16_t
;
/// Maps two `stream_slot` values into a pair for storing sender and receiver
/// slot information.
struct
stream_slots
:
detail
::
comparable
<
stream_slots
>
{
stream_slot
sender
;
stream_slot
receiver
;
// -- constructors, destructors, and assignment operators --------------------
constexpr
stream_slots
(
stream_slot
sender_slot
,
stream_slot
receiver_slot
)
:
sender
(
sender_slot
),
receiver
(
receiver_slot
)
{
// nop
}
// -- observers --------------------------------------------------------------
/// Returns an inverted pair, i.e., swaps sender and receiver slot.
constexpr
stream_slots
invert
()
const
{
return
{
receiver
,
sender
};
}
inline
int_fast32_t
compare
(
stream_slots
other
)
const
noexcept
{
static_assert
(
sizeof
(
stream_slots
)
==
sizeof
(
int32_t
),
"sizeof(stream_slots) != sizeof(int32_t)"
);
return
reinterpret_cast
<
const
int32_t
&>
(
*
this
)
-
reinterpret_cast
<
int32_t
&>
(
other
);
}
};
/// @relates stream_slots
template
<
class
Inspector
>
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
stream_slots
&
x
)
{
return
f
(
std
::
tie
(
x
.
sender
,
x
.
receiver
));
}
}
// namespace caf
...
...
libcaf_core/test/mock_streaming_classes.cpp
0 → 100644
View file @
7fec52d0
This diff is collapsed.
Click to expand it.
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