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
1a35b53f
Commit
1a35b53f
authored
Jan 09, 2021
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up deprecation warning and manual line refs
parent
23182f0d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
78 additions
and
14 deletions
+78
-14
examples/message_passing/divider.cpp
examples/message_passing/divider.cpp
+31
-8
examples/message_passing/fixed_stack.cpp
examples/message_passing/fixed_stack.cpp
+37
-0
examples/remoting/distributed_calculator.cpp
examples/remoting/distributed_calculator.cpp
+2
-0
libcaf_core/caf/sec.hpp
libcaf_core/caf/sec.hpp
+2
-2
libcaf_io/caf/io/basp/message_type.hpp
libcaf_io/caf/io/basp/message_type.hpp
+2
-2
manual/ConfiguringActorApplications.rst
manual/ConfiguringActorApplications.rst
+2
-1
manual/Error.rst
manual/Error.rst
+2
-1
No files found.
examples/message_passing/divider.cpp
View file @
1a35b53f
...
...
@@ -2,18 +2,11 @@
* A very basic, interactive divider. *
\******************************************************************************/
// Manual refs: 17-19, 49-59, 70-76 (MessagePassing);
// 17-47 (Error)
#include <iostream>
#include "caf/all.hpp"
using
std
::
cout
;
using
std
::
endl
;
using
std
::
flush
;
using
namespace
caf
;
// --(rst-math-error-begin)--
enum
class
math_error
:
uint8_t
{
division_by_zero
=
1
,
};
...
...
@@ -27,6 +20,29 @@ std::string to_string(math_error x) {
}
}
bool
from_string
(
caf
::
string_view
in
,
math_error
&
out
)
{
if
(
in
==
"division_by_zero"
)
{
out
=
math_error
::
division_by_zero
;
return
true
;
}
else
{
return
false
;
}
}
bool
from_integer
(
uint8_t
in
,
math_error
&
out
)
{
if
(
in
==
1
)
{
out
=
math_error
::
division_by_zero
;
return
true
;
}
else
{
return
false
;
}
}
template
<
class
Inspector
>
bool
inspect
(
Inspector
&
f
,
math_error
&
x
)
{
return
caf
::
default_enum_inspect
(
f
,
x
);
}
CAF_BEGIN_TYPE_ID_BLOCK
(
divider
,
first_custom_type_id
)
CAF_ADD_TYPE_ID
(
divider
,
(
math_error
))
...
...
@@ -34,6 +50,13 @@ CAF_BEGIN_TYPE_ID_BLOCK(divider, first_custom_type_id)
CAF_END_TYPE_ID_BLOCK
(
divider
)
CAF_ERROR_CODE_ENUM
(
math_error
)
// --(rst-math-error-end)--
using
std
::
cout
;
using
std
::
endl
;
using
std
::
flush
;
using
namespace
caf
;
// --(rst-divider-begin)--
using
divider
=
typed_actor
<
result
<
double
>
(
div_atom
,
double
,
double
)
>
;
...
...
examples/message_passing/fixed_stack.cpp
View file @
1a35b53f
...
...
@@ -19,6 +19,43 @@ CAF_END_TYPE_ID_BLOCK(fixed_stack)
CAF_ERROR_CODE_ENUM
(
fixed_stack_errc
)
std
::
string
to_string
(
fixed_stack_errc
x
)
{
switch
(
x
)
{
case
fixed_stack_errc
:
:
push_to_full
:
return
"push_to_full"
;
case
fixed_stack_errc
:
:
pop_from_empty
:
return
"pop_from_empty"
;
default:
return
"-unknown-error-"
;
}
}
bool
from_string
(
caf
::
string_view
in
,
fixed_stack_errc
&
out
)
{
if
(
in
==
"push_to_full"
)
{
out
=
fixed_stack_errc
::
push_to_full
;
return
true
;
}
else
if
(
in
==
"pop_from_empty"
)
{
out
=
fixed_stack_errc
::
pop_from_empty
;
return
true
;
}
else
{
return
false
;
}
}
bool
from_integer
(
uint8_t
in
,
fixed_stack_errc
&
out
)
{
if
(
in
>
0
&&
in
<
1
)
{
out
=
static_cast
<
fixed_stack_errc
>
(
in
);
return
true
;
}
else
{
return
false
;
}
}
template
<
class
Inspector
>
bool
inspect
(
Inspector
&
f
,
fixed_stack_errc
&
x
)
{
return
caf
::
default_enum_inspect
(
f
,
x
);
}
using
std
::
endl
;
using
namespace
caf
;
...
...
examples/remoting/distributed_calculator.cpp
View file @
1a35b53f
...
...
@@ -203,6 +203,7 @@ optional<int> toint(const string& str) {
return
none
;
}
// --(rst-config-begin)--
class
config
:
public
actor_system_config
{
public:
uint16_t
port
=
0
;
...
...
@@ -216,6 +217,7 @@ public:
.
add
(
server_mode
,
"server-mode,s"
,
"enable server mode"
);
}
};
// --(rst-config-end)--
void
client_repl
(
actor_system
&
system
,
const
config
&
cfg
)
{
// keeps track of requests and tries to reconnect on server failures
...
...
libcaf_core/caf/sec.hpp
View file @
1a35b53f
...
...
@@ -172,8 +172,8 @@ CAF_CORE_EXPORT bool from_string(string_view, sec&);
CAF_CORE_EXPORT
bool
from_integer
(
std
::
underlying_type_t
<
sec
>
,
sec
&
);
/// @relates sec
template
<
class
Ins
s
ector
>
bool
inspect
(
Ins
s
ector
&
f
,
sec
&
x
)
{
template
<
class
Ins
p
ector
>
bool
inspect
(
Ins
p
ector
&
f
,
sec
&
x
)
{
return
default_enum_inspect
(
f
,
x
);
}
...
...
libcaf_io/caf/io/basp/message_type.hpp
View file @
1a35b53f
...
...
@@ -69,8 +69,8 @@ CAF_IO_EXPORT bool from_string(string_view, message_type&);
CAF_IO_EXPORT
bool
from_integer
(
std
::
underlying_type_t
<
message_type
>
,
message_type
&
);
template
<
class
Ins
s
ector
>
bool
inspect
(
Ins
s
ector
&
f
,
message_type
&
x
)
{
template
<
class
Ins
p
ector
>
bool
inspect
(
Ins
p
ector
&
f
,
message_type
&
x
)
{
return
default_enum_inspect
(
f
,
x
);
}
...
...
manual/ConfiguringActorApplications.rst
View file @
1a35b53f
...
...
@@ -135,7 +135,8 @@ adds three options to the ``global`` category.
.. literalinclude:: /examples/remoting/distributed_calculator.cpp
:language: C++
:lines: 206-218
:begin-after: --(rst-config-begin)--
:end-before: --(rst-config-end)--
We create a new ``global`` category in ``custom_options_``. Each following call
to ``add`` then appends individual options to the category. The first argument
...
...
manual/Error.rst
View file @
1a35b53f
...
...
@@ -51,7 +51,8 @@ called ``math_error``.
.. literalinclude:: /examples/message_passing/divider.cpp
:language: C++
:lines: 17-47
:start-after: --(rst-math-error-begin)--
:end-before: --(rst-math-error-end)--
.. _sec:
...
...
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