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
abd89335
Unverified
Commit
abd89335
authored
Sep 10, 2021
by
Noir
Committed by
GitHub
Sep 10, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1293
Replace C++ enum code generator with CMake script
parents
52914200
8c3afc04
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
166 additions
and
1437 deletions
+166
-1437
CMakeLists.txt
CMakeLists.txt
+22
-53
Jenkinsfile
Jenkinsfile
+0
-20
cmake/caf-generate-enum-strings.cmake
cmake/caf-generate-enum-strings.cmake
+142
-0
cmake/caf-generate-enum-strings.cpp
cmake/caf-generate-enum-strings.cpp
+0
-186
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+1
-9
libcaf_core/src/exit_reason_strings.cpp
libcaf_core/src/exit_reason_strings.cpp
+0
-89
libcaf_core/src/intrusive/inbox_result_strings.cpp
libcaf_core/src/intrusive/inbox_result_strings.cpp
+0
-59
libcaf_core/src/intrusive/task_result_strings.cpp
libcaf_core/src/intrusive/task_result_strings.cpp
+0
-65
libcaf_core/src/invoke_message_result_strings.cpp
libcaf_core/src/invoke_message_result_strings.cpp
+0
-59
libcaf_core/src/message_priority_strings.cpp
libcaf_core/src/message_priority_strings.cpp
+0
-53
libcaf_core/src/pec_strings.cpp
libcaf_core/src/pec_strings.cpp
+0
-179
libcaf_core/src/sec_strings.cpp
libcaf_core/src/sec_strings.cpp
+0
-449
libcaf_core/src/stream_priority_strings.cpp
libcaf_core/src/stream_priority_strings.cpp
+0
-71
libcaf_io/CMakeLists.txt
libcaf_io/CMakeLists.txt
+1
-3
libcaf_io/src/io/basp/message_type_strings.cpp
libcaf_io/src/io/basp/message_type_strings.cpp
+0
-83
libcaf_io/src/io/network/operation_strings.cpp
libcaf_io/src/io/network/operation_strings.cpp
+0
-59
No files found.
CMakeLists.txt
View file @
abd89335
...
...
@@ -25,7 +25,6 @@ option(CAF_ENABLE_CURL_EXAMPLES "Build examples with libcurl" OFF)
option
(
CAF_ENABLE_PROTOBUF_EXAMPLES
"Build examples with Google Protobuf"
OFF
)
option
(
CAF_ENABLE_QT6_EXAMPLES
"Build examples with the Qt6 framework"
OFF
)
option
(
CAF_ENABLE_RUNTIME_CHECKS
"Build CAF with extra runtime assertions"
OFF
)
option
(
CAF_ENABLE_UTILITY_TARGETS
"Include targets like consistency-check"
OFF
)
option
(
CAF_ENABLE_ACTOR_PROFILER
"Enable experimental profiler API"
OFF
)
# -- CAF options that are on by default ----------------------------------------
...
...
@@ -204,51 +203,24 @@ if(NOT TARGET uninstall)
COMMAND
${
CMAKE_COMMAND
}
-P
${
CMAKE_CURRENT_BINARY_DIR
}
/uninstall.cmake
)
endif
()
# -- utility targets -----------------------------------------------------------
if
(
CAF_ENABLE_UTILITY_TARGETS
)
add_executable
(
caf-generate-enum-strings
EXCLUDE_FROM_ALL
cmake/caf-generate-enum-strings.cpp
)
target_link_libraries
(
caf-generate-enum-strings PRIVATE CAF::internal
)
add_custom_target
(
consistency-check
)
add_custom_target
(
update-enum-strings
)
# adds a consistency check that verifies that `cpp_file` is still valid by
# re-generating the file and comparing it to the existing file
function
(
caf_add_enum_consistency_check hpp_file cpp_file
)
set
(
input
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
hpp_file
}
"
)
set
(
file_under_test
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
cpp_file
}
"
)
set
(
output
"
${
CMAKE_CURRENT_BINARY_DIR
}
/check/
${
cpp_file
}
"
)
get_filename_component
(
output_dir
"
${
output
}
"
DIRECTORY
)
file
(
MAKE_DIRECTORY
"
${
output_dir
}
"
)
add_custom_command
(
OUTPUT
"
${
output
}
"
COMMAND caf-generate-enum-strings
"
${
input
}
"
"
${
output
}
"
DEPENDS caf-generate-enum-strings
"
${
input
}
"
)
get_filename_component
(
target_name
"
${
input
}
"
NAME_WE
)
add_custom_target
(
"
${
target_name
}
"
COMMAND
"
${
CMAKE_COMMAND
}
"
"-Dfile_under_test=
${
file_under_test
}
"
"-Dgenerated_file=
${
output
}
"
-P
"
${
PROJECT_SOURCE_DIR
}
/cmake/check-consistency.cmake"
DEPENDS
"
${
output
}
"
)
add_dependencies
(
consistency-check
"
${
target_name
}
"
)
add_custom_target
(
"
${
target_name
}
-update"
COMMAND
caf-generate-enum-strings
"
${
input
}
"
"
${
file_under_test
}
"
DEPENDS caf-generate-enum-strings
"
${
input
}
"
)
add_dependencies
(
update-enum-strings
"
${
target_name
}
-update"
)
endfunction
()
else
()
function
(
caf_add_enum_consistency_check hpp_file cpp_file
)
# nop
endfunction
()
endif
()
# -- utility functions ---------------------------------------------------------
# generates the implementation file for the enum that contains to_string,
# from_string and from_integer
function
(
caf_add_enum_type target enum_name
)
string
(
REPLACE
"."
"/"
path
"
${
enum_name
}
"
)
set
(
hpp_file
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/caf/
${
path
}
.hpp"
)
set
(
cpp_file
"
${
CMAKE_CURRENT_BINARY_DIR
}
/src/
${
path
}
_strings.cpp"
)
set
(
gen_file
"
${
PROJECT_SOURCE_DIR
}
/cmake/caf-generate-enum-strings.cmake"
)
add_custom_command
(
OUTPUT
"
${
cpp_file
}
"
COMMAND
${
CMAKE_COMMAND
}
"-DINPUT_FILE=
${
hpp_file
}
"
"-DOUTPUT_FILE=
${
cpp_file
}
"
-P
"
${
gen_file
}
"
DEPENDS
"
${
hpp_file
}
"
"
${
gen_file
}
"
)
target_sources
(
${
target
}
PRIVATE
"
${
cpp_file
}
"
)
endfunction
()
function
(
caf_export_and_install_lib component
)
add_library
(
CAF::
${
component
}
ALIAS libcaf_
${
component
}
)
string
(
TOUPPER
"CAF_
${
component
}
_EXPORT"
export_macro_name
)
...
...
@@ -328,8 +300,7 @@ endfunction()
# ...
# )
function
(
caf_add_component name
)
set
(
varargs DEPENDENCIES HEADERS SOURCES TEST_SOURCES TEST_SUITES
ENUM_CONSISTENCY_CHECKS
)
set
(
varargs DEPENDENCIES HEADERS SOURCES TEST_SOURCES TEST_SUITES ENUM_TYPES
)
cmake_parse_arguments
(
CAF_ADD_COMPONENT
""
""
"
${
varargs
}
"
${
ARGN
}
)
if
(
NOT CAF_ADD_COMPONENT_HEADERS
)
message
(
FATAL_ERROR
"Cannot add CAF component without at least one header."
)
...
...
@@ -372,6 +343,11 @@ function(caf_add_component name)
set_property
(
TARGET
${
pub_lib_target
}
PROPERTY POSITION_INDEPENDENT_CODE ON
)
endif
()
target_link_libraries
(
${
pub_lib_target
}
${
CAF_ADD_COMPONENT_DEPENDENCIES
}
)
if
(
CAF_ADD_COMPONENT_ENUM_TYPES
)
foreach
(
enum_name
${
CAF_ADD_COMPONENT_ENUM_TYPES
}
)
caf_add_enum_type
(
${
obj_lib_target
}
${
enum_name
}
)
endforeach
()
endif
()
foreach
(
target
${
targets
}
)
target_compile_definitions
(
${
target
}
PRIVATE
"libcaf_
${
name
}
_EXPORTS"
)
target_include_directories
(
${
target
}
PRIVATE
...
...
@@ -384,13 +360,6 @@ function(caf_add_component name)
endif
()
endforeach
()
caf_export_and_install_lib
(
${
name
}
)
if
(
CAF_ADD_COMPONENT_ENUM_CONSISTENCY_CHECKS
)
foreach
(
enum_name
${
CAF_ADD_COMPONENT_ENUM_CONSISTENCY_CHECKS
}
)
string
(
REPLACE
"."
"/"
path
"
${
enum_name
}
"
)
caf_add_enum_consistency_check
(
"caf/
${
path
}
.hpp"
"src/
${
path
}
_strings.cpp"
)
endforeach
()
endif
()
endfunction
()
# -- build all components the user asked for -----------------------------------
...
...
Jenkinsfile
View file @
abd89335
...
...
@@ -167,26 +167,6 @@ pipeline {
runClangFormat
(
config
)
}
}
stage
(
'Check Consistency'
)
{
agent
{
label
'unix'
}
steps
{
deleteDir
()
unstash
(
'sources'
)
dir
(
'sources'
)
{
cmakeBuild
([
buildDir:
'build'
,
installation:
'cmake in search path'
,
sourceDir:
'.'
,
cmakeArgs:
'-DCAF_ENABLE_IO_MODULE:BOOL=OFF '
+
'-DCAF_ENABLE_UTILITY_TARGETS:BOOL=ON'
,
steps:
[[
args:
'--target consistency-check'
,
withCmake:
true
,
]],
])
}
}
}
stage
(
'Build'
)
{
steps
{
buildParallel
(
config
)
...
...
cmake/caf-generate-enum-strings.cmake
0 → 100644
View file @
abd89335
# seeks the beginning of the enum while also keeping track of namespaces
macro
(
seek_enum_mode
)
if
(
line MATCHES
"^namespace "
)
string
(
REGEX REPLACE
"^namespace ([a-zA-Z0-9:_]+).*$"
"
\\
1"
tmp
"
${
line
}
"
)
list
(
APPEND namespaces
"
${
tmp
}
"
)
elseif
(
line MATCHES
"^enum "
)
if
(
NOT namespaces
)
message
(
FATAL_ERROR
"enum found outside of a namespace"
)
endif
()
if
(
line MATCHES
"^enum class "
)
set
(
is_enum_class TRUE
)
endif
()
string
(
REGEX REPLACE
"^enum (class )?([0-9a-zA-Z_]+).*$"
"
\\
2"
enum_name
"
${
line
}
"
)
set
(
mode
"read_values"
)
endif
()
endmacro
()
# scans the input for enum values
macro
(
read_values_mode
)
if
(
line MATCHES
"^}"
)
set
(
mode
"generate"
)
elseif
(
line MATCHES
"^[0-9a-zA-Z_]+"
)
string
(
REGEX REPLACE
"^([0-9a-zA-Z_]+).*$"
"
\\
1"
tmp
"
${
line
}
"
)
list
(
APPEND enum_values
"
${
tmp
}
"
)
endif
()
endmacro
()
macro
(
write_enum_file
)
if
(
is_enum_class
)
set
(
label_prefix
"
${
enum_name
}
::"
)
else
()
set
(
label_prefix
""
)
endif
()
string
(
REPLACE
";"
"::"
namespace_str
"
${
namespaces
}
"
)
string
(
REPLACE
"::"
"/"
namespace_path
"
${
namespace_str
}
"
)
set
(
out
""
)
# File header and includes.
list
(
APPEND out
"#include
\"
caf/config.hpp
\"\n
"
"#include
\"
caf/string_view.hpp
\"\n
"
"
\n
"
"CAF_PUSH_DEPRECATED_WARNING
\n
"
"
\n
"
"#include
\"
${
namespace_path
}
/
${
enum_name
}
.hpp
\"\n
"
"
\n
"
"#include <string>
\n
"
"
\n
"
"namespace
${
namespace_str
}
{
\n
"
"
\n
"
)
# Generate to_string implementation.
list
(
APPEND out
"std::string to_string(
${
enum_name
}
x) {
\n
"
" switch (x) {
\n
"
" default:
\n
"
" return
\"
???
\"\;\n
"
)
foreach
(
label IN LISTS enum_values
)
list
(
APPEND out
" case
${
label_prefix
}${
label
}
:
\n
"
" return
\"
${
namespace_str
}
::
${
enum_name
}
::
${
label
}
\"\;\n
"
)
endforeach
()
list
(
APPEND out
" }
\n
"
"}
\n
"
"
\n
"
)
# Generate from_string implementation.
list
(
APPEND out
"bool from_string(string_view in,
${
enum_name
}
& out) {
\n
"
)
foreach
(
label IN LISTS enum_values
)
list
(
APPEND out
" if (in ==
\"
${
namespace_str
}
::
${
enum_name
}
::
${
label
}
\"
) {
\n
"
" out =
${
label_prefix
}${
label
}
\;\n
"
" return true
\;\n
"
" }
\n
"
)
endforeach
()
list
(
APPEND out
" return false
\;\n
"
"}
\n
"
"
\n
"
)
# Generate from_integer implementation.
list
(
APPEND out
"bool from_integer(std::underlying_type_t<
${
enum_name
}
> in,
\n
"
"
${
enum_name
}
& out) {
\n
"
" auto result = static_cast<
${
enum_name
}
>(in)
\;\n
"
" switch (result) {
\n
"
" default:
\n
"
" return false
\;\n
"
)
foreach
(
label IN LISTS enum_values
)
list
(
APPEND out
" case
${
label_prefix
}${
label
}
:
\n
"
)
endforeach
()
list
(
APPEND out
" out = result
\;\n
"
" return true
\;\n
"
" }
\n
"
"}
\n
"
"
\n
"
)
# File footer.
list
(
APPEND out
"} // namespace
${
namespace_str
}
\n
"
"
\n
"
)
file
(
WRITE
"
${
OUTPUT_FILE
}
"
${
out
}
)
endmacro
()
function
(
main
)
set
(
namespaces
""
)
set
(
enum_name
""
)
set
(
enum_values
""
)
set
(
is_enum_class FALSE
)
file
(
STRINGS
"
${
INPUT_FILE
}
"
lines
)
set
(
mode
"seek_enum"
)
foreach
(
line IN LISTS lines
)
string
(
REGEX REPLACE
"^(.+)(//.*)?"
"
\\
1"
line
"
${
line
}
"
)
string
(
STRIP
"
${
line
}
"
line
)
if
(
mode STREQUAL seek_enum
)
seek_enum_mode
()
elseif
(
mode STREQUAL read_values
)
read_values_mode
()
else
()
# reached the end
if
(
NOT enum_name
)
message
(
FATAL_ERROR
"No enum found in input file"
)
endif
()
if
(
NOT enum_values
)
message
(
FATAL_ERROR
"No enum values found for
${
enum_name
}
"
)
endif
()
write_enum_file
()
return
()
endif
()
endforeach
()
endfunction
()
# - check parameters and run ---------------------------------------------------
if
(
NOT INPUT_FILE
)
message
(
FATAL_ERROR
"Variable INPUT_FILE undefined"
)
endif
()
if
(
NOT OUTPUT_FILE
)
message
(
FATAL_ERROR
"Variable OUTPUT_FILE undefined"
)
endif
()
main
()
cmake/caf-generate-enum-strings.cpp
deleted
100644 → 0
View file @
52914200
// This file is part of CAF, the C++ Actor Framework. See the file LICENSE in
// the main distribution directory for license terms and copyright or visit
// https://github.com/actor-framework/actor-framework/blob/master/LICENSE.
#include <algorithm>
#include <cstring>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
using
std
::
cerr
;
using
std
::
find
;
using
std
::
find_if
;
using
std
::
string
;
using
std
::
vector
;
void
split
(
const
string
&
str
,
const
string
&
separator
,
vector
<
string
>&
dest
)
{
size_t
current
,
previous
=
0
;
current
=
str
.
find
(
separator
);
while
(
current
!=
std
::
string
::
npos
)
{
dest
.
emplace_back
(
str
.
substr
(
previous
,
current
-
previous
));
previous
=
current
+
separator
.
size
();
current
=
str
.
find
(
separator
,
previous
);
}
dest
.
push_back
(
str
.
substr
(
previous
,
current
-
previous
));
}
void
trim
(
string
&
str
)
{
auto
not_space
=
[](
char
c
)
{
return
isspace
(
c
)
==
0
;
};
str
.
erase
(
str
.
begin
(),
find_if
(
str
.
begin
(),
str
.
end
(),
not_space
));
str
.
erase
(
find_if
(
str
.
rbegin
(),
str
.
rend
(),
not_space
).
base
(),
str
.
end
());
}
template
<
size_t
N
>
bool
starts_with
(
const
string
&
str
,
const
char
(
&
prefix
)[
N
])
{
return
str
.
compare
(
0
,
N
-
1
,
prefix
)
==
0
;
}
template
<
size_t
N
>
void
drop_prefix
(
string
&
str
,
const
char
(
&
prefix
)[
N
])
{
if
(
str
.
compare
(
0
,
N
-
1
,
prefix
)
==
0
)
str
.
erase
(
str
.
begin
(),
str
.
begin
()
+
(
N
-
1
));
}
void
keep_alnum
(
string
&
str
)
{
auto
not_alnum
=
[](
char
c
)
{
return
isalnum
(
c
)
==
0
&&
c
!=
'_'
;
};
str
.
erase
(
find_if
(
str
.
begin
(),
str
.
end
(),
not_alnum
),
str
.
end
());
}
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
!=
3
)
{
cerr
<<
"wrong number of arguments.
\n
"
<<
"usage: "
<<
argv
[
0
]
<<
" input-file output-file
\n
"
;
return
EXIT_FAILURE
;
}
std
::
ifstream
in
{
argv
[
1
]};
if
(
!
in
)
{
cerr
<<
"unable to open input file: "
<<
argv
[
1
]
<<
'\n'
;
return
EXIT_FAILURE
;
}
vector
<
string
>
namespaces
;
string
enum_name
;
string
line
;
bool
is_enum_class
=
false
;
// Locate the beginning of the enum.
for
(;;)
{
if
(
!
getline
(
in
,
line
))
{
cerr
<<
"unable to locate enum in file: "
<<
argv
[
1
]
<<
'\n'
;
return
EXIT_FAILURE
;
}
trim
(
line
);
if
(
starts_with
(
line
,
"enum "
))
{
drop_prefix
(
line
,
"enum "
);
if
(
starts_with
(
line
,
"class "
))
{
is_enum_class
=
true
;
drop_prefix
(
line
,
"class "
);
}
trim
(
line
);
keep_alnum
(
line
);
enum_name
=
line
;
break
;
}
if
(
starts_with
(
line
,
"namespace "
))
{
if
(
line
.
back
()
==
'{'
)
line
.
pop_back
();
line
.
erase
(
line
.
begin
(),
find
(
line
.
begin
(),
line
.
end
(),
' '
));
trim
(
line
);
split
(
line
,
"::"
,
namespaces
);
}
}
// Sanity checking.
if
(
namespaces
.
empty
())
{
cerr
<<
"enum found outside of a namespace
\n
"
;
return
EXIT_FAILURE
;
}
auto
full_namespace
=
namespaces
[
0
];
for
(
size_t
index
=
1
;
index
<
namespaces
.
size
();
++
index
)
{
full_namespace
+=
"::"
;
full_namespace
+=
namespaces
[
index
];
}
auto
full_namespace_prefix
=
full_namespace
+
"::"
;
if
(
enum_name
.
empty
())
{
cerr
<<
"empty enum name found
\n
"
;
return
EXIT_FAILURE
;
}
std
::
string
case_label_prefix
;
if
(
is_enum_class
)
case_label_prefix
=
enum_name
+
"::"
;
// Read until hitting the closing '}'.
std
::
vector
<
std
::
string
>
enum_values
;
for
(;;)
{
if
(
!
getline
(
in
,
line
))
{
cerr
<<
"unable to read enum values
\n
"
;
return
EXIT_FAILURE
;
}
trim
(
line
);
if
(
line
.
empty
())
continue
;
if
(
line
[
0
]
==
'}'
)
break
;
if
(
line
[
0
]
!=
'/'
)
{
keep_alnum
(
line
);
enum_values
.
emplace_back
(
enum_name
+
"::"
+
line
);
}
}
// Generate output file.
std
::
ofstream
out
{
argv
[
2
]};
if
(
!
out
)
{
cerr
<<
"unable to open output file: "
<<
argv
[
2
]
<<
'\n'
;
return
EXIT_FAILURE
;
}
// Print file header.
out
<<
"// clang-format off
\n
"
<<
"// DO NOT EDIT: "
"this file is auto-generated by caf-generate-enum-strings.
\n
"
"// Run the target update-enum-strings if this file is out of sync.
\n
"
"#include
\"
caf/config.hpp
\"\n
"
"#include
\"
caf/string_view.hpp
\"\n\n
"
"CAF_PUSH_DEPRECATED_WARNING
\n\n
"
<<
"#include
\"
"
<<
namespaces
[
0
];
for
(
size_t
i
=
1
;
i
<
namespaces
.
size
();
++
i
)
out
<<
'/'
<<
namespaces
[
i
];
out
<<
'/'
<<
enum_name
<<
".hpp
\"\n\n
"
<<
"#include <string>
\n\n
"
<<
"namespace "
<<
full_namespace
<<
" {
\n
"
;
out
<<
'\n'
;
// Generate to_string implementation.
out
<<
"std::string to_string("
<<
enum_name
<<
" x) {
\n
"
<<
" switch(x) {
\n
"
<<
" default:
\n
"
<<
" return
\"
???
\"
;
\n
"
;
for
(
auto
&
val
:
enum_values
)
out
<<
" case "
<<
val
<<
":
\n
"
<<
" return
\"
"
<<
full_namespace_prefix
<<
val
<<
"
\"
;
\n
"
;
out
<<
" };
\n
"
<<
"}
\n\n
"
;
// Generate from_string implementation.
out
<<
"bool from_string(string_view in, "
<<
enum_name
<<
"& out) {
\n
"
;
for
(
auto
&
val
:
enum_values
)
out
<<
"if (in ==
\"
"
<<
full_namespace_prefix
<<
val
<<
"
\"
) {
\n
"
<<
" out = "
<<
val
<<
";
\n
"
<<
" return true;
\n
"
<<
" } else "
;
out
<<
"{
\n
"
<<
" return false;
\n
"
<<
" }
\n
"
<<
"}
\n\n
"
;
// Generate from_integer implementation.
out
<<
"bool from_integer(std::underlying_type_t<"
<<
enum_name
<<
"> in,
\n
"
<<
" "
<<
enum_name
<<
"& out) {
\n
"
<<
" auto result = static_cast<"
<<
enum_name
<<
">(in);
\n
"
<<
" switch(result) {
\n
"
<<
" default:
\n
"
<<
" return false;
\n
"
;
for
(
auto
&
val
:
enum_values
)
out
<<
" case "
<<
val
<<
":
\n
"
;
out
<<
" out = result;
\n
"
<<
" return true;
\n
"
<<
" };
\n
"
<<
"}
\n\n
"
;
// Done. Print file footer and exit.
out
<<
"} // namespace "
<<
full_namespace
<<
'\n'
;
out
<<
"
\n
CAF_POP_WARNINGS
\n
"
;
return
EXIT_SUCCESS
;
}
libcaf_core/CMakeLists.txt
View file @
abd89335
...
...
@@ -52,7 +52,7 @@ caf_add_component(
${
LIBCAF_CORE_OPTIONAL_DEPENDENCIES
}
PRIVATE
CAF::internal
ENUM_
CONSISTENCY_CHECK
S
ENUM_
TYPE
S
exit_reason
intrusive.inbox_result
intrusive.task_result
...
...
@@ -140,7 +140,6 @@ caf_add_component(
src/error.cpp
src/event_based_actor.cpp
src/execution_unit.cpp
src/exit_reason_strings.cpp
src/forwarding_actor_proxy.cpp
src/group.cpp
src/group_manager.cpp
...
...
@@ -148,9 +147,6 @@ caf_add_component(
src/hash/sha1.cpp
src/inbound_path.cpp
src/init_global_meta_objects.cpp
src/intrusive/inbox_result_strings.cpp
src/intrusive/task_result_strings.cpp
src/invoke_message_result_strings.cpp
src/ipv4_address.cpp
src/ipv4_endpoint.cpp
src/ipv4_subnet.cpp
...
...
@@ -168,11 +164,9 @@ caf_add_component(
src/message.cpp
src/message_builder.cpp
src/message_handler.cpp
src/message_priority_strings.cpp
src/monitorable_actor.cpp
src/node_id.cpp
src/outbound_path.cpp
src/pec_strings.cpp
src/policy/downstream_messages.cpp
src/policy/unprofiled.cpp
src/policy/work_sharing.cpp
...
...
@@ -189,13 +183,11 @@ caf_add_component(
src/scheduler/test_coordinator.cpp
src/scoped_actor.cpp
src/scoped_execution_unit.cpp
src/sec_strings.cpp
src/serializer.cpp
src/settings.cpp
src/skip.cpp
src/stream_aborter.cpp
src/stream_manager.cpp
src/stream_priority_strings.cpp
src/string_algorithms.cpp
src/string_view.cpp
src/telemetry/collector/prometheus.cpp
...
...
libcaf_core/src/exit_reason_strings.cpp
deleted
100644 → 0
View file @
52914200
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/exit_reason.hpp"
#include <string>
namespace
caf
{
std
::
string
to_string
(
exit_reason
x
)
{
switch
(
x
)
{
default:
return
"???"
;
case
exit_reason
:
:
normal
:
return
"caf::exit_reason::normal"
;
case
exit_reason
:
:
unhandled_exception
:
return
"caf::exit_reason::unhandled_exception"
;
case
exit_reason
:
:
unknown
:
return
"caf::exit_reason::unknown"
;
case
exit_reason
:
:
out_of_workers
:
return
"caf::exit_reason::out_of_workers"
;
case
exit_reason
:
:
user_shutdown
:
return
"caf::exit_reason::user_shutdown"
;
case
exit_reason
:
:
kill
:
return
"caf::exit_reason::kill"
;
case
exit_reason
:
:
remote_link_unreachable
:
return
"caf::exit_reason::remote_link_unreachable"
;
case
exit_reason
:
:
unreachable
:
return
"caf::exit_reason::unreachable"
;
};
}
bool
from_string
(
string_view
in
,
exit_reason
&
out
)
{
if
(
in
==
"caf::exit_reason::normal"
)
{
out
=
exit_reason
::
normal
;
return
true
;
}
else
if
(
in
==
"caf::exit_reason::unhandled_exception"
)
{
out
=
exit_reason
::
unhandled_exception
;
return
true
;
}
else
if
(
in
==
"caf::exit_reason::unknown"
)
{
out
=
exit_reason
::
unknown
;
return
true
;
}
else
if
(
in
==
"caf::exit_reason::out_of_workers"
)
{
out
=
exit_reason
::
out_of_workers
;
return
true
;
}
else
if
(
in
==
"caf::exit_reason::user_shutdown"
)
{
out
=
exit_reason
::
user_shutdown
;
return
true
;
}
else
if
(
in
==
"caf::exit_reason::kill"
)
{
out
=
exit_reason
::
kill
;
return
true
;
}
else
if
(
in
==
"caf::exit_reason::remote_link_unreachable"
)
{
out
=
exit_reason
::
remote_link_unreachable
;
return
true
;
}
else
if
(
in
==
"caf::exit_reason::unreachable"
)
{
out
=
exit_reason
::
unreachable
;
return
true
;
}
else
{
return
false
;
}
}
bool
from_integer
(
std
::
underlying_type_t
<
exit_reason
>
in
,
exit_reason
&
out
)
{
auto
result
=
static_cast
<
exit_reason
>
(
in
);
switch
(
result
)
{
default:
return
false
;
case
exit_reason
:
:
normal
:
case
exit_reason
:
:
unhandled_exception
:
case
exit_reason
:
:
unknown
:
case
exit_reason
:
:
out_of_workers
:
case
exit_reason
:
:
user_shutdown
:
case
exit_reason
:
:
kill
:
case
exit_reason
:
:
remote_link_unreachable
:
case
exit_reason
:
:
unreachable
:
out
=
result
;
return
true
;
};
}
}
// namespace caf
CAF_POP_WARNINGS
libcaf_core/src/intrusive/inbox_result_strings.cpp
deleted
100644 → 0
View file @
52914200
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/intrusive/inbox_result.hpp"
#include <string>
namespace
caf
::
intrusive
{
std
::
string
to_string
(
inbox_result
x
)
{
switch
(
x
)
{
default:
return
"???"
;
case
inbox_result
:
:
success
:
return
"caf::intrusive::inbox_result::success"
;
case
inbox_result
:
:
unblocked_reader
:
return
"caf::intrusive::inbox_result::unblocked_reader"
;
case
inbox_result
:
:
queue_closed
:
return
"caf::intrusive::inbox_result::queue_closed"
;
};
}
bool
from_string
(
string_view
in
,
inbox_result
&
out
)
{
if
(
in
==
"caf::intrusive::inbox_result::success"
)
{
out
=
inbox_result
::
success
;
return
true
;
}
else
if
(
in
==
"caf::intrusive::inbox_result::unblocked_reader"
)
{
out
=
inbox_result
::
unblocked_reader
;
return
true
;
}
else
if
(
in
==
"caf::intrusive::inbox_result::queue_closed"
)
{
out
=
inbox_result
::
queue_closed
;
return
true
;
}
else
{
return
false
;
}
}
bool
from_integer
(
std
::
underlying_type_t
<
inbox_result
>
in
,
inbox_result
&
out
)
{
auto
result
=
static_cast
<
inbox_result
>
(
in
);
switch
(
result
)
{
default:
return
false
;
case
inbox_result
:
:
success
:
case
inbox_result
:
:
unblocked_reader
:
case
inbox_result
:
:
queue_closed
:
out
=
result
;
return
true
;
};
}
}
// namespace caf::intrusive
CAF_POP_WARNINGS
libcaf_core/src/intrusive/task_result_strings.cpp
deleted
100644 → 0
View file @
52914200
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/intrusive/task_result.hpp"
#include <string>
namespace
caf
::
intrusive
{
std
::
string
to_string
(
task_result
x
)
{
switch
(
x
)
{
default:
return
"???"
;
case
task_result
:
:
resume
:
return
"caf::intrusive::task_result::resume"
;
case
task_result
:
:
skip
:
return
"caf::intrusive::task_result::skip"
;
case
task_result
:
:
stop
:
return
"caf::intrusive::task_result::stop"
;
case
task_result
:
:
stop_all
:
return
"caf::intrusive::task_result::stop_all"
;
};
}
bool
from_string
(
string_view
in
,
task_result
&
out
)
{
if
(
in
==
"caf::intrusive::task_result::resume"
)
{
out
=
task_result
::
resume
;
return
true
;
}
else
if
(
in
==
"caf::intrusive::task_result::skip"
)
{
out
=
task_result
::
skip
;
return
true
;
}
else
if
(
in
==
"caf::intrusive::task_result::stop"
)
{
out
=
task_result
::
stop
;
return
true
;
}
else
if
(
in
==
"caf::intrusive::task_result::stop_all"
)
{
out
=
task_result
::
stop_all
;
return
true
;
}
else
{
return
false
;
}
}
bool
from_integer
(
std
::
underlying_type_t
<
task_result
>
in
,
task_result
&
out
)
{
auto
result
=
static_cast
<
task_result
>
(
in
);
switch
(
result
)
{
default:
return
false
;
case
task_result
:
:
resume
:
case
task_result
:
:
skip
:
case
task_result
:
:
stop
:
case
task_result
:
:
stop_all
:
out
=
result
;
return
true
;
};
}
}
// namespace caf::intrusive
CAF_POP_WARNINGS
libcaf_core/src/invoke_message_result_strings.cpp
deleted
100644 → 0
View file @
52914200
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/invoke_message_result.hpp"
#include <string>
namespace
caf
{
std
::
string
to_string
(
invoke_message_result
x
)
{
switch
(
x
)
{
default:
return
"???"
;
case
invoke_message_result
:
:
consumed
:
return
"caf::invoke_message_result::consumed"
;
case
invoke_message_result
:
:
skipped
:
return
"caf::invoke_message_result::skipped"
;
case
invoke_message_result
:
:
dropped
:
return
"caf::invoke_message_result::dropped"
;
};
}
bool
from_string
(
string_view
in
,
invoke_message_result
&
out
)
{
if
(
in
==
"caf::invoke_message_result::consumed"
)
{
out
=
invoke_message_result
::
consumed
;
return
true
;
}
else
if
(
in
==
"caf::invoke_message_result::skipped"
)
{
out
=
invoke_message_result
::
skipped
;
return
true
;
}
else
if
(
in
==
"caf::invoke_message_result::dropped"
)
{
out
=
invoke_message_result
::
dropped
;
return
true
;
}
else
{
return
false
;
}
}
bool
from_integer
(
std
::
underlying_type_t
<
invoke_message_result
>
in
,
invoke_message_result
&
out
)
{
auto
result
=
static_cast
<
invoke_message_result
>
(
in
);
switch
(
result
)
{
default:
return
false
;
case
invoke_message_result
:
:
consumed
:
case
invoke_message_result
:
:
skipped
:
case
invoke_message_result
:
:
dropped
:
out
=
result
;
return
true
;
};
}
}
// namespace caf
CAF_POP_WARNINGS
libcaf_core/src/message_priority_strings.cpp
deleted
100644 → 0
View file @
52914200
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/message_priority.hpp"
#include <string>
namespace
caf
{
std
::
string
to_string
(
message_priority
x
)
{
switch
(
x
)
{
default:
return
"???"
;
case
message_priority
:
:
high
:
return
"caf::message_priority::high"
;
case
message_priority
:
:
normal
:
return
"caf::message_priority::normal"
;
};
}
bool
from_string
(
string_view
in
,
message_priority
&
out
)
{
if
(
in
==
"caf::message_priority::high"
)
{
out
=
message_priority
::
high
;
return
true
;
}
else
if
(
in
==
"caf::message_priority::normal"
)
{
out
=
message_priority
::
normal
;
return
true
;
}
else
{
return
false
;
}
}
bool
from_integer
(
std
::
underlying_type_t
<
message_priority
>
in
,
message_priority
&
out
)
{
auto
result
=
static_cast
<
message_priority
>
(
in
);
switch
(
result
)
{
default:
return
false
;
case
message_priority
:
:
high
:
case
message_priority
:
:
normal
:
out
=
result
;
return
true
;
};
}
}
// namespace caf
CAF_POP_WARNINGS
libcaf_core/src/pec_strings.cpp
deleted
100644 → 0
View file @
52914200
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/pec.hpp"
#include <string>
namespace
caf
{
std
::
string
to_string
(
pec
x
)
{
switch
(
x
)
{
default:
return
"???"
;
case
pec
:
:
success
:
return
"caf::pec::success"
;
case
pec
:
:
trailing_character
:
return
"caf::pec::trailing_character"
;
case
pec
:
:
unexpected_eof
:
return
"caf::pec::unexpected_eof"
;
case
pec
:
:
unexpected_character
:
return
"caf::pec::unexpected_character"
;
case
pec
:
:
timespan_overflow
:
return
"caf::pec::timespan_overflow"
;
case
pec
:
:
fractional_timespan
:
return
"caf::pec::fractional_timespan"
;
case
pec
:
:
too_many_characters
:
return
"caf::pec::too_many_characters"
;
case
pec
:
:
invalid_escape_sequence
:
return
"caf::pec::invalid_escape_sequence"
;
case
pec
:
:
unexpected_newline
:
return
"caf::pec::unexpected_newline"
;
case
pec
:
:
integer_overflow
:
return
"caf::pec::integer_overflow"
;
case
pec
:
:
integer_underflow
:
return
"caf::pec::integer_underflow"
;
case
pec
:
:
exponent_underflow
:
return
"caf::pec::exponent_underflow"
;
case
pec
:
:
exponent_overflow
:
return
"caf::pec::exponent_overflow"
;
case
pec
:
:
type_mismatch
:
return
"caf::pec::type_mismatch"
;
case
pec
:
:
not_an_option
:
return
"caf::pec::not_an_option"
;
case
pec
:
:
invalid_argument
:
return
"caf::pec::invalid_argument"
;
case
pec
:
:
missing_argument
:
return
"caf::pec::missing_argument"
;
case
pec
:
:
invalid_category
:
return
"caf::pec::invalid_category"
;
case
pec
:
:
invalid_field_name
:
return
"caf::pec::invalid_field_name"
;
case
pec
:
:
repeated_field_name
:
return
"caf::pec::repeated_field_name"
;
case
pec
:
:
missing_field
:
return
"caf::pec::missing_field"
;
case
pec
:
:
invalid_range_expression
:
return
"caf::pec::invalid_range_expression"
;
case
pec
:
:
invalid_state
:
return
"caf::pec::invalid_state"
;
};
}
bool
from_string
(
string_view
in
,
pec
&
out
)
{
if
(
in
==
"caf::pec::success"
)
{
out
=
pec
::
success
;
return
true
;
}
else
if
(
in
==
"caf::pec::trailing_character"
)
{
out
=
pec
::
trailing_character
;
return
true
;
}
else
if
(
in
==
"caf::pec::unexpected_eof"
)
{
out
=
pec
::
unexpected_eof
;
return
true
;
}
else
if
(
in
==
"caf::pec::unexpected_character"
)
{
out
=
pec
::
unexpected_character
;
return
true
;
}
else
if
(
in
==
"caf::pec::timespan_overflow"
)
{
out
=
pec
::
timespan_overflow
;
return
true
;
}
else
if
(
in
==
"caf::pec::fractional_timespan"
)
{
out
=
pec
::
fractional_timespan
;
return
true
;
}
else
if
(
in
==
"caf::pec::too_many_characters"
)
{
out
=
pec
::
too_many_characters
;
return
true
;
}
else
if
(
in
==
"caf::pec::invalid_escape_sequence"
)
{
out
=
pec
::
invalid_escape_sequence
;
return
true
;
}
else
if
(
in
==
"caf::pec::unexpected_newline"
)
{
out
=
pec
::
unexpected_newline
;
return
true
;
}
else
if
(
in
==
"caf::pec::integer_overflow"
)
{
out
=
pec
::
integer_overflow
;
return
true
;
}
else
if
(
in
==
"caf::pec::integer_underflow"
)
{
out
=
pec
::
integer_underflow
;
return
true
;
}
else
if
(
in
==
"caf::pec::exponent_underflow"
)
{
out
=
pec
::
exponent_underflow
;
return
true
;
}
else
if
(
in
==
"caf::pec::exponent_overflow"
)
{
out
=
pec
::
exponent_overflow
;
return
true
;
}
else
if
(
in
==
"caf::pec::type_mismatch"
)
{
out
=
pec
::
type_mismatch
;
return
true
;
}
else
if
(
in
==
"caf::pec::not_an_option"
)
{
out
=
pec
::
not_an_option
;
return
true
;
}
else
if
(
in
==
"caf::pec::invalid_argument"
)
{
out
=
pec
::
invalid_argument
;
return
true
;
}
else
if
(
in
==
"caf::pec::missing_argument"
)
{
out
=
pec
::
missing_argument
;
return
true
;
}
else
if
(
in
==
"caf::pec::invalid_category"
)
{
out
=
pec
::
invalid_category
;
return
true
;
}
else
if
(
in
==
"caf::pec::invalid_field_name"
)
{
out
=
pec
::
invalid_field_name
;
return
true
;
}
else
if
(
in
==
"caf::pec::repeated_field_name"
)
{
out
=
pec
::
repeated_field_name
;
return
true
;
}
else
if
(
in
==
"caf::pec::missing_field"
)
{
out
=
pec
::
missing_field
;
return
true
;
}
else
if
(
in
==
"caf::pec::invalid_range_expression"
)
{
out
=
pec
::
invalid_range_expression
;
return
true
;
}
else
if
(
in
==
"caf::pec::invalid_state"
)
{
out
=
pec
::
invalid_state
;
return
true
;
}
else
{
return
false
;
}
}
bool
from_integer
(
std
::
underlying_type_t
<
pec
>
in
,
pec
&
out
)
{
auto
result
=
static_cast
<
pec
>
(
in
);
switch
(
result
)
{
default:
return
false
;
case
pec
:
:
success
:
case
pec
:
:
trailing_character
:
case
pec
:
:
unexpected_eof
:
case
pec
:
:
unexpected_character
:
case
pec
:
:
timespan_overflow
:
case
pec
:
:
fractional_timespan
:
case
pec
:
:
too_many_characters
:
case
pec
:
:
invalid_escape_sequence
:
case
pec
:
:
unexpected_newline
:
case
pec
:
:
integer_overflow
:
case
pec
:
:
integer_underflow
:
case
pec
:
:
exponent_underflow
:
case
pec
:
:
exponent_overflow
:
case
pec
:
:
type_mismatch
:
case
pec
:
:
not_an_option
:
case
pec
:
:
invalid_argument
:
case
pec
:
:
missing_argument
:
case
pec
:
:
invalid_category
:
case
pec
:
:
invalid_field_name
:
case
pec
:
:
repeated_field_name
:
case
pec
:
:
missing_field
:
case
pec
:
:
invalid_range_expression
:
case
pec
:
:
invalid_state
:
out
=
result
;
return
true
;
};
}
}
// namespace caf
CAF_POP_WARNINGS
libcaf_core/src/sec_strings.cpp
deleted
100644 → 0
View file @
52914200
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/sec.hpp"
#include <string>
namespace
caf
{
std
::
string
to_string
(
sec
x
)
{
switch
(
x
)
{
default:
return
"???"
;
case
sec
:
:
none
:
return
"caf::sec::none"
;
case
sec
:
:
unexpected_message
:
return
"caf::sec::unexpected_message"
;
case
sec
:
:
unexpected_response
:
return
"caf::sec::unexpected_response"
;
case
sec
:
:
request_receiver_down
:
return
"caf::sec::request_receiver_down"
;
case
sec
:
:
request_timeout
:
return
"caf::sec::request_timeout"
;
case
sec
:
:
no_such_group_module
:
return
"caf::sec::no_such_group_module"
;
case
sec
:
:
no_actor_published_at_port
:
return
"caf::sec::no_actor_published_at_port"
;
case
sec
:
:
unexpected_actor_messaging_interface
:
return
"caf::sec::unexpected_actor_messaging_interface"
;
case
sec
:
:
state_not_serializable
:
return
"caf::sec::state_not_serializable"
;
case
sec
:
:
unsupported_sys_key
:
return
"caf::sec::unsupported_sys_key"
;
case
sec
:
:
unsupported_sys_message
:
return
"caf::sec::unsupported_sys_message"
;
case
sec
:
:
disconnect_during_handshake
:
return
"caf::sec::disconnect_during_handshake"
;
case
sec
:
:
cannot_forward_to_invalid_actor
:
return
"caf::sec::cannot_forward_to_invalid_actor"
;
case
sec
:
:
no_route_to_receiving_node
:
return
"caf::sec::no_route_to_receiving_node"
;
case
sec
:
:
failed_to_assign_scribe_from_handle
:
return
"caf::sec::failed_to_assign_scribe_from_handle"
;
case
sec
:
:
failed_to_assign_doorman_from_handle
:
return
"caf::sec::failed_to_assign_doorman_from_handle"
;
case
sec
:
:
cannot_close_invalid_port
:
return
"caf::sec::cannot_close_invalid_port"
;
case
sec
:
:
cannot_connect_to_node
:
return
"caf::sec::cannot_connect_to_node"
;
case
sec
:
:
cannot_open_port
:
return
"caf::sec::cannot_open_port"
;
case
sec
:
:
network_syscall_failed
:
return
"caf::sec::network_syscall_failed"
;
case
sec
:
:
invalid_argument
:
return
"caf::sec::invalid_argument"
;
case
sec
:
:
invalid_protocol_family
:
return
"caf::sec::invalid_protocol_family"
;
case
sec
:
:
cannot_publish_invalid_actor
:
return
"caf::sec::cannot_publish_invalid_actor"
;
case
sec
:
:
cannot_spawn_actor_from_arguments
:
return
"caf::sec::cannot_spawn_actor_from_arguments"
;
case
sec
:
:
end_of_stream
:
return
"caf::sec::end_of_stream"
;
case
sec
:
:
no_context
:
return
"caf::sec::no_context"
;
case
sec
:
:
unknown_type
:
return
"caf::sec::unknown_type"
;
case
sec
:
:
no_proxy_registry
:
return
"caf::sec::no_proxy_registry"
;
case
sec
:
:
runtime_error
:
return
"caf::sec::runtime_error"
;
case
sec
:
:
remote_linking_failed
:
return
"caf::sec::remote_linking_failed"
;
case
sec
:
:
cannot_add_upstream
:
return
"caf::sec::cannot_add_upstream"
;
case
sec
:
:
upstream_already_exists
:
return
"caf::sec::upstream_already_exists"
;
case
sec
:
:
invalid_upstream
:
return
"caf::sec::invalid_upstream"
;
case
sec
:
:
cannot_add_downstream
:
return
"caf::sec::cannot_add_downstream"
;
case
sec
:
:
downstream_already_exists
:
return
"caf::sec::downstream_already_exists"
;
case
sec
:
:
invalid_downstream
:
return
"caf::sec::invalid_downstream"
;
case
sec
:
:
no_downstream_stages_defined
:
return
"caf::sec::no_downstream_stages_defined"
;
case
sec
:
:
stream_init_failed
:
return
"caf::sec::stream_init_failed"
;
case
sec
:
:
invalid_stream_state
:
return
"caf::sec::invalid_stream_state"
;
case
sec
:
:
unhandled_stream_error
:
return
"caf::sec::unhandled_stream_error"
;
case
sec
:
:
bad_function_call
:
return
"caf::sec::bad_function_call"
;
case
sec
:
:
feature_disabled
:
return
"caf::sec::feature_disabled"
;
case
sec
:
:
cannot_open_file
:
return
"caf::sec::cannot_open_file"
;
case
sec
:
:
socket_invalid
:
return
"caf::sec::socket_invalid"
;
case
sec
:
:
socket_disconnected
:
return
"caf::sec::socket_disconnected"
;
case
sec
:
:
socket_operation_failed
:
return
"caf::sec::socket_operation_failed"
;
case
sec
:
:
unavailable_or_would_block
:
return
"caf::sec::unavailable_or_would_block"
;
case
sec
:
:
incompatible_versions
:
return
"caf::sec::incompatible_versions"
;
case
sec
:
:
incompatible_application_ids
:
return
"caf::sec::incompatible_application_ids"
;
case
sec
:
:
malformed_basp_message
:
return
"caf::sec::malformed_basp_message"
;
case
sec
:
:
serializing_basp_payload_failed
:
return
"caf::sec::serializing_basp_payload_failed"
;
case
sec
:
:
redundant_connection
:
return
"caf::sec::redundant_connection"
;
case
sec
:
:
remote_lookup_failed
:
return
"caf::sec::remote_lookup_failed"
;
case
sec
:
:
no_tracing_context
:
return
"caf::sec::no_tracing_context"
;
case
sec
:
:
all_requests_failed
:
return
"caf::sec::all_requests_failed"
;
case
sec
:
:
field_invariant_check_failed
:
return
"caf::sec::field_invariant_check_failed"
;
case
sec
:
:
field_value_synchronization_failed
:
return
"caf::sec::field_value_synchronization_failed"
;
case
sec
:
:
invalid_field_type
:
return
"caf::sec::invalid_field_type"
;
case
sec
:
:
unsafe_type
:
return
"caf::sec::unsafe_type"
;
case
sec
:
:
save_callback_failed
:
return
"caf::sec::save_callback_failed"
;
case
sec
:
:
load_callback_failed
:
return
"caf::sec::load_callback_failed"
;
case
sec
:
:
conversion_failed
:
return
"caf::sec::conversion_failed"
;
case
sec
:
:
connection_closed
:
return
"caf::sec::connection_closed"
;
case
sec
:
:
type_clash
:
return
"caf::sec::type_clash"
;
case
sec
:
:
unsupported_operation
:
return
"caf::sec::unsupported_operation"
;
case
sec
:
:
no_such_key
:
return
"caf::sec::no_such_key"
;
case
sec
:
:
broken_promise
:
return
"caf::sec::broken_promise"
;
case
sec
:
:
connection_timeout
:
return
"caf::sec::connection_timeout"
;
};
}
bool
from_string
(
string_view
in
,
sec
&
out
)
{
if
(
in
==
"caf::sec::none"
)
{
out
=
sec
::
none
;
return
true
;
}
else
if
(
in
==
"caf::sec::unexpected_message"
)
{
out
=
sec
::
unexpected_message
;
return
true
;
}
else
if
(
in
==
"caf::sec::unexpected_response"
)
{
out
=
sec
::
unexpected_response
;
return
true
;
}
else
if
(
in
==
"caf::sec::request_receiver_down"
)
{
out
=
sec
::
request_receiver_down
;
return
true
;
}
else
if
(
in
==
"caf::sec::request_timeout"
)
{
out
=
sec
::
request_timeout
;
return
true
;
}
else
if
(
in
==
"caf::sec::no_such_group_module"
)
{
out
=
sec
::
no_such_group_module
;
return
true
;
}
else
if
(
in
==
"caf::sec::no_actor_published_at_port"
)
{
out
=
sec
::
no_actor_published_at_port
;
return
true
;
}
else
if
(
in
==
"caf::sec::unexpected_actor_messaging_interface"
)
{
out
=
sec
::
unexpected_actor_messaging_interface
;
return
true
;
}
else
if
(
in
==
"caf::sec::state_not_serializable"
)
{
out
=
sec
::
state_not_serializable
;
return
true
;
}
else
if
(
in
==
"caf::sec::unsupported_sys_key"
)
{
out
=
sec
::
unsupported_sys_key
;
return
true
;
}
else
if
(
in
==
"caf::sec::unsupported_sys_message"
)
{
out
=
sec
::
unsupported_sys_message
;
return
true
;
}
else
if
(
in
==
"caf::sec::disconnect_during_handshake"
)
{
out
=
sec
::
disconnect_during_handshake
;
return
true
;
}
else
if
(
in
==
"caf::sec::cannot_forward_to_invalid_actor"
)
{
out
=
sec
::
cannot_forward_to_invalid_actor
;
return
true
;
}
else
if
(
in
==
"caf::sec::no_route_to_receiving_node"
)
{
out
=
sec
::
no_route_to_receiving_node
;
return
true
;
}
else
if
(
in
==
"caf::sec::failed_to_assign_scribe_from_handle"
)
{
out
=
sec
::
failed_to_assign_scribe_from_handle
;
return
true
;
}
else
if
(
in
==
"caf::sec::failed_to_assign_doorman_from_handle"
)
{
out
=
sec
::
failed_to_assign_doorman_from_handle
;
return
true
;
}
else
if
(
in
==
"caf::sec::cannot_close_invalid_port"
)
{
out
=
sec
::
cannot_close_invalid_port
;
return
true
;
}
else
if
(
in
==
"caf::sec::cannot_connect_to_node"
)
{
out
=
sec
::
cannot_connect_to_node
;
return
true
;
}
else
if
(
in
==
"caf::sec::cannot_open_port"
)
{
out
=
sec
::
cannot_open_port
;
return
true
;
}
else
if
(
in
==
"caf::sec::network_syscall_failed"
)
{
out
=
sec
::
network_syscall_failed
;
return
true
;
}
else
if
(
in
==
"caf::sec::invalid_argument"
)
{
out
=
sec
::
invalid_argument
;
return
true
;
}
else
if
(
in
==
"caf::sec::invalid_protocol_family"
)
{
out
=
sec
::
invalid_protocol_family
;
return
true
;
}
else
if
(
in
==
"caf::sec::cannot_publish_invalid_actor"
)
{
out
=
sec
::
cannot_publish_invalid_actor
;
return
true
;
}
else
if
(
in
==
"caf::sec::cannot_spawn_actor_from_arguments"
)
{
out
=
sec
::
cannot_spawn_actor_from_arguments
;
return
true
;
}
else
if
(
in
==
"caf::sec::end_of_stream"
)
{
out
=
sec
::
end_of_stream
;
return
true
;
}
else
if
(
in
==
"caf::sec::no_context"
)
{
out
=
sec
::
no_context
;
return
true
;
}
else
if
(
in
==
"caf::sec::unknown_type"
)
{
out
=
sec
::
unknown_type
;
return
true
;
}
else
if
(
in
==
"caf::sec::no_proxy_registry"
)
{
out
=
sec
::
no_proxy_registry
;
return
true
;
}
else
if
(
in
==
"caf::sec::runtime_error"
)
{
out
=
sec
::
runtime_error
;
return
true
;
}
else
if
(
in
==
"caf::sec::remote_linking_failed"
)
{
out
=
sec
::
remote_linking_failed
;
return
true
;
}
else
if
(
in
==
"caf::sec::cannot_add_upstream"
)
{
out
=
sec
::
cannot_add_upstream
;
return
true
;
}
else
if
(
in
==
"caf::sec::upstream_already_exists"
)
{
out
=
sec
::
upstream_already_exists
;
return
true
;
}
else
if
(
in
==
"caf::sec::invalid_upstream"
)
{
out
=
sec
::
invalid_upstream
;
return
true
;
}
else
if
(
in
==
"caf::sec::cannot_add_downstream"
)
{
out
=
sec
::
cannot_add_downstream
;
return
true
;
}
else
if
(
in
==
"caf::sec::downstream_already_exists"
)
{
out
=
sec
::
downstream_already_exists
;
return
true
;
}
else
if
(
in
==
"caf::sec::invalid_downstream"
)
{
out
=
sec
::
invalid_downstream
;
return
true
;
}
else
if
(
in
==
"caf::sec::no_downstream_stages_defined"
)
{
out
=
sec
::
no_downstream_stages_defined
;
return
true
;
}
else
if
(
in
==
"caf::sec::stream_init_failed"
)
{
out
=
sec
::
stream_init_failed
;
return
true
;
}
else
if
(
in
==
"caf::sec::invalid_stream_state"
)
{
out
=
sec
::
invalid_stream_state
;
return
true
;
}
else
if
(
in
==
"caf::sec::unhandled_stream_error"
)
{
out
=
sec
::
unhandled_stream_error
;
return
true
;
}
else
if
(
in
==
"caf::sec::bad_function_call"
)
{
out
=
sec
::
bad_function_call
;
return
true
;
}
else
if
(
in
==
"caf::sec::feature_disabled"
)
{
out
=
sec
::
feature_disabled
;
return
true
;
}
else
if
(
in
==
"caf::sec::cannot_open_file"
)
{
out
=
sec
::
cannot_open_file
;
return
true
;
}
else
if
(
in
==
"caf::sec::socket_invalid"
)
{
out
=
sec
::
socket_invalid
;
return
true
;
}
else
if
(
in
==
"caf::sec::socket_disconnected"
)
{
out
=
sec
::
socket_disconnected
;
return
true
;
}
else
if
(
in
==
"caf::sec::socket_operation_failed"
)
{
out
=
sec
::
socket_operation_failed
;
return
true
;
}
else
if
(
in
==
"caf::sec::unavailable_or_would_block"
)
{
out
=
sec
::
unavailable_or_would_block
;
return
true
;
}
else
if
(
in
==
"caf::sec::incompatible_versions"
)
{
out
=
sec
::
incompatible_versions
;
return
true
;
}
else
if
(
in
==
"caf::sec::incompatible_application_ids"
)
{
out
=
sec
::
incompatible_application_ids
;
return
true
;
}
else
if
(
in
==
"caf::sec::malformed_basp_message"
)
{
out
=
sec
::
malformed_basp_message
;
return
true
;
}
else
if
(
in
==
"caf::sec::serializing_basp_payload_failed"
)
{
out
=
sec
::
serializing_basp_payload_failed
;
return
true
;
}
else
if
(
in
==
"caf::sec::redundant_connection"
)
{
out
=
sec
::
redundant_connection
;
return
true
;
}
else
if
(
in
==
"caf::sec::remote_lookup_failed"
)
{
out
=
sec
::
remote_lookup_failed
;
return
true
;
}
else
if
(
in
==
"caf::sec::no_tracing_context"
)
{
out
=
sec
::
no_tracing_context
;
return
true
;
}
else
if
(
in
==
"caf::sec::all_requests_failed"
)
{
out
=
sec
::
all_requests_failed
;
return
true
;
}
else
if
(
in
==
"caf::sec::field_invariant_check_failed"
)
{
out
=
sec
::
field_invariant_check_failed
;
return
true
;
}
else
if
(
in
==
"caf::sec::field_value_synchronization_failed"
)
{
out
=
sec
::
field_value_synchronization_failed
;
return
true
;
}
else
if
(
in
==
"caf::sec::invalid_field_type"
)
{
out
=
sec
::
invalid_field_type
;
return
true
;
}
else
if
(
in
==
"caf::sec::unsafe_type"
)
{
out
=
sec
::
unsafe_type
;
return
true
;
}
else
if
(
in
==
"caf::sec::save_callback_failed"
)
{
out
=
sec
::
save_callback_failed
;
return
true
;
}
else
if
(
in
==
"caf::sec::load_callback_failed"
)
{
out
=
sec
::
load_callback_failed
;
return
true
;
}
else
if
(
in
==
"caf::sec::conversion_failed"
)
{
out
=
sec
::
conversion_failed
;
return
true
;
}
else
if
(
in
==
"caf::sec::connection_closed"
)
{
out
=
sec
::
connection_closed
;
return
true
;
}
else
if
(
in
==
"caf::sec::type_clash"
)
{
out
=
sec
::
type_clash
;
return
true
;
}
else
if
(
in
==
"caf::sec::unsupported_operation"
)
{
out
=
sec
::
unsupported_operation
;
return
true
;
}
else
if
(
in
==
"caf::sec::no_such_key"
)
{
out
=
sec
::
no_such_key
;
return
true
;
}
else
if
(
in
==
"caf::sec::broken_promise"
)
{
out
=
sec
::
broken_promise
;
return
true
;
}
else
if
(
in
==
"caf::sec::connection_timeout"
)
{
out
=
sec
::
connection_timeout
;
return
true
;
}
else
{
return
false
;
}
}
bool
from_integer
(
std
::
underlying_type_t
<
sec
>
in
,
sec
&
out
)
{
auto
result
=
static_cast
<
sec
>
(
in
);
switch
(
result
)
{
default:
return
false
;
case
sec
:
:
none
:
case
sec
:
:
unexpected_message
:
case
sec
:
:
unexpected_response
:
case
sec
:
:
request_receiver_down
:
case
sec
:
:
request_timeout
:
case
sec
:
:
no_such_group_module
:
case
sec
:
:
no_actor_published_at_port
:
case
sec
:
:
unexpected_actor_messaging_interface
:
case
sec
:
:
state_not_serializable
:
case
sec
:
:
unsupported_sys_key
:
case
sec
:
:
unsupported_sys_message
:
case
sec
:
:
disconnect_during_handshake
:
case
sec
:
:
cannot_forward_to_invalid_actor
:
case
sec
:
:
no_route_to_receiving_node
:
case
sec
:
:
failed_to_assign_scribe_from_handle
:
case
sec
:
:
failed_to_assign_doorman_from_handle
:
case
sec
:
:
cannot_close_invalid_port
:
case
sec
:
:
cannot_connect_to_node
:
case
sec
:
:
cannot_open_port
:
case
sec
:
:
network_syscall_failed
:
case
sec
:
:
invalid_argument
:
case
sec
:
:
invalid_protocol_family
:
case
sec
:
:
cannot_publish_invalid_actor
:
case
sec
:
:
cannot_spawn_actor_from_arguments
:
case
sec
:
:
end_of_stream
:
case
sec
:
:
no_context
:
case
sec
:
:
unknown_type
:
case
sec
:
:
no_proxy_registry
:
case
sec
:
:
runtime_error
:
case
sec
:
:
remote_linking_failed
:
case
sec
:
:
cannot_add_upstream
:
case
sec
:
:
upstream_already_exists
:
case
sec
:
:
invalid_upstream
:
case
sec
:
:
cannot_add_downstream
:
case
sec
:
:
downstream_already_exists
:
case
sec
:
:
invalid_downstream
:
case
sec
:
:
no_downstream_stages_defined
:
case
sec
:
:
stream_init_failed
:
case
sec
:
:
invalid_stream_state
:
case
sec
:
:
unhandled_stream_error
:
case
sec
:
:
bad_function_call
:
case
sec
:
:
feature_disabled
:
case
sec
:
:
cannot_open_file
:
case
sec
:
:
socket_invalid
:
case
sec
:
:
socket_disconnected
:
case
sec
:
:
socket_operation_failed
:
case
sec
:
:
unavailable_or_would_block
:
case
sec
:
:
incompatible_versions
:
case
sec
:
:
incompatible_application_ids
:
case
sec
:
:
malformed_basp_message
:
case
sec
:
:
serializing_basp_payload_failed
:
case
sec
:
:
redundant_connection
:
case
sec
:
:
remote_lookup_failed
:
case
sec
:
:
no_tracing_context
:
case
sec
:
:
all_requests_failed
:
case
sec
:
:
field_invariant_check_failed
:
case
sec
:
:
field_value_synchronization_failed
:
case
sec
:
:
invalid_field_type
:
case
sec
:
:
unsafe_type
:
case
sec
:
:
save_callback_failed
:
case
sec
:
:
load_callback_failed
:
case
sec
:
:
conversion_failed
:
case
sec
:
:
connection_closed
:
case
sec
:
:
type_clash
:
case
sec
:
:
unsupported_operation
:
case
sec
:
:
no_such_key
:
case
sec
:
:
broken_promise
:
case
sec
:
:
connection_timeout
:
out
=
result
;
return
true
;
};
}
}
// namespace caf
CAF_POP_WARNINGS
libcaf_core/src/stream_priority_strings.cpp
deleted
100644 → 0
View file @
52914200
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/stream_priority.hpp"
#include <string>
namespace
caf
{
std
::
string
to_string
(
stream_priority
x
)
{
switch
(
x
)
{
default:
return
"???"
;
case
stream_priority
:
:
very_high
:
return
"caf::stream_priority::very_high"
;
case
stream_priority
:
:
high
:
return
"caf::stream_priority::high"
;
case
stream_priority
:
:
normal
:
return
"caf::stream_priority::normal"
;
case
stream_priority
:
:
low
:
return
"caf::stream_priority::low"
;
case
stream_priority
:
:
very_low
:
return
"caf::stream_priority::very_low"
;
};
}
bool
from_string
(
string_view
in
,
stream_priority
&
out
)
{
if
(
in
==
"caf::stream_priority::very_high"
)
{
out
=
stream_priority
::
very_high
;
return
true
;
}
else
if
(
in
==
"caf::stream_priority::high"
)
{
out
=
stream_priority
::
high
;
return
true
;
}
else
if
(
in
==
"caf::stream_priority::normal"
)
{
out
=
stream_priority
::
normal
;
return
true
;
}
else
if
(
in
==
"caf::stream_priority::low"
)
{
out
=
stream_priority
::
low
;
return
true
;
}
else
if
(
in
==
"caf::stream_priority::very_low"
)
{
out
=
stream_priority
::
very_low
;
return
true
;
}
else
{
return
false
;
}
}
bool
from_integer
(
std
::
underlying_type_t
<
stream_priority
>
in
,
stream_priority
&
out
)
{
auto
result
=
static_cast
<
stream_priority
>
(
in
);
switch
(
result
)
{
default:
return
false
;
case
stream_priority
:
:
very_high
:
case
stream_priority
:
:
high
:
case
stream_priority
:
:
normal
:
case
stream_priority
:
:
low
:
case
stream_priority
:
:
very_low
:
out
=
result
;
return
true
;
};
}
}
// namespace caf
CAF_POP_WARNINGS
libcaf_io/CMakeLists.txt
View file @
abd89335
...
...
@@ -12,7 +12,7 @@ caf_add_component(
$<$<CXX_COMPILER_ID:MSVC>:ws2_32>
PRIVATE
CAF::internal
ENUM_
CONSISTENCY_CHECK
S
ENUM_
TYPE
S
io.basp.message_type
io.network.operation
HEADERS
...
...
@@ -25,7 +25,6 @@ caf_add_component(
src/io/basp/header.cpp
src/io/basp/instance.cpp
src/io/basp/message_queue.cpp
src/io/basp/message_type_strings.cpp
src/io/basp/routing_table.cpp
src/io/basp/worker.cpp
src/io/basp_broker.cpp
...
...
@@ -49,7 +48,6 @@ caf_add_component(
src/io/network/manager.cpp
src/io/network/multiplexer.cpp
src/io/network/native_socket.cpp
src/io/network/operation_strings.cpp
src/io/network/pipe_reader.cpp
src/io/network/protocol.cpp
src/io/network/receive_buffer.cpp
...
...
libcaf_io/src/io/basp/message_type_strings.cpp
deleted
100644 → 0
View file @
52914200
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/io/basp/message_type.hpp"
#include <string>
namespace
caf
::
io
::
basp
{
std
::
string
to_string
(
message_type
x
)
{
switch
(
x
)
{
default:
return
"???"
;
case
message_type
:
:
server_handshake
:
return
"caf::io::basp::message_type::server_handshake"
;
case
message_type
:
:
client_handshake
:
return
"caf::io::basp::message_type::client_handshake"
;
case
message_type
:
:
direct_message
:
return
"caf::io::basp::message_type::direct_message"
;
case
message_type
:
:
routed_message
:
return
"caf::io::basp::message_type::routed_message"
;
case
message_type
:
:
monitor_message
:
return
"caf::io::basp::message_type::monitor_message"
;
case
message_type
:
:
down_message
:
return
"caf::io::basp::message_type::down_message"
;
case
message_type
:
:
heartbeat
:
return
"caf::io::basp::message_type::heartbeat"
;
};
}
bool
from_string
(
string_view
in
,
message_type
&
out
)
{
if
(
in
==
"caf::io::basp::message_type::server_handshake"
)
{
out
=
message_type
::
server_handshake
;
return
true
;
}
else
if
(
in
==
"caf::io::basp::message_type::client_handshake"
)
{
out
=
message_type
::
client_handshake
;
return
true
;
}
else
if
(
in
==
"caf::io::basp::message_type::direct_message"
)
{
out
=
message_type
::
direct_message
;
return
true
;
}
else
if
(
in
==
"caf::io::basp::message_type::routed_message"
)
{
out
=
message_type
::
routed_message
;
return
true
;
}
else
if
(
in
==
"caf::io::basp::message_type::monitor_message"
)
{
out
=
message_type
::
monitor_message
;
return
true
;
}
else
if
(
in
==
"caf::io::basp::message_type::down_message"
)
{
out
=
message_type
::
down_message
;
return
true
;
}
else
if
(
in
==
"caf::io::basp::message_type::heartbeat"
)
{
out
=
message_type
::
heartbeat
;
return
true
;
}
else
{
return
false
;
}
}
bool
from_integer
(
std
::
underlying_type_t
<
message_type
>
in
,
message_type
&
out
)
{
auto
result
=
static_cast
<
message_type
>
(
in
);
switch
(
result
)
{
default:
return
false
;
case
message_type
:
:
server_handshake
:
case
message_type
:
:
client_handshake
:
case
message_type
:
:
direct_message
:
case
message_type
:
:
routed_message
:
case
message_type
:
:
monitor_message
:
case
message_type
:
:
down_message
:
case
message_type
:
:
heartbeat
:
out
=
result
;
return
true
;
};
}
}
// namespace caf::io::basp
CAF_POP_WARNINGS
libcaf_io/src/io/network/operation_strings.cpp
deleted
100644 → 0
View file @
52914200
// clang-format off
// DO NOT EDIT: this file is auto-generated by caf-generate-enum-strings.
// Run the target update-enum-strings if this file is out of sync.
#include "caf/config.hpp"
#include "caf/string_view.hpp"
CAF_PUSH_DEPRECATED_WARNING
#include "caf/io/network/operation.hpp"
#include <string>
namespace
caf
::
io
::
network
{
std
::
string
to_string
(
operation
x
)
{
switch
(
x
)
{
default:
return
"???"
;
case
operation
:
:
read
:
return
"caf::io::network::operation::read"
;
case
operation
:
:
write
:
return
"caf::io::network::operation::write"
;
case
operation
:
:
propagate_error
:
return
"caf::io::network::operation::propagate_error"
;
};
}
bool
from_string
(
string_view
in
,
operation
&
out
)
{
if
(
in
==
"caf::io::network::operation::read"
)
{
out
=
operation
::
read
;
return
true
;
}
else
if
(
in
==
"caf::io::network::operation::write"
)
{
out
=
operation
::
write
;
return
true
;
}
else
if
(
in
==
"caf::io::network::operation::propagate_error"
)
{
out
=
operation
::
propagate_error
;
return
true
;
}
else
{
return
false
;
}
}
bool
from_integer
(
std
::
underlying_type_t
<
operation
>
in
,
operation
&
out
)
{
auto
result
=
static_cast
<
operation
>
(
in
);
switch
(
result
)
{
default:
return
false
;
case
operation
:
:
read
:
case
operation
:
:
write
:
case
operation
:
:
propagate_error
:
out
=
result
;
return
true
;
};
}
}
// namespace caf::io::network
CAF_POP_WARNINGS
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