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
51f63abd
Commit
51f63abd
authored
Jun 16, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move opt_group out of actor_system_config
parent
751f86fd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
125 additions
and
49 deletions
+125
-49
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+1
-0
libcaf_core/caf/actor_system_config.hpp
libcaf_core/caf/actor_system_config.hpp
+8
-31
libcaf_core/caf/config_option_adder.hpp
libcaf_core/caf/config_option_adder.hpp
+69
-0
libcaf_core/caf/config_option_set.hpp
libcaf_core/caf/config_option_set.hpp
+3
-4
libcaf_core/caf/fwd.hpp
libcaf_core/caf/fwd.hpp
+1
-0
libcaf_core/src/actor_system_config.cpp
libcaf_core/src/actor_system_config.cpp
+0
-14
libcaf_core/src/config_option_adder.cpp
libcaf_core/src/config_option_adder.cpp
+43
-0
No files found.
libcaf_core/CMakeLists.txt
View file @
51f63abd
...
...
@@ -37,6 +37,7 @@ set(LIBCAF_CORE_SRCS
src/blocking_behavior.cpp
src/concatenated_tuple.cpp
src/config_option.cpp
src/config_option_adder.cpp
src/config_option_set.cpp
src/config_value.cpp
src/decorated_tuple.cpp
...
...
libcaf_core/caf/actor_system_config.hpp
View file @
51f63abd
...
...
@@ -26,16 +26,17 @@
#include <type_traits>
#include <unordered_map>
#include "caf/fwd.hpp"
#include "caf/stream.hpp"
#include "caf/thread_hook.hpp"
#include "caf/config_value.hpp"
#include "caf/actor_factory.hpp"
#include "caf/config_option.hpp"
#include "caf/config_option_adder.hpp"
#include "caf/config_option_set.hpp"
#include "caf/actor_factory.hpp"
#include "caf/config_value.hpp"
#include "caf/fwd.hpp"
#include "caf/is_typed_actor.hpp"
#include "caf/type_erased_value.hpp"
#include "caf/named_actor_config.hpp"
#include "caf/stream.hpp"
#include "caf/thread_hook.hpp"
#include "caf/type_erased_value.hpp"
#include "caf/detail/safe_equal.hpp"
#include "caf/detail/type_traits.hpp"
...
...
@@ -83,33 +84,9 @@ public:
using
string_list
=
std
::
vector
<
std
::
string
>
;
// -- nested classes ---------------------------------------------------------
using
named_actor_config_map
=
hash_map
<
std
::
string
,
named_actor_config
>
;
class
opt_group
{
public:
opt_group
(
config_option_set
&
xs
,
const
char
*
category
);
template
<
class
T
>
opt_group
&
add
(
T
&
storage
,
const
char
*
name
,
const
char
*
description
)
{
xs_
.
add
(
storage
,
category_
,
name
,
description
);
return
*
this
;
}
template
<
class
T
>
opt_group
&
add
(
const
char
*
name
,
const
char
*
description
)
{
xs_
.
add
<
T
>
(
category_
,
name
,
description
);
return
*
this
;
}
opt_group
&
add_neg
(
bool
&
storage
,
const
char
*
name
,
const
char
*
description
);
private:
config_option_set
&
xs_
;
const
char
*
category_
;
};
using
opt_group
=
config_option_adder
;
// -- constructors, destructors, and assignment operators --------------------
...
...
libcaf_core/caf/config_option_adder.hpp
0 → 100644
View file @
51f63abd
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| 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 <vector>
#include "caf/config_option.hpp"
#include "caf/fwd.hpp"
#include "caf/make_config_option.hpp"
namespace
caf
{
/// Adds config options of the same category to a `config_option_set`.
class
config_option_adder
{
public:
// -- constructors, destructors, and assignment operators --------------------
config_option_adder
(
config_option_set
&
target
,
const
char
*
category
);
// -- properties -------------------------------------------------------------
/// Adds a config option to the category that synchronizes with `ref`.
template
<
class
T
>
config_option_adder
&
add
(
T
&
ref
,
const
char
*
name
,
const
char
*
description
)
{
return
add_impl
(
make_config_option
(
ref
,
category_
,
name
,
description
));
}
/// Adds a config option to the category.
template
<
class
T
>
config_option_adder
&
add
(
const
char
*
name
,
const
char
*
description
)
{
return
add_impl
(
make_config_option
<
T
>
(
category_
,
name
,
description
));
}
/// For backward compatibility only. Do not use for new code!
/// @private
config_option_adder
&
add_neg
(
bool
&
storage
,
const
char
*
name
,
const
char
*
description
);
private:
// -- properties -------------------------------------------------------------
config_option_adder
&
add_impl
(
config_option
&&
opt
);
// -- member variables -------------------------------------------------------
/// Reference to the target set.
config_option_set
&
xs_
;
/// Category for all options generated by this adder.
const
char
*
category_
;
};
}
// namespace caf
libcaf_core/caf/config_option_set.hpp
View file @
51f63abd
...
...
@@ -101,18 +101,17 @@ public:
template
<
class
T
>
config_option_set
&
add
(
const
char
*
category
,
const
char
*
name
,
const
char
*
description
=
""
)
{
opts_
.
emplace_back
(
make_config_option
<
T
>
(
category
,
name
,
description
));
return
*
this
;
return
add
(
make_config_option
<
T
>
(
category
,
name
,
description
));
}
/// Adds a config option to the set that synchronizes its value with `ref`.
template
<
class
T
>
config_option_set
&
add
(
T
&
ref
,
const
char
*
category
,
const
char
*
name
,
const
char
*
description
=
""
)
{
opts_
.
emplace_back
(
make_config_option
<
T
>
(
ref
,
category
,
name
,
description
));
return
*
this
;
return
add
(
make_config_option
<
T
>
(
ref
,
category
,
name
,
description
));
}
/// Adds a config option to the set.
/// @private
config_option_set
&
add
(
config_option
&&
opt
);
...
...
libcaf_core/caf/fwd.hpp
View file @
51f63abd
...
...
@@ -84,6 +84,7 @@ class actor_system_config;
class
behavior
;
class
blocking_actor
;
class
config_option
;
class
config_option_adder
;
class
config_option_set
;
class
config_value
;
class
deserializer
;
...
...
libcaf_core/src/actor_system_config.cpp
View file @
51f63abd
...
...
@@ -34,20 +34,6 @@ CAF_PUSH_DEPRECATED_WARNING
namespace
caf
{
actor_system_config
::
opt_group
::
opt_group
(
config_option_set
&
xs
,
const
char
*
category
)
:
xs_
(
xs
),
category_
(
category
)
{
// nop
}
actor_system_config
::
opt_group
&
actor_system_config
::
opt_group
::
add_neg
(
bool
&
storage
,
const
char
*
name
,
const
char
*
description
)
{
xs_
.
add
(
make_negated_config_option
(
storage
,
category_
,
name
,
description
));
return
*
this
;
}
actor_system_config
::~
actor_system_config
()
{
// nop
}
...
...
libcaf_core/src/config_option_adder.cpp
0 → 100644
View file @
51f63abd
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| 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. *
******************************************************************************/
#include "caf/config_option_adder.hpp"
#include "caf/config_option_set.hpp"
namespace
caf
{
config_option_adder
::
config_option_adder
(
config_option_set
&
target
,
const
char
*
category
)
:
xs_
(
target
),
category_
(
category
)
{
// nop
}
config_option_adder
&
config_option_adder
::
add_neg
(
bool
&
ref
,
const
char
*
name
,
const
char
*
description
)
{
return
add_impl
(
make_negated_config_option
(
ref
,
category_
,
name
,
description
));
}
config_option_adder
&
config_option_adder
::
add_impl
(
config_option
&&
opt
)
{
xs_
.
add
(
std
::
move
(
opt
));
return
*
this
;
}
}
// namespace caf
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