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
00266207
Commit
00266207
authored
Feb 09, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fail early on misconfigurations
parent
2fd22c72
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
libcaf_core/caf/exec_main.hpp
libcaf_core/caf/exec_main.hpp
+12
-10
No files found.
libcaf_core/caf/exec_main.hpp
View file @
00266207
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#include "caf/actor_system.hpp"
#include "caf/actor_system.hpp"
#include "caf/actor_system_config.hpp"
#include "caf/actor_system_config.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/detail/type_traits.hpp"
...
@@ -70,27 +69,31 @@ int exec_main(F fun, int argc, char** argv,
...
@@ -70,27 +69,31 @@ int exec_main(F fun, int argc, char** argv,
"second parameter of main function must take a subtype of "
"second parameter of main function must take a subtype of "
"actor_system_config as const reference"
);
"actor_system_config as const reference"
);
using
helper
=
exec_main_helper
<
typename
trait
::
arg_types
>
;
using
helper
=
exec_main_helper
<
typename
trait
::
arg_types
>
;
//
pass CLI options to config
//
Pass CLI options to config.
typename
helper
::
config
cfg
;
typename
helper
::
config
cfg
;
cfg
.
parse
(
argc
,
argv
,
config_file_name
);
if
(
auto
err
=
cfg
.
parse
(
argc
,
argv
,
config_file_name
))
{
// return immediately if a help text was printed
std
::
cerr
<<
"error while parsing CLI and file options: "
<<
actor_system_config
::
render
(
err
)
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
// Return immediately if a help text was printed.
if
(
cfg
.
cli_helptext_printed
)
if
(
cfg
.
cli_helptext_printed
)
return
0
;
return
EXIT_SUCCESS
;
//
load modules
//
Load modules.
std
::
initializer_list
<
unit_t
>
unused
{
unit_t
{
cfg
.
template
load
<
Ts
>()}...};
std
::
initializer_list
<
unit_t
>
unused
{
unit_t
{
cfg
.
template
load
<
Ts
>()}...};
CAF_IGNORE_UNUSED
(
unused
);
CAF_IGNORE_UNUSED
(
unused
);
//
pass config to the actor system
//
Initialize the actor system.
actor_system
system
{
cfg
};
actor_system
system
{
cfg
};
if
(
cfg
.
slave_mode
)
{
if
(
cfg
.
slave_mode
)
{
if
(
!
cfg
.
slave_mode_fun
)
{
if
(
!
cfg
.
slave_mode_fun
)
{
std
::
cerr
<<
"cannot run slave mode, I/O module not loaded"
<<
std
::
endl
;
std
::
cerr
<<
"cannot run slave mode, I/O module not loaded"
<<
std
::
endl
;
return
1
;
return
EXIT_FAILURE
;
}
}
return
cfg
.
slave_mode_fun
(
system
,
cfg
);
return
cfg
.
slave_mode_fun
(
system
,
cfg
);
}
}
helper
f
;
helper
f
;
f
(
fun
,
system
,
cfg
);
f
(
fun
,
system
,
cfg
);
return
0
;
return
EXIT_SUCCESS
;
}
}
}
// namespace caf
}
// namespace caf
...
@@ -99,4 +102,3 @@ int exec_main(F fun, int argc, char** argv,
...
@@ -99,4 +102,3 @@ int exec_main(F fun, int argc, char** argv,
int main(int argc, char** argv) { \
int main(int argc, char** argv) { \
return ::caf::exec_main<__VA_ARGS__>(caf_main, argc, argv); \
return ::caf::exec_main<__VA_ARGS__>(caf_main, argc, argv); \
}
}
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