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
623f7571
Commit
623f7571
authored
Nov 24, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build with default visibility hidden
parent
bac7c902
Changes
34
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
418 additions
and
573 deletions
+418
-573
CMakeLists.txt
CMakeLists.txt
+47
-76
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+152
-26
libcaf_core/caf/actor_system.hpp
libcaf_core/caf/actor_system.hpp
+2
-1
libcaf_core/caf/blocking_actor.hpp
libcaf_core/caf/blocking_actor.hpp
+4
-4
libcaf_core/caf/broadcast_downstream_manager.hpp
libcaf_core/caf/broadcast_downstream_manager.hpp
+1
-3
libcaf_core/caf/byte_address.hpp
libcaf_core/caf/byte_address.hpp
+1
-12
libcaf_core/caf/config_value.hpp
libcaf_core/caf/config_value.hpp
+0
-2
libcaf_core/caf/detail/dynamic_message_data.hpp
libcaf_core/caf/detail/dynamic_message_data.hpp
+6
-0
libcaf_core/caf/detail/simple_actor_clock.hpp
libcaf_core/caf/detail/simple_actor_clock.hpp
+12
-0
libcaf_core/caf/downstream_manager.hpp
libcaf_core/caf/downstream_manager.hpp
+6
-2
libcaf_core/caf/fwd.hpp
libcaf_core/caf/fwd.hpp
+8
-6
libcaf_core/caf/group_manager.hpp
libcaf_core/caf/group_manager.hpp
+5
-1
libcaf_core/caf/group_module.hpp
libcaf_core/caf/group_module.hpp
+4
-0
libcaf_core/caf/inbound_path.hpp
libcaf_core/caf/inbound_path.hpp
+2
-2
libcaf_core/caf/ipv4_address.hpp
libcaf_core/caf/ipv4_address.hpp
+8
-1
libcaf_core/caf/ipv6_address.hpp
libcaf_core/caf/ipv6_address.hpp
+5
-1
libcaf_core/caf/logger.hpp
libcaf_core/caf/logger.hpp
+2
-2
libcaf_core/caf/policy/downstream_messages.hpp
libcaf_core/caf/policy/downstream_messages.hpp
+1
-1
libcaf_core/caf/policy/profiled.hpp
libcaf_core/caf/policy/profiled.hpp
+0
-70
libcaf_core/caf/proxy_registry.hpp
libcaf_core/caf/proxy_registry.hpp
+1
-1
libcaf_core/caf/scheduled_actor.hpp
libcaf_core/caf/scheduled_actor.hpp
+8
-0
libcaf_core/caf/scheduler/profiled_coordinator.hpp
libcaf_core/caf/scheduler/profiled_coordinator.hpp
+0
-295
libcaf_core/src/actor_system.cpp
libcaf_core/src/actor_system.cpp
+1
-14
libcaf_core/src/ipv4_address.cpp
libcaf_core/src/ipv4_address.cpp
+7
-0
libcaf_core/src/ipv6_address.cpp
libcaf_core/src/ipv6_address.cpp
+8
-0
libcaf_io/CMakeLists.txt
libcaf_io/CMakeLists.txt
+47
-18
libcaf_io/caf/io/abstract_broker.hpp
libcaf_io/caf/io/abstract_broker.hpp
+8
-0
libcaf_io/caf/io/broker.hpp
libcaf_io/caf/io/broker.hpp
+8
-0
libcaf_io/caf/io/connection_helper.hpp
libcaf_io/caf/io/connection_helper.hpp
+1
-15
libcaf_io/caf/io/middleman_actor_impl.hpp
libcaf_io/caf/io/middleman_actor_impl.hpp
+8
-0
libcaf_io/caf/io/network/default_multiplexer.hpp
libcaf_io/caf/io/network/default_multiplexer.hpp
+5
-5
libcaf_io/caf/io/network/manager.hpp
libcaf_io/caf/io/network/manager.hpp
+1
-0
libcaf_io/src/io/connection_helper.cpp
libcaf_io/src/io/connection_helper.cpp
+6
-0
libcaf_openssl/CMakeLists.txt
libcaf_openssl/CMakeLists.txt
+43
-15
No files found.
CMakeLists.txt
View file @
623f7571
...
...
@@ -22,6 +22,36 @@ else()
endif
()
unset
(
_parent
)
# enable tests if not disabled
if
(
NOT CAF_NO_UNIT_TESTS
)
enable_testing
()
function
(
add_test_suites executable dir
)
# enumerate all test suites.
set
(
suites
""
)
foreach
(
cpp_file
${
ARGN
}
)
file
(
STRINGS
"
${
dir
}
/
${
cpp_file
}
"
contents
)
foreach
(
line
${
contents
}
)
if
(
"
${
line
}
"
MATCHES
"SUITE (.+)"
)
string
(
REGEX REPLACE
".*SUITE (.+)"
"
\\
1"
suite
${
line
}
)
list
(
APPEND suites
"
${
suite
}
"
)
endif
()
endforeach
()
endforeach
()
list
(
REMOVE_DUPLICATES suites
)
list
(
LENGTH suites num_suites
)
message
(
STATUS
"Found
${
num_suites
}
test suite for
${
executable
}
"
)
# creates one CMake test per test suite.
macro
(
make_test suite
)
string
(
REPLACE
" "
"_"
test_name
${
suite
}
)
add_test
(
NAME
${
test_name
}
COMMAND
${
executable
}
-r300 -n -v5 -s
"^
${
suite
}
$"
)
endmacro
()
list
(
LENGTH suites num_suites
)
foreach
(
suite
${
suites
}
)
make_test
(
"
${
suite
}
"
)
endforeach
()
endfunction
()
endif
()
# -- make sure we have at least C++17 available --------------------------------
if
(
NOT CMAKE_CROSSCOMPILING
)
...
...
@@ -426,51 +456,32 @@ add_custom_command(TARGET uninstall
COMMAND
"
${
CMAKE_COMMAND
}
"
-P
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmake_uninstall.cmake"
)
################################################################################
# set inclue paths for subprojects #
################################################################################
# -- generate build config header ----------------------------------------------
# path to caf core & io headers
set
(
LIBCAF_INCLUDE_DIRS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/libcaf_core"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/libcaf_io"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/libcaf_test"
)
# enable tests if not disabled
if
(
NOT CAF_NO_UNIT_TESTS
)
enable_testing
()
macro
(
add_unit_tests globstr
)
file
(
GLOB_RECURSE tests
"
${
globstr
}
"
)
set
(
CAF_ALL_UNIT_TESTS
${
CAF_ALL_UNIT_TESTS
}
${
tests
}
)
endmacro
()
else
()
macro
(
add_unit_tests globstr
)
# do nothing (unit tests disabled)
endmacro
()
endif
()
# all projects need the headers of the core components
include_directories
(
"
${
LIBCAF_INCLUDE_DIRS
}
"
)
configure_file
(
"
${
PROJECT_SOURCE_DIR
}
/cmake/build_config.hpp.in"
"
${
CMAKE_BINARY_DIR
}
/caf/detail/build_config.hpp"
@ONLY
)
# -- set include paths for all subprojects -------------------------------------
include_directories
(
"
${
CMAKE_BINARY_DIR
}
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/libcaf_core"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/libcaf_io"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/libcaf_test"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/libcaf_openssl"
)
################################################################################
# add targets #
################################################################################
macro
(
add_caf_lib name
)
set
(
full_name libcaf_
${
name
}
)
add_subdirectory
(
${
full_name
}
)
add_unit_tests
(
"
${
full_name
}
/test/*.cpp"
)
# add headers to include directories so other subprojects can use them
include_directories
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
full_name
}
"
)
endmacro
()
macro
(
add_optional_caf_lib name
)
string
(
TOUPPER
${
name
}
upper_name
)
set
(
flag_varname CAF_NO_
${
upper_name
}
)
if
(
NOT
${
flag_varname
}
AND EXISTS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/libcaf_
${
name
}
/CMakeLists.txt"
)
add_
caf_lib
(
${
name
}
)
add_
subdirectory
(
"libcaf_
${
name
}
"
)
else
()
set
(
${
flag_name
}
yes
)
set
(
${
flag_
var
name
}
yes
)
endif
()
endmacro
()
...
...
@@ -500,7 +511,7 @@ macro(add_optional_caf_binaries name)
endmacro
()
# build core and I/O library
add_
caf_lib
(
core
)
add_
subdirectory
(
libcaf_
core
)
add_optional_caf_lib
(
io
)
# build SSL module if OpenSSL library is available
...
...
@@ -572,48 +583,6 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CAFConfig.cmake"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/CAFConfigVersion.cmake"
DESTINATION
"
${
INSTALL_CAF_CMAKEDIR
}
"
)
################################################################################
# unit tests setup #
################################################################################
if
(
NOT CAF_NO_UNIT_TESTS
)
# setup unit test binary
add_executable
(
caf-test
libcaf_test/src/caf-test.cpp
libcaf_test/caf/test/unit_test.hpp
libcaf_test/caf/test/unit_test_impl.hpp
${
CAF_ALL_UNIT_TESTS
}
)
target_link_libraries
(
caf-test
${
CAF_EXTRA_LDFLAGS
}
${
CAF_LIBRARIES
}
${
PTHREAD_LIBRARIES
}
)
add_custom_target
(
all_unit_tests
)
add_dependencies
(
caf-test all_unit_tests
)
# enumerate all test suites.
foreach
(
test
${
CAF_ALL_UNIT_TESTS
}
)
file
(
STRINGS
${
test
}
contents
)
foreach
(
line
${
contents
}
)
if
(
"
${
line
}
"
MATCHES
"CAF_SUITE (.*)"
)
string
(
REGEX REPLACE
".* CAF_SUITE (.*)"
"
\\
1"
suite
${
line
}
)
list
(
APPEND suites
${
suite
}
)
endif
()
endforeach
()
endforeach
()
list
(
REMOVE_DUPLICATES suites
)
# creates one CMake test per test suite.
macro
(
make_test suite
)
string
(
REPLACE
" "
"_"
test_name
${
suite
}
)
set
(
caf_test
${
EXECUTABLE_OUTPUT_PATH
}
/caf-test
)
add_test
(
${
test_name
}
${
caf_test
}
-r 300 -n -v 5 -s
"
${
suite
}
"
${
ARGN
}
)
endmacro
()
list
(
LENGTH suites num_suites
)
message
(
STATUS
"Found
${
num_suites
}
test suites"
)
foreach
(
suite
${
suites
}
)
make_test
(
"
${
suite
}
"
)
endforeach
()
endif
()
# -- Fetch branch name and SHA if available ------------------------------------
if
(
EXISTS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/release.txt"
)
...
...
@@ -627,7 +596,9 @@ message(STATUS "Set release version for all documentation to ${CAF_RELEASE}.")
# -- Setup for building manual and API documentation ---------------------------
add_subdirectory
(
doc
)
if
(
NOT WIN32
)
add_subdirectory
(
doc
)
endif
()
################################################################################
# Add additional project files to GUI #
...
...
libcaf_core/CMakeLists.txt
View file @
623f7571
# -- get header files for creating "proper" XCode projects ---------------------
file
(
GLOB_RECURSE
LIBCAF_CORE_HD
RS
"caf/*.hpp"
)
file
(
GLOB_RECURSE
CAF_CORE_HEADE
RS
"caf/*.hpp"
)
# -- auto generate to_string for enum types ------------------------------------
...
...
@@ -13,9 +13,9 @@ enum_to_string("caf/pec.hpp" "pec_strings.cpp")
enum_to_string
(
"caf/sec.hpp"
"sec_strings.cpp"
)
enum_to_string
(
"caf/stream_priority.hpp"
"stream_priority_strings.cpp"
)
# -- list cpp files
----------------
--------------------------------------------
# -- list cpp files
for libcaf_core
--------------------------------------------
set
(
LIBCAF_CORE_SRC
S
set
(
CAF_CORE_SOURCE
S
"
${
CMAKE_CURRENT_BINARY_DIR
}
/exit_reason_strings.cpp"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/inbox_result_strings.cpp"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/invoke_msg_result_strings.cpp"
...
...
@@ -157,37 +157,140 @@ set(LIBCAF_CORE_SRCS
src/uri_builder.cpp
)
# --
generate build config header ----
------------------------------------------
# --
list cpp files for caf-core-test
------------------------------------------
configure_file
(
"
${
PROJECT_SOURCE_DIR
}
/cmake/build_config.hpp.in"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/caf/detail/build_config.hpp"
@ONLY
)
set
(
CAF_CORE_TEST_SOURCES
test/actor_clock.cpp
test/actor_factory.cpp
test/actor_lifetime.cpp
test/actor_pool.cpp
test/actor_profiler.cpp
test/actor_registry.cpp
test/actor_system_config.cpp
test/actor_termination.cpp
test/aout.cpp
test/atom.cpp
test/behavior.cpp
test/blocking_actor.cpp
test/broadcast_downstream_manager.cpp
test/byte.cpp
test/composable_behavior.cpp
test/composition.cpp
test/config_option.cpp
test/config_option_set.cpp
test/config_value.cpp
test/config_value_adaptor.cpp
test/constructor_attach.cpp
test/continuous_streaming.cpp
test/cow_tuple.cpp
test/custom_exception_handler.cpp
test/decorator/sequencer.cpp
test/decorator/splitter.cpp
test/deep_to_string.cpp
test/detached_actors.cpp
test/detail/bounds_checker.cpp
test/detail/ini_consumer.cpp
test/detail/limited_vector.cpp
test/detail/parse.cpp
test/detail/parser/read_atom.cpp
test/detail/parser/read_bool.cpp
test/detail/parser/read_floating_point.cpp
test/detail/parser/read_ini.cpp
test/detail/parser/read_number.cpp
test/detail/parser/read_number_or_timespan.cpp
test/detail/parser/read_signed_integer.cpp
test/detail/parser/read_string.cpp
test/detail/parser/read_timespan.cpp
test/detail/parser/read_unsigned_integer.cpp
test/detail/ringbuffer.cpp
test/detail/ripemd_160.cpp
test/detail/serialized_size.cpp
test/detail/tick_emitter.cpp
test/detail/unique_function.cpp
test/detail/unordered_flat_map.cpp
test/dictionary.cpp
test/dynamic_spawn.cpp
test/expected.cpp
test/extract.cpp
test/function_view.cpp
test/fused_downstream_manager.cpp
test/handles.cpp
test/inbound_path.cpp
test/inspector.cpp
test/intrusive/drr_cached_queue.cpp
test/intrusive/drr_queue.cpp
test/intrusive/fifo_inbox.cpp
test/intrusive/lifo_inbox.cpp
test/intrusive/task_queue.cpp
test/intrusive/wdrr_dynamic_multiplexed_queue.cpp
test/intrusive/wdrr_fixed_multiplexed_queue.cpp
test/intrusive_ptr.cpp
test/ipv4_address.cpp
test/ipv4_endpoint.cpp
test/ipv4_subnet.cpp
test/ipv6_address.cpp
test/ipv6_endpoint.cpp
test/ipv6_subnet.cpp
test/local_group.cpp
test/local_migration.cpp
test/logger.cpp
test/mailbox_element.cpp
test/make_config_value_field.cpp
test/match.cpp
test/message.cpp
test/message_id.cpp
test/message_lifetime.cpp
test/metaprogramming.cpp
test/mixin/requester.cpp
test/mixin/sender.cpp
test/mock_streaming_classes.cpp
test/native_streaming_classes.cpp
test/optional.cpp
test/or_else.cpp
test/pipeline_streaming.cpp
test/policy/categorized.cpp
test/request_timeout.cpp
test/result.cpp
test/rtti_pair.cpp
test/runtime_settings_map.cpp
test/selective_streaming.cpp
test/serial_reply.cpp
test/serialization.cpp
test/serializer_impl.cpp
test/settings.cpp
test/simple_timeout.cpp
test/span.cpp
test/stateful_actor.cpp
test/streambuf.cpp
test/string_algorithms.cpp
test/string_view.cpp
test/sum_type.cpp
test/sum_type_token.cpp
test/thread_hook.cpp
test/to_string.cpp
test/type_erased_tuple.cpp
test/typed_response_promise.cpp
test/typed_spawn.cpp
test/unit.cpp
test/uri.cpp
test/variant.cpp
)
# -- add library target --------------------------------------------------------
add_library
(
libcaf_core
${
LIBCAF_CORE_SRCS
}
${
LIBCAF_CORE_HD
RS
}
)
add_library
(
libcaf_core
_obj OBJECT
${
CAF_CORE_SOURCES
}
${
CAF_CORE_HEADE
RS
}
)
add_library
(
caf::core ALIAS libcaf_core
)
add_library
(
libcaf_core $<TARGET_OBJECTS:libcaf_core_obj>
)
# TODO: only exists for backwards compatibility, remove with CAF 0.19
if
(
BUILD_SHARED_LIBS
)
add_library
(
libcaf_core_shared ALIAS libcaf_core
)
else
()
add_library
(
libcaf_core_static ALIAS libcaf_core
)
endif
()
add_library
(
caf::core ALIAS libcaf_core
)
target_link_libraries
(
libcaf_core PUBLIC
${
CAF_EXTRA_LDFLAGS
}
)
generate_export_header
(
libcaf_core
generate_export_header
(
libcaf_core
_obj
EXPORT_MACRO_NAME CAF_CORE_EXPORT
EXPORT_FILE_NAME
"caf/detail/core_export.hpp"
EXPORT_FILE_NAME
"
${
CMAKE_BINARY_DIR
}
/
caf/detail/core_export.hpp"
STATIC_DEFINE CAF_STATIC_BUILD
)
target_include_directories
(
libcaf_core PUBLIC
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_BINARY_DIR
}
>
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
>
$<INSTALL_INTERFACE:include>
)
set_target_properties
(
libcaf_core PROPERTIES
EXPORT_NAME core
SOVERSION
${
CAF_VERSION
}
...
...
@@ -196,6 +299,10 @@ set_target_properties(libcaf_core PROPERTIES
# -- install library and header files ------------------------------------------
install
(
FILES
"
${
CMAKE_BINARY_DIR
}
/caf/detail/build_config.hpp"
"
${
CMAKE_BINARY_DIR
}
/caf/detail/core_export.hpp"
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/caf/detail"
)
install
(
TARGETS libcaf_core
EXPORT CAFTargets
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT core
...
...
@@ -207,12 +314,31 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/caf"
COMPONENT core
FILES_MATCHING PATTERN
"*.hpp"
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/caf/detail/build_config.hpp"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/caf/detail/core_export.hpp"
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/caf/detail"
)
# -- add this library to the global CAF_LIBRARIES ------------------------------
list
(
APPEND CAF_LIBRARIES libcaf_core
)
set
(
CAF_LIBRARIES
${
CAF_LIBRARIES
}
PARENT_SCOPE
)
# -- build unit tests ----------------------------------------------------------
if
(
NOT CAF_NO_UNIT_TESTS
)
add_executable
(
caf-core-test
"
${
PROJECT_SOURCE_DIR
}
/libcaf_test/src/caf-test.cpp"
"
${
PROJECT_SOURCE_DIR
}
/libcaf_test/caf/test/unit_test.hpp"
"
${
PROJECT_SOURCE_DIR
}
/libcaf_test/caf/test/unit_test_impl.hpp"
${
CAF_CORE_TEST_SOURCES
}
$<TARGET_OBJECTS:libcaf_core_obj>
)
target_link_libraries
(
caf-core-test
${
CAF_EXTRA_LDFLAGS
}
)
add_test_suites
(
caf-core-test
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
${
CAF_CORE_TEST_SOURCES
}
)
endif
()
# -- backwards compatibility, TODO: remove -------------------------------------
if
(
BUILD_SHARED_LIBS
)
add_library
(
libcaf_core_shared ALIAS libcaf_core
)
else
()
add_library
(
libcaf_core_static ALIAS libcaf_core
)
endif
()
libcaf_core/caf/actor_system.hpp
View file @
623f7571
...
...
@@ -81,6 +81,7 @@ struct mpi_field_access<void> {
return
"void"
;
}
};
template
<
class
T
>
std
::
string
get_mpi_field
(
const
uniform_type_info_map
&
types
)
{
mpi_field_access
<
T
>
f
;
...
...
@@ -147,7 +148,7 @@ public:
actor_system
&
operator
=
(
const
actor_system
&
)
=
delete
;
/// An (optional) component of the actor system.
class
module
{
class
CAF_CORE_EXPORT
module
{
public:
enum
id_t
{
scheduler
,
...
...
libcaf_core/caf/blocking_actor.hpp
View file @
623f7571
...
...
@@ -124,7 +124,7 @@ public:
// -- nested classes ---------------------------------------------------------
/// Represents pre- and postconditions for receive loops.
class
receive_cond
{
class
CAF_CORE_EXPORT
receive_cond
{
public:
virtual
~
receive_cond
();
...
...
@@ -136,14 +136,14 @@ public:
};
/// Pseudo receive condition modeling a single receive.
class
accept_one_cond
:
public
receive_cond
{
class
CAF_CORE_EXPORT
accept_one_cond
:
public
receive_cond
{
public:
~
accept_one_cond
()
override
;
bool
post
()
override
;
};
/// Implementation helper for `blocking_actor::receive_while`.
struct
receive_while_helper
{
struct
CAF_CORE_EXPORT
receive_while_helper
{
using
fun_type
=
std
::
function
<
bool
()
>
;
blocking_actor
*
self
;
...
...
@@ -195,7 +195,7 @@ public:
};
/// Implementation helper for `blocking_actor::do_receive`.
struct
do_receive_helper
{
struct
CAF_CORE_EXPORT
do_receive_helper
{
std
::
function
<
void
(
receive_cond
&
rc
)
>
cb
;
template
<
class
Statement
>
...
...
libcaf_core/caf/broadcast_downstream_manager.hpp
View file @
623f7571
...
...
@@ -22,7 +22,6 @@
#include "caf/buffered_downstream_manager.hpp"
#include "caf/detail/algorithms.hpp"
#include "caf/detail/core_export.hpp"
#include "caf/detail/path_state.hpp"
#include "caf/detail/select_all.hpp"
#include "caf/detail/unordered_flat_map.hpp"
...
...
@@ -32,8 +31,7 @@
namespace
caf
{
template
<
class
T
,
class
Filter
=
unit_t
,
class
Select
=
detail
::
select_all
>
class
CAF_CORE_EXPORT
broadcast_downstream_manager
:
public
buffered_downstream_manager
<
T
>
{
class
broadcast_downstream_manager
:
public
buffered_downstream_manager
<
T
>
{
public:
// -- member types -----------------------------------------------------------
...
...
libcaf_core/caf/byte_address.hpp
View file @
623f7571
...
...
@@ -19,17 +19,15 @@
#pragma once
#include <cstdint>
#include <cstring>
#include "caf/config.hpp"
#include "caf/detail/comparable.hpp"
namespace
caf
{
/// Base type for addresses based on a byte representation such as IP or
/// Ethernet addresses.
template
<
class
Derived
>
class
byte_address
:
detail
::
comparable
<
Derived
>
{
class
byte_address
{
public:
// -- element access ---------------------------------------------------------
...
...
@@ -50,15 +48,6 @@ public:
return
dref
().
bytes
().
size
();
}
// -- comparison -------------------------------------------------------------
/// Returns a negative number if `*this < other`, zero if `*this == other`
/// and a positive number if `*this > other`.
int
compare
(
const
Derived
&
other
)
const
noexcept
{
auto
&
buf
=
dref
().
bytes
();
return
memcmp
(
buf
.
data
(),
other
.
bytes
().
data
(),
Derived
::
num_bytes
);
}
// -- transformations --------------------------------------------------------
Derived
network_address
(
size_t
prefix_length
)
const
noexcept
{
...
...
libcaf_core/caf/config_value.hpp
View file @
623f7571
...
...
@@ -262,8 +262,6 @@ CAF_DEFAULT_CONFIG_VALUE_ACCESS(double, "real64");
CAF_DEFAULT_CONFIG_VALUE_ACCESS
(
atom_value
,
"atom"
);
CAF_DEFAULT_CONFIG_VALUE_ACCESS
(
timespan
,
"timespan"
);
CAF_DEFAULT_CONFIG_VALUE_ACCESS
(
uri
,
"uri"
);
CAF_DEFAULT_CONFIG_VALUE_ACCESS
(
config_value
::
list
,
"list"
);
CAF_DEFAULT_CONFIG_VALUE_ACCESS
(
config_value
::
dictionary
,
"dictionary"
);
#undef CAF_DEFAULT_CONFIG_VALUE_ACCESS
...
...
libcaf_core/caf/detail/dynamic_message_data.hpp
View file @
623f7571
...
...
@@ -39,8 +39,14 @@ public:
dynamic_message_data
(
elements
&&
data
);
dynamic_message_data
(
dynamic_message_data
&&
)
=
default
;
dynamic_message_data
(
const
dynamic_message_data
&
other
);
dynamic_message_data
&
operator
=
(
dynamic_message_data
&&
)
=
delete
;
dynamic_message_data
&
operator
=
(
const
dynamic_message_data
&
)
=
delete
;
~
dynamic_message_data
()
override
;
// -- overridden observers of message_data -----------------------------------
...
...
libcaf_core/caf/detail/simple_actor_clock.hpp
View file @
623f7571
...
...
@@ -247,6 +247,18 @@ public:
}
};
// -- constructors, destructors, and assignment operators --------------------
simple_actor_clock
()
=
default
;
simple_actor_clock
(
simple_actor_clock
&&
)
=
default
;
simple_actor_clock
(
const
simple_actor_clock
&
)
=
delete
;
simple_actor_clock
&
operator
=
(
simple_actor_clock
&&
)
=
default
;
simple_actor_clock
&
operator
=
(
const
simple_actor_clock
&
)
=
delete
;
// -- properties -------------------------------------------------------------
const
schedule_map
&
schedule
()
const
{
...
...
libcaf_core/caf/downstream_manager.hpp
View file @
623f7571
...
...
@@ -49,13 +49,13 @@ public:
using
unique_path_ptr
=
std
::
unique_ptr
<
path_type
>
;
/// Function object for iterating over all paths.
struct
path_visitor
{
struct
CAF_CORE_EXPORT
path_visitor
{
virtual
~
path_visitor
();
virtual
void
operator
()(
outbound_path
&
x
)
=
0
;
};
/// Predicate object for paths.
struct
path_predicate
{
struct
CAF_CORE_EXPORT
path_predicate
{
virtual
~
path_predicate
();
virtual
bool
operator
()(
const
outbound_path
&
x
)
const
noexcept
=
0
;
};
...
...
@@ -67,6 +67,10 @@ public:
explicit
downstream_manager
(
stream_manager
*
parent
);
downstream_manager
(
const
downstream_manager
&
)
=
delete
;
downstream_manager
&
operator
=
(
const
downstream_manager
&
)
=
delete
;
virtual
~
downstream_manager
();
// -- properties -------------------------------------------------------------
...
...
libcaf_core/caf/fwd.hpp
View file @
623f7571
...
...
@@ -24,6 +24,7 @@
#include <tuple>
#include <vector>
#include "caf/detail/core_export.hpp"
#include "caf/detail/is_one_of.hpp"
#include "caf/detail/is_primitive_config_value.hpp"
#include "caf/timespan.hpp"
...
...
@@ -193,7 +194,7 @@ using stream_slot = uint16_t;
// -- functions ----------------------------------------------------------------
/// @relates actor_system_config
const
settings
&
content
(
const
actor_system_config
&
);
CAF_CORE_EXPORT
const
settings
&
content
(
const
actor_system_config
&
);
// -- intrusive containers -----------------------------------------------------
...
...
@@ -280,13 +281,14 @@ class private_thread;
class
uri_impl
;
// enable intrusive_ptr<uri_impl> with forward declaration only
void
intrusive_ptr_add_ref
(
const
uri_impl
*
);
void
intrusive_ptr_release
(
const
uri_impl
*
);
CAF_CORE_EXPORT
void
intrusive_ptr_add_ref
(
const
uri_impl
*
);
CAF_CORE_EXPORT
void
intrusive_ptr_release
(
const
uri_impl
*
);
// enable intrusive_cow_ptr<dynamic_message_data> with forward declaration only
void
intrusive_ptr_add_ref
(
const
dynamic_message_data
*
);
void
intrusive_ptr_release
(
const
dynamic_message_data
*
);
dynamic_message_data
*
intrusive_cow_ptr_unshare
(
dynamic_message_data
*&
);
CAF_CORE_EXPORT
void
intrusive_ptr_add_ref
(
const
dynamic_message_data
*
);
CAF_CORE_EXPORT
void
intrusive_ptr_release
(
const
dynamic_message_data
*
);
CAF_CORE_EXPORT
dynamic_message_data
*
intrusive_cow_ptr_unshare
(
dynamic_message_data
*&
);
}
// namespace detail
...
...
libcaf_core/caf/group_manager.hpp
View file @
623f7571
...
...
@@ -46,6 +46,10 @@ public:
// -- constructors, destructors, and assignment operators --------------------
group_manager
(
const
group_manager
&
)
=
delete
;
group_manager
&
operator
=
(
const
group_manager
&
)
=
delete
;
~
group_manager
();
// -- observers --------------------------------------------------------------
...
...
@@ -78,7 +82,7 @@ public:
private:
// -- constructors, destructors, and assignment operators --------------------
group_manager
(
actor_system
&
sys
);
explicit
group_manager
(
actor_system
&
sys
);
// -- member functions required by actor_system ------------------------------
...
...
libcaf_core/caf/group_module.hpp
View file @
623f7571
...
...
@@ -37,6 +37,10 @@ public:
group_module
(
actor_system
&
sys
,
std
::
string
mname
);
group_module
(
const
group_module
&
)
=
delete
;
group_module
&
operator
=
(
const
group_module
&
)
=
delete
;
virtual
~
group_module
();
// -- pure virtual member functions ------------------------------------------
...
...
libcaf_core/caf/inbound_path.hpp
View file @
623f7571
...
...
@@ -73,7 +73,7 @@ public:
static
constexpr
int
initial_credit
=
50
;
/// Stores statistics for measuring complexity of incoming batches.
struct
stats_t
{
struct
CAF_CORE_EXPORT
stats_t
{
/// Wraps a time measurement for a single processed batch.
struct
measurement
{
/// Number of items in the batch.
...
...
@@ -83,7 +83,7 @@ public:
};
/// Wraps the resulf of `stats_t::calculate()`.
struct
calculation_result
{
struct
CAF_CORE_EXPORT
calculation_result
{
/// Number of items per credit cycle.
int32_t
max_throughput
;
/// Number of items per batch to reach the desired batch complexity.
...
...
libcaf_core/caf/ipv4_address.hpp
View file @
623f7571
...
...
@@ -29,7 +29,8 @@
namespace
caf
{
class
CAF_CORE_EXPORT
ipv4_address
:
public
byte_address
<
ipv4_address
>
{
class
CAF_CORE_EXPORT
ipv4_address
:
public
byte_address
<
ipv4_address
>
,
detail
::
comparable
<
ipv4_address
>
{
public:
// -- constants --------------------------------------------------------------
...
...
@@ -94,6 +95,12 @@ public:
return
bytes_
;
}
// -- comparison -------------------------------------------------------------
/// Returns a negative number if `*this < other`, zero if `*this == other`
/// and a positive number if `*this > other`.
int
compare
(
ipv4_address
other
)
const
noexcept
;
// -- inspection -------------------------------------------------------------
template
<
class
Inspector
>
...
...
libcaf_core/caf/ipv6_address.hpp
View file @
623f7571
...
...
@@ -27,11 +27,13 @@
#include "caf/detail/comparable.hpp"
#include "caf/detail/core_export.hpp"
#include "caf/fwd.hpp"
#include "caf/ipv4_address.hpp"
namespace
caf
{
class
CAF_CORE_EXPORT
ipv6_address
:
public
byte_address
<
ipv6_address
>
,
detail
::
comparable
<
ipv6_address
>
,
detail
::
comparable
<
ipv6_address
,
ipv4_address
>
{
public:
// -- constants --------------------------------------------------------------
...
...
@@ -66,7 +68,9 @@ public:
// -- comparison -------------------------------------------------------------
using
super
::
compare
;
/// Returns a negative number if `*this < other`, zero if `*this == other`
/// and a positive number if `*this > other`.
int
compare
(
ipv6_address
other
)
const
noexcept
;
/// Returns a negative number if `*this < other`, zero if `*this == other`
/// and a positive number if `*this > other`.
...
...
libcaf_core/caf/logger.hpp
View file @
623f7571
...
...
@@ -102,7 +102,7 @@ public:
};
/// Encapsulates a single logging event.
struct
event
{
struct
CAF_CORE_EXPORT
event
{
// -- constructors, destructors, and assignment operators ------------------
event
()
=
default
;
...
...
@@ -181,7 +181,7 @@ public:
using
line_format
=
std
::
vector
<
field
>
;
/// Utility class for building user-defined log messages with `CAF_ARG`.
class
line_builder
{
class
CAF_CORE_EXPORT
line_builder
{
public:
line_builder
();
...
...
libcaf_core/caf/policy/downstream_messages.hpp
View file @
623f7571
...
...
@@ -35,7 +35,7 @@ public:
// -- nested types -----------------------------------------------------------
/// Configures a nested DRR queue.
class
nested
{
class
CAF_CORE_EXPORT
nested
{
public:
// -- member types ---------------------------------------------------------
...
...
libcaf_core/caf/policy/profiled.hpp
deleted
100644 → 0
View file @
bac7c902
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 Dominik Charousset *
* *
* 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. *
******************************************************************************/
#pragma once
#include "caf/abstract_actor.hpp"
#include "caf/resumable.hpp"
namespace
caf
{
namespace
scheduler
{
template
<
class
>
class
profiled_coordinator
;
}
// namespace scheduler
namespace
policy
{
/// An enhancement of CAF's scheduling policy which records fine-grained
/// resource utiliziation for worker threads and actors in the parent
/// coordinator of the workers.
template
<
class
Policy
>
struct
profiled
:
Policy
{
using
coordinator_type
=
scheduler
::
profiled_coordinator
<
profiled
<
Policy
>>
;
static
actor_id
id_of
(
resumable
*
job
)
{
auto
ptr
=
dynamic_cast
<
abstract_actor
*>
(
job
);
return
ptr
!=
nullptr
?
ptr
->
id
()
:
0
;
}
template
<
class
Worker
>
void
before_resume
(
Worker
*
worker
,
resumable
*
job
)
{
Policy
::
before_resume
(
worker
,
job
);
auto
parent
=
static_cast
<
coordinator_type
*>
(
worker
->
parent
());
parent
->
start_measuring
(
worker
->
id
(),
id_of
(
job
));
}
template
<
class
Worker
>
void
after_resume
(
Worker
*
worker
,
resumable
*
job
)
{
Policy
::
after_resume
(
worker
,
job
);
auto
parent
=
static_cast
<
coordinator_type
*>
(
worker
->
parent
());
parent
->
stop_measuring
(
worker
->
id
(),
id_of
(
job
));
}
template
<
class
Worker
>
void
after_completion
(
Worker
*
worker
,
resumable
*
job
)
{
Policy
::
after_completion
(
worker
,
job
);
auto
parent
=
static_cast
<
coordinator_type
*>
(
worker
->
parent
());
parent
->
remove_job
(
id_of
(
job
));
}
};
}
// namespace policy
}
// namespace caf
libcaf_core/caf/proxy_registry.hpp
View file @
623f7571
...
...
@@ -38,7 +38,7 @@ namespace caf {
class
CAF_CORE_EXPORT
proxy_registry
{
public:
/// Responsible for creating proxy actors.
class
backend
{
class
CAF_CORE_EXPORT
backend
{
public:
virtual
~
backend
();
...
...
libcaf_core/caf/scheduled_actor.hpp
View file @
623f7571
...
...
@@ -251,6 +251,14 @@ public:
explicit
scheduled_actor
(
actor_config
&
cfg
);
scheduled_actor
(
scheduled_actor
&&
)
=
delete
;
scheduled_actor
(
const
scheduled_actor
&
)
=
delete
;
scheduled_actor
&
operator
=
(
scheduled_actor
&&
)
=
delete
;
scheduled_actor
&
operator
=
(
const
scheduled_actor
&
)
=
delete
;
~
scheduled_actor
()
override
;
// -- overridden functions of abstract_actor ---------------------------------
...
...
libcaf_core/caf/scheduler/profiled_coordinator.hpp
deleted
100644 → 0
View file @
bac7c902
This diff is collapsed.
Click to expand it.
libcaf_core/src/actor_system.cpp
View file @
623f7571
...
...
@@ -21,6 +21,7 @@
#include <unordered_set>
#include "caf/actor_system_config.hpp"
#include "caf/defaults.hpp"
#include "caf/event_based_actor.hpp"
#include "caf/raise_error.hpp"
#include "caf/raw_event_based_actor.hpp"
...
...
@@ -33,7 +34,6 @@
#include "caf/scheduler/coordinator.hpp"
#include "caf/scheduler/test_coordinator.hpp"
#include "caf/scheduler/abstract_coordinator.hpp"
#include "caf/scheduler/profiled_coordinator.hpp"
namespace
caf
{
...
...
@@ -240,17 +240,12 @@ actor_system::actor_system(actor_system_config& cfg)
using
policy
::
work_stealing
;
using
share
=
coordinator
<
work_sharing
>
;
using
steal
=
coordinator
<
work_stealing
>
;
using
profiled_share
=
profiled_coordinator
<
policy
::
profiled
<
work_sharing
>>
;
using
profiled_steal
=
profiled_coordinator
<
policy
::
profiled
<
work_stealing
>>
;
// set scheduler only if not explicitly loaded by user
if
(
!
sched
)
{
enum
sched_conf
{
stealing
=
0x0001
,
sharing
=
0x0002
,
testing
=
0x0003
,
profiled
=
0x0100
,
profiled_stealing
=
0x0101
,
profiled_sharing
=
0x0102
};
sched_conf
sc
=
stealing
;
namespace
sr
=
defaults
::
scheduler
;
...
...
@@ -264,8 +259,6 @@ actor_system::actor_system(actor_system_config& cfg)
<<
" is an unrecognized scheduler pollicy, "
"falling back to 'stealing' (i.e. work-stealing)"
<<
std
::
endl
;
if
(
get_or
(
cfg
,
"scheduler.enable-profiling"
,
false
))
sc
=
static_cast
<
sched_conf
>
(
sc
|
profiled
);
switch
(
sc
)
{
default:
// any invalid configuration falls back to work stealing
sched
.
reset
(
new
steal
(
*
this
));
...
...
@@ -273,12 +266,6 @@ actor_system::actor_system(actor_system_config& cfg)
case
sharing
:
sched
.
reset
(
new
share
(
*
this
));
break
;
case
profiled_stealing
:
sched
.
reset
(
new
profiled_steal
(
*
this
));
break
;
case
profiled_sharing
:
sched
.
reset
(
new
profiled_share
(
*
this
));
break
;
case
testing
:
sched
.
reset
(
new
test_coordinator
(
*
this
));
}
...
...
libcaf_core/src/ipv4_address.cpp
View file @
623f7571
...
...
@@ -18,6 +18,8 @@
#include "caf/ipv4_address.hpp"
#include <cstring>
#include "caf/detail/network_order.hpp"
#include "caf/detail/parser/read_ipv4_address.hpp"
#include "caf/error.hpp"
...
...
@@ -56,6 +58,11 @@ ipv4_address::ipv4_address() {
ipv4_address
::
ipv4_address
(
array_type
bytes
)
{
memcpy
(
bytes_
.
data
(),
bytes
.
data
(),
bytes
.
size
());
}
// -- comparison ---------------------------------------------------------------
int
ipv4_address
::
compare
(
ipv4_address
other
)
const
noexcept
{
return
memcmp
(
bytes
().
data
(),
other
.
bytes
().
data
(),
num_bytes
);
}
// -- properties ---------------------------------------------------------------
...
...
libcaf_core/src/ipv6_address.cpp
View file @
623f7571
...
...
@@ -18,6 +18,8 @@
#include "caf/ipv6_address.hpp"
#include <cstring>
#include "caf/detail/append_hex.hpp"
#include "caf/detail/network_order.hpp"
#include "caf/detail/parser/read_ipv6_address.hpp"
...
...
@@ -116,6 +118,12 @@ ipv6_address::ipv6_address(array_type bytes) {
memcpy
(
bytes_
.
data
(),
bytes
.
data
(),
bytes
.
size
());
}
// -- comparison ---------------------------------------------------------------
int
ipv6_address
::
compare
(
ipv6_address
other
)
const
noexcept
{
return
memcmp
(
bytes
().
data
(),
other
.
bytes
().
data
(),
num_bytes
);
}
int
ipv6_address
::
compare
(
ipv4_address
other
)
const
noexcept
{
ipv6_address
tmp
{
other
};
return
compare
(
tmp
);
...
...
libcaf_io/CMakeLists.txt
View file @
623f7571
# -- get header files for creating "proper" XCode projects ---------------------
file
(
GLOB_RECURSE
LIBCAF_IO_HD
RS
"caf/*.hpp"
)
file
(
GLOB_RECURSE
CAF_IO_HEADE
RS
"caf/*.hpp"
)
# -- auto generate to_string for enum types ------------------------------------
...
...
@@ -9,7 +9,7 @@ enum_to_string("caf/io/network/operation.hpp" "operation_to_string.cpp")
# -- list cpp files ------------------------------------------------------------
set
(
LIBCAF_IO_SRC
S
set
(
CAF_IO_SOURCE
S
"
${
CMAKE_CURRENT_BINARY_DIR
}
/message_type_to_string.cpp"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/operation_to_string.cpp"
src/detail/socket_guard.cpp
...
...
@@ -52,31 +52,38 @@ set(LIBCAF_IO_SRCS
src/policy/udp.cpp
)
set
(
CAF_IO_TEST_SOURCES
test/io/basp/message_queue.cpp
test/io/basp_broker.cpp
test/io/broker.cpp
test/io/http_broker.cpp
test/io/network/default_multiplexer.cpp
test/io/network/ip_endpoint.cpp
test/io/receive_buffer.cpp
test/io/remote_actor.cpp
test/io/remote_group.cpp
test/io/remote_spawn.cpp
test/io/unpublish.cpp
test/io/worker.cpp
)
# -- add library target --------------------------------------------------------
add_library
(
libcaf_io
${
LIBCAF_IO_SRCS
}
${
LIBCAF_IO_HDRS
}
)
add_library
(
libcaf_io_obj OBJECT
${
CAF_IO_SOURCES
}
${
CAF_IO_HEADERS
}
)
add_library
(
libcaf_io $<TARGET_OBJECTS:libcaf_io_obj>
)
add_library
(
caf::io ALIAS libcaf_io
)
# TODO: only exists for backwards compatibility, remove with CAF 0.19
if
(
BUILD_SHARED_LIBS
)
add_library
(
libcaf_io_shared ALIAS libcaf_io
)
else
()
add_library
(
libcaf_io_static ALIAS libcaf_io
)
endif
()
target_link_libraries
(
libcaf_io_obj PUBLIC caf::core
)
target_link_libraries
(
libcaf_io PUBLIC caf::core
)
generate_export_header
(
libcaf_io
generate_export_header
(
libcaf_io
_obj
EXPORT_MACRO_NAME CAF_IO_EXPORT
EXPORT_FILE_NAME
"caf/detail/io_export.hpp"
EXPORT_FILE_NAME
"
${
CMAKE_BINARY_DIR
}
/
caf/detail/io_export.hpp"
STATIC_DEFINE CAF_STATIC_BUILD
)
target_include_directories
(
libcaf_io PUBLIC
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_BINARY_DIR
}
>
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
>
$<INSTALL_INTERFACE:include>
)
set_target_properties
(
libcaf_io PROPERTIES
EXPORT_NAME io
SOVERSION
${
CAF_VERSION
}
...
...
@@ -85,10 +92,9 @@ set_target_properties(libcaf_io PROPERTIES
# -- install library and header files ------------------------------------------
install
(
FILES
"
${
CMAKE_
CURRENT_
BINARY_DIR
}
/caf/detail/io_export.hpp"
install
(
FILES
"
${
CMAKE_BINARY_DIR
}
/caf/detail/io_export.hpp"
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/caf/detail"
)
install
(
TARGETS libcaf_io
EXPORT CAFTargets
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT io
...
...
@@ -100,8 +106,31 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/caf"
COMPONENT io
FILES_MATCHING PATTERN
"*.hpp"
)
# -- build unit tests ----------------------------------------------------------
if
(
NOT CAF_NO_UNIT_TESTS
)
add_executable
(
caf-io-test
"
${
PROJECT_SOURCE_DIR
}
/libcaf_test/src/caf-test.cpp"
"
${
PROJECT_SOURCE_DIR
}
/libcaf_test/caf/test/unit_test.hpp"
"
${
PROJECT_SOURCE_DIR
}
/libcaf_test/caf/test/unit_test_impl.hpp"
${
CAF_IO_TEST_SOURCES
}
$<TARGET_OBJECTS:libcaf_io_obj>
)
target_link_libraries
(
caf-io-test caf::core
${
CAF_EXTRA_LDFLAGS
}
)
add_test_suites
(
caf-io-test
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
${
CAF_IO_TEST_SOURCES
}
)
endif
()
# -- add this library to the global CAF_LIBRARIES ------------------------------
list
(
APPEND CAF_LIBRARIES libcaf_io
)
set
(
CAF_LIBRARIES
${
CAF_LIBRARIES
}
PARENT_SCOPE
)
# -- backwards compatibility, TODO: remove -------------------------------------
if
(
BUILD_SHARED_LIBS
)
add_library
(
libcaf_io_shared ALIAS libcaf_io
)
else
()
add_library
(
libcaf_io_static ALIAS libcaf_io
)
endif
()
libcaf_io/caf/io/abstract_broker.hpp
View file @
623f7571
...
...
@@ -76,6 +76,14 @@ class middleman;
class
CAF_IO_EXPORT
abstract_broker
:
public
scheduled_actor
,
public
prohibit_top_level_spawn_marker
{
public:
abstract_broker
(
abstract_broker
&&
)
=
delete
;
abstract_broker
(
const
abstract_broker
&&
)
=
delete
;
abstract_broker
&
operator
=
(
abstract_broker
&&
)
=
delete
;
abstract_broker
&
operator
=
(
const
abstract_broker
&&
)
=
delete
;
~
abstract_broker
()
override
;
// even brokers need friends
...
...
libcaf_io/caf/io/broker.hpp
View file @
623f7571
...
...
@@ -81,6 +81,14 @@ public:
explicit
broker
(
actor_config
&
cfg
);
broker
(
broker
&&
)
=
delete
;
broker
(
const
broker
&
)
=
delete
;
broker
&
operator
=
(
broker
&&
)
=
delete
;
broker
&
operator
=
(
const
broker
&
)
=
delete
;
protected:
virtual
behavior
make_behavior
();
};
...
...
libcaf_io/caf/io/connection_helper.hpp
View file @
623f7571
...
...
@@ -18,22 +18,8 @@
#pragma once
#include <chrono>
#include "caf/actor_system_config.hpp"
#include "caf/after.hpp"
#include "caf/detail/io_export.hpp"
#include "caf/event_based_actor.hpp"
#include "caf/io/basp/all.hpp"
#include "caf/io/basp_broker.hpp"
#include "caf/io/broker.hpp"
#include "caf/io/datagram_handle.hpp"
#include "caf/io/middleman.hpp"
#include "caf/io/network/datagram_manager.hpp"
#include "caf/io/network/default_multiplexer.hpp"
#include "caf/io/network/interfaces.hpp"
#include "caf/io/system_messages.hpp"
#include "caf/stateful_actor.hpp"
#include "caf/fwd.hpp"
namespace
caf
{
namespace
io
{
...
...
libcaf_io/caf/io/middleman_actor_impl.hpp
View file @
623f7571
...
...
@@ -48,6 +48,14 @@ public:
middleman_actor_impl
(
actor_config
&
cfg
,
actor
default_broker
);
middleman_actor_impl
(
middleman_actor_impl
&&
)
=
delete
;
middleman_actor_impl
(
const
middleman_actor_impl
&
)
=
delete
;
middleman_actor_impl
&
operator
=
(
middleman_actor_impl
&&
)
=
delete
;
middleman_actor_impl
&
operator
=
(
const
middleman_actor_impl
&
)
=
delete
;
void
on_exit
()
override
;
const
char
*
name
()
const
override
;
...
...
libcaf_io/caf/io/network/default_multiplexer.hpp
View file @
623f7571
...
...
@@ -84,13 +84,13 @@ using multiplexer_poll_shadow_data = native_socket;
#endif // CAF_POLL_MULTIPLEXER
/// Defines the bitmask for input (read) socket events.
CAF_IO_EXPORT
extern
const
event_mask_type
input_mask
;
extern
const
event_mask_type
input_mask
;
/// Defines the bitmask for output (write) socket events.
CAF_IO_EXPORT
extern
const
event_mask_type
output_mask
;
extern
const
event_mask_type
output_mask
;
/// Defines the bitmask for error socket events.
CAF_IO_EXPORT
extern
const
event_mask_type
error_mask
;
extern
const
event_mask_type
error_mask
;
class
CAF_IO_EXPORT
default_multiplexer
:
public
multiplexer
{
public:
...
...
@@ -274,11 +274,11 @@ new_tcp_connection(const std::string& host, uint16_t port,
CAF_IO_EXPORT
expected
<
native_socket
>
new_tcp_acceptor_impl
(
uint16_t
port
,
const
char
*
addr
,
bool
reuse_addr
);
CAF_IO_EXPORT
expected
<
std
::
pair
<
native_socket
,
ip_endpoint
>>
expected
<
std
::
pair
<
native_socket
,
ip_endpoint
>>
new_remote_udp_endpoint_impl
(
const
std
::
string
&
host
,
uint16_t
port
,
optional
<
protocol
::
network
>
preferred
=
none
);
CAF_IO_EXPORT
expected
<
std
::
pair
<
native_socket
,
protocol
::
network
>>
expected
<
std
::
pair
<
native_socket
,
protocol
::
network
>>
new_local_udp_endpoint_impl
(
uint16_t
port
,
const
char
*
addr
,
bool
reuse_addr
=
false
,
optional
<
protocol
::
network
>
preferred
=
none
);
...
...
libcaf_io/caf/io/network/manager.hpp
View file @
623f7571
...
...
@@ -18,6 +18,7 @@
#pragma once
#include "caf/actor_control_block.hpp"
#include "caf/detail/io_export.hpp"
#include "caf/intrusive_ptr.hpp"
#include "caf/io/fwd.hpp"
...
...
libcaf_io/src/io/connection_helper.cpp
View file @
623f7571
...
...
@@ -19,9 +19,15 @@
#include "caf/io/connection_helper.hpp"
#include <chrono>
#include <string>
#include "caf/actor.hpp"
#include "caf/after.hpp"
#include "caf/defaults.hpp"
#include "caf/event_based_actor.hpp"
#include "caf/io/basp/instance.hpp"
#include "caf/io/network/interfaces.hpp"
#include "caf/stateful_actor.hpp"
namespace
caf
{
namespace
io
{
...
...
libcaf_openssl/CMakeLists.txt
View file @
623f7571
# -- get header files for creating "proper" XCode projects ---------------------
file
(
GLOB_RECURSE
LIBCAF_OPENSSL_HD
RS
"caf/*.hpp"
)
file
(
GLOB_RECURSE
CAF_OPENSSL_HEADE
RS
"caf/*.hpp"
)
# -- list cpp files ------------------------------------------------------------
set
(
LIBCAF_OPENSSL_SRC
S
set
(
CAF_OPENSSL_SOURCE
S
src/openssl/manager.cpp
src/openssl/middleman_actor.cpp
src/openssl/publish.cpp
...
...
@@ -12,34 +12,38 @@ set(LIBCAF_OPENSSL_SRCS
src/openssl/session.cpp
)
set
(
CAF_OPENSSL_TEST_SOURCES
test/openssl/authentication.cpp
test/openssl/remote_actor.cpp
)
# -- add library target --------------------------------------------------------
add_library
(
libcaf_openssl
${
LIBCAF_OPENSSL_SRCS
}
${
LIBCAF_OPENSSL_HDRS
}
)
add_library
(
libcaf_openssl_obj OBJECT
${
CAF_OPENSSL_SOURCES
}
${
CAF_OPENSSL_HEADERS
}
)
add_library
(
libcaf_openssl $<TARGET_OBJECTS:libcaf_openssl_obj>
)
add_library
(
caf::openssl ALIAS libcaf_openssl
)
# TODO: only exists for backwards compatibility, remove with CAF 0.19
if
(
BUILD_SHARED_LIBS
)
add_library
(
libcaf_openssl_shared ALIAS libcaf_openssl
)
else
()
add_library
(
libcaf_openssl_static ALIAS libcaf_openssl
)
endif
()
target_link_libraries
(
libcaf_openssl_obj PUBLIC
caf::core caf::io
${
OPENSSL_LIBRARIES
}
)
target_link_libraries
(
libcaf_openssl PUBLIC
caf::core caf::io
${
OPENSSL_LIBRARIES
}
)
if
(
NOT APPLE AND NOT WIN32
)
target_link_libraries
(
libcaf_openssl_obj PUBLIC
"-pthread"
)
target_link_libraries
(
libcaf_openssl PUBLIC
"-pthread"
)
endif
()
generate_export_header
(
libcaf_openssl
generate_export_header
(
libcaf_openssl
_obj
EXPORT_MACRO_NAME CAF_OPENSSL_EXPORT
EXPORT_FILE_NAME
"caf/detail/openssl_export.hpp"
EXPORT_FILE_NAME
"
${
CMAKE_BINARY_DIR
}
/
caf/detail/openssl_export.hpp"
STATIC_DEFINE CAF_STATIC_BUILD
)
target_include_directories
(
libcaf_openssl PUBLIC
$<BUILD_INTERFACE:
${
CMAKE_
CURRENT_
BINARY_DIR
}
>
$<BUILD_INTERFACE:
${
CMAKE_
CURRENT_
SOURCE_DIR
}
>
$<BUILD_INTERFACE:
${
CMAKE_BINARY_DIR
}
>
$<BUILD_INTERFACE:
${
CMAKE_SOURCE_DIR
}
>
$<INSTALL_INTERFACE:include>
)
set_target_properties
(
libcaf_openssl PROPERTIES
...
...
@@ -50,6 +54,9 @@ set_target_properties(libcaf_openssl PROPERTIES
# -- install library and header files ------------------------------------------
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/caf/detail/openssl_export.hpp"
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/caf/detail"
)
install
(
TARGETS libcaf_openssl
EXPORT CAFTargets
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT openssl
...
...
@@ -61,11 +68,32 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/caf"
COMPONENT openssl
FILES_MATCHING PATTERN
"*.hpp"
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/caf/detail/openssl_export.hpp"
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/caf/detail"
)
# -- build unit tests ----------------------------------------------------------
if
(
NOT CAF_NO_UNIT_TESTS
)
add_executable
(
caf-openssl-test
"
${
PROJECT_SOURCE_DIR
}
/libcaf_test/src/caf-test.cpp"
"
${
PROJECT_SOURCE_DIR
}
/libcaf_test/caf/test/unit_test.hpp"
"
${
PROJECT_SOURCE_DIR
}
/libcaf_test/caf/test/unit_test_impl.hpp"
${
CAF_OPENSSL_TEST_SOURCES
}
$<TARGET_OBJECTS:libcaf_openssl_obj>
)
target_link_libraries
(
caf-openssl-test caf::core caf::io
${
OPENSSL_LIBRARIES
}
${
CAF_EXTRA_LDFLAGS
}
)
add_test_suites
(
caf-openssl-test
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
${
CAF_OPENSSL_TEST_SOURCES
}
)
endif
()
# -- add this library to the global CAF_LIBRARIES ------------------------------
list
(
APPEND CAF_LIBRARIES libcaf_openssl
)
set
(
CAF_LIBRARIES
${
CAF_LIBRARIES
}
PARENT_SCOPE
)
# -- backwards compatibility, TODO: remove -------------------------------------
if
(
BUILD_SHARED_LIBS
)
add_library
(
libcaf_openssl_shared ALIAS libcaf_openssl
)
else
()
add_library
(
libcaf_openssl_static ALIAS libcaf_openssl
)
endif
()
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