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
02b6648f
Commit
02b6648f
authored
May 24, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorganize examples, add high prio example
parent
c57e7e92
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
62 additions
and
23 deletions
+62
-23
examples/CMakeLists.txt
examples/CMakeLists.txt
+37
-23
examples/broker/protobuf_broker.cpp
examples/broker/protobuf_broker.cpp
+0
-0
examples/broker/simple_broker.cpp
examples/broker/simple_broker.cpp
+0
-0
examples/broker/simple_http_broker.cpp
examples/broker/simple_http_broker.cpp
+0
-0
examples/custom_type/custom_types_1.cpp
examples/custom_type/custom_types_1.cpp
+0
-0
examples/custom_type/custom_types_2.cpp
examples/custom_type/custom_types_2.cpp
+0
-0
examples/custom_type/custom_types_3.cpp
examples/custom_type/custom_types_3.cpp
+0
-0
examples/message_passing/prioritizing.cpp
examples/message_passing/prioritizing.cpp
+25
-0
examples/remoting/distributed_calculator.cpp
examples/remoting/distributed_calculator.cpp
+0
-0
examples/remoting/group_chat.cpp
examples/remoting/group_chat.cpp
+0
-0
examples/remoting/group_server.cpp
examples/remoting/group_server.cpp
+0
-0
examples/remoting/pingpong.proto
examples/remoting/pingpong.proto
+0
-0
No files found.
examples/CMakeLists.txt
View file @
02b6648f
...
@@ -11,7 +11,7 @@ else ()
...
@@ -11,7 +11,7 @@ else ()
set
(
WSLIB
)
set
(
WSLIB
)
endif
()
endif
()
macro
(
add
name folder
)
macro
(
add
folder name
)
add_executable
(
${
name
}
${
folder
}
/
${
name
}
.cpp
${
ARGN
}
)
add_executable
(
${
name
}
${
folder
}
/
${
name
}
.cpp
${
ARGN
}
)
target_link_libraries
(
${
name
}
target_link_libraries
(
${
name
}
${
LD_FLAGS
}
${
LD_FLAGS
}
...
@@ -22,32 +22,46 @@ macro(add name folder)
...
@@ -22,32 +22,46 @@ macro(add name folder)
add_dependencies
(
${
name
}
all_examples
)
add_dependencies
(
${
name
}
all_examples
)
endmacro
()
endmacro
()
add
(
custom_types_1 custom_types
)
# introductionary applications
add
(
custom_types_2 custom_types
)
add
(
. aout
)
add
(
custom_types_3 custom_types
)
add
(
. hello_world
)
add
(
dancing_kirby message_passing
)
add
(
request message_passing
)
# basic message passing primitives
add
(
delegating message_passing
)
add
(
message_passing cell
)
add
(
fixed_stack message_passing
)
add
(
message_passing divider
)
add
(
cell message_passing
)
add
(
message_passing request
)
add
(
divider message_passing
)
add
(
message_passing calculator
)
add
(
hello_world .
)
add
(
message_passing delegating
)
add
(
aout .
)
add
(
message_passing fixed_stack
)
add
(
calculator message_passing
)
add
(
message_passing prioritizing
)
add
(
distributed_calculator remote_actors
)
add
(
message_passing dancing_kirby
)
add
(
group_server remote_actors
)
add
(
group_chat remote_actors
)
# dynamic behavior changes using 'become'
add
(
simple_broker brokers
)
add
(
dynamic_behavior skip_messages
)
add
(
simple_http_broker brokers
)
add
(
dynamic_behavior dining_philosophers
)
add
(
dining_philosophers dynamic_behavior
)
add
(
skip_messages dynamic_behavior
)
# composing actors using states or other actors
add
(
calculator_behavior composition
)
add
(
composition calculator_behavior
)
add
(
dictionary_behavior composition
)
add
(
composition dictionary_behavior
)
# adding custom message types
add
(
custom_type custom_types_1
)
add
(
custom_type custom_types_2
)
add
(
custom_type custom_types_3
)
# basic remoting
add
(
remoting group_chat
)
add
(
remoting group_server
)
add
(
remoting distributed_calculator
)
# basic I/O with brokers
add
(
broker simple_broker
)
add
(
broker simple_http_broker
)
if
(
NOT CAF_NO_PROTOBUF_EXAMPLES
)
if
(
NOT CAF_NO_PROTOBUF_EXAMPLES
)
find_package
(
Protobuf
)
find_package
(
Protobuf
)
if
(
PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE
)
if
(
PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE
)
PROTOBUF_GENERATE_CPP
(
ProtoSources ProtoHeaders
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/remot
e_actors
/pingpong.proto"
)
PROTOBUF_GENERATE_CPP
(
ProtoSources ProtoHeaders
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/remot
ing
/pingpong.proto"
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
# add binary dir as include path as generated headers will be located there
# add binary dir as include path as generated headers will be located there
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
...
...
examples/broker
s
/protobuf_broker.cpp
→
examples/broker/protobuf_broker.cpp
View file @
02b6648f
File moved
examples/broker
s
/simple_broker.cpp
→
examples/broker/simple_broker.cpp
View file @
02b6648f
File moved
examples/broker
s
/simple_http_broker.cpp
→
examples/broker/simple_http_broker.cpp
View file @
02b6648f
File moved
examples/custom_type
s
/custom_types_1.cpp
→
examples/custom_type/custom_types_1.cpp
View file @
02b6648f
File moved
examples/custom_type
s
/custom_types_2.cpp
→
examples/custom_type/custom_types_2.cpp
View file @
02b6648f
File moved
examples/custom_type
s
/custom_types_3.cpp
→
examples/custom_type/custom_types_3.cpp
View file @
02b6648f
File moved
examples/message_passing/prioritizing.cpp
0 → 100644
View file @
02b6648f
#include "caf/all.hpp"
using
std
::
endl
;
using
namespace
caf
;
behavior
foo
(
event_based_actor
*
self
)
{
self
->
send
(
self
,
"world"
);
self
->
send
<
message_priority
::
high
>
(
self
,
"hello"
);
// when spawning `foo` with priority_aware flag, it will print "hello" first
return
{
[
=
](
const
std
::
string
&
str
)
{
aout
(
self
)
<<
str
<<
endl
;
}
};
}
int
main
()
{
actor_system
system
;
scoped_actor
self
{
system
};
aout
(
self
)
<<
"spawn foo"
<<
endl
;
self
->
spawn
(
foo
);
self
->
await_all_other_actors_done
();
aout
(
self
)
<<
"spawn foo again with priority_aware flag"
<<
endl
;
self
->
spawn
<
priority_aware
>
(
foo
);
}
examples/remot
e_actors
/distributed_calculator.cpp
→
examples/remot
ing
/distributed_calculator.cpp
View file @
02b6648f
File moved
examples/remot
e_actors
/group_chat.cpp
→
examples/remot
ing
/group_chat.cpp
View file @
02b6648f
File moved
examples/remot
e_actors
/group_server.cpp
→
examples/remot
ing
/group_server.cpp
View file @
02b6648f
File moved
examples/remot
e_actors
/pingpong.proto
→
examples/remot
ing
/pingpong.proto
View file @
02b6648f
File moved
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