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
48deaca9
Unverified
Commit
48deaca9
authored
Jul 28, 2021
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove obsolete classes and headers
parent
52914200
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
70 additions
and
237 deletions
+70
-237
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+0
-1
libcaf_core/caf/all.hpp
libcaf_core/caf/all.hpp
+0
-1
libcaf_core/caf/atom.hpp
libcaf_core/caf/atom.hpp
+0
-1
libcaf_core/caf/memory_managed.hpp
libcaf_core/caf/memory_managed.hpp
+0
-21
libcaf_core/caf/static_visitor.hpp
libcaf_core/caf/static_visitor.hpp
+0
-14
libcaf_core/caf/type_erased_value.hpp
libcaf_core/caf/type_erased_value.hpp
+0
-109
libcaf_core/caf/variant.hpp
libcaf_core/caf/variant.hpp
+60
-65
libcaf_core/src/memory_managed.cpp
libcaf_core/src/memory_managed.cpp
+0
-17
libcaf_core/test/sum_type.cpp
libcaf_core/test/sum_type.cpp
+10
-8
No files found.
libcaf_core/CMakeLists.txt
View file @
48deaca9
...
...
@@ -164,7 +164,6 @@ caf_add_component(
src/logger.cpp
src/mailbox_element.cpp
src/make_config_option.cpp
src/memory_managed.cpp
src/message.cpp
src/message_builder.cpp
src/message_handler.cpp
...
...
libcaf_core/caf/all.hpp
View file @
48deaca9
...
...
@@ -59,7 +59,6 @@
#include "caf/logger.hpp"
#include "caf/make_config_option.hpp"
#include "caf/may_have_timeout.hpp"
#include "caf/memory_managed.hpp"
#include "caf/message.hpp"
#include "caf/message_builder.hpp"
#include "caf/message_handler.hpp"
...
...
libcaf_core/caf/atom.hpp
deleted
100644 → 0
View file @
52914200
// Deprecated include. The next CAF release won't include this header.
libcaf_core/caf/memory_managed.hpp
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.
#pragma once
#include "caf/detail/core_export.hpp"
namespace
caf
{
class
[[
deprecated
]]
memory_managed
;
class
CAF_CORE_EXPORT
memory_managed
{
public:
virtual
void
request_deletion
(
bool
decremented_rc
)
const
noexcept
;
protected:
virtual
~
memory_managed
();
};
}
// namespace caf
libcaf_core/caf/static_visitor.hpp
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.
#pragma once
namespace
caf
{
template
<
class
Result
=
void
>
struct
static_visitor
{
using
result_type
=
Result
;
};
}
// namespace caf
libcaf_core/caf/type_erased_value.hpp
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.
#pragma once
#include <cstdint>
#include <functional>
#include <typeinfo>
#include "caf/detail/core_export.hpp"
#include "caf/error_code.hpp"
#include "caf/fwd.hpp"
#include "caf/rtti_pair.hpp"
#include "caf/type_nr.hpp"
namespace
caf
{
/// Represents a single type-erased value.
class
CAF_CORE_EXPORT
type_erased_value
{
public:
// -- constructors, destructors, and assignment operators --------------------
virtual
~
type_erased_value
();
// -- pure virtual modifiers -------------------------------------------------
/// Returns a mutable pointer to the stored value.
virtual
void
*
get_mutable
()
=
0
;
/// Load the content for the stored value from `source`.
virtual
error
load
(
deserializer
&
source
)
=
0
;
/// Load the content for the stored value from `source`.
virtual
error_code
<
sec
>
load
(
binary_deserializer
&
source
)
=
0
;
// -- pure virtual observers -------------------------------------------------
/// Returns the type number and type information object for the stored value.
virtual
rtti_pair
type
()
const
=
0
;
/// Returns a pointer to the stored value.
virtual
const
void
*
get
()
const
=
0
;
/// Saves the content of the stored value to `sink`.
virtual
error
save
(
serializer
&
sink
)
const
=
0
;
/// Saves the content of the stored value to `sink`.
virtual
error_code
<
sec
>
save
(
binary_serializer
&
sink
)
const
=
0
;
/// Converts the stored value to a string.
virtual
std
::
string
stringify
()
const
=
0
;
/// Returns a copy of the stored value.
virtual
type_erased_value_ptr
copy
()
const
=
0
;
// -- observers --------------------------------------------------------------
/// Checks whether the type of the stored value matches
/// the type nr and type info object.
bool
matches
(
uint16_t
nr
,
const
std
::
type_info
*
ptr
)
const
;
// -- convenience functions --------------------------------------------------
/// Returns the type number for the stored value.
uint16_t
type_nr
()
const
{
return
type
().
first
;
}
/// Checks whether the type of the stored value matches `rtti`.
bool
matches
(
const
rtti_pair
&
rtti
)
const
{
return
matches
(
rtti
.
first
,
rtti
.
second
);
}
/// Convenience function for `reinterpret_cast<const T*>(get())`.
template
<
class
T
>
const
T
&
get_as
()
const
{
return
*
reinterpret_cast
<
const
T
*>
(
get
());
}
/// Convenience function for `reinterpret_cast<T*>(get_mutable())`.
template
<
class
T
>
T
&
get_mutable_as
()
{
return
*
reinterpret_cast
<
T
*>
(
get_mutable
());
}
};
/// @relates type_erased_value
CAF_CORE_EXPORT
error
inspect
(
serializer
&
f
,
const
type_erased_value
&
x
);
/// @relates type_erased_value
CAF_CORE_EXPORT
error
inspect
(
deserializer
&
f
,
type_erased_value
&
x
);
/// @relates type_erased_value
inline
auto
inspect
(
binary_serializer
&
f
,
const
type_erased_value
&
x
)
{
return
x
.
save
(
f
);
}
/// @relates type_erased_value
inline
auto
inspect
(
binary_deserializer
&
f
,
type_erased_value
&
x
)
{
return
x
.
load
(
f
);
}
/// @relates type_erased_value
inline
auto
to_string
(
const
type_erased_value
&
x
)
{
return
x
.
stringify
();
}
}
// namespace caf
libcaf_core/caf/variant.hpp
View file @
48deaca9
...
...
@@ -15,7 +15,6 @@
#include "caf/detail/variant_data.hpp"
#include "caf/fwd.hpp"
#include "caf/raise_error.hpp"
#include "caf/static_visitor.hpp"
#include "caf/sum_type.hpp"
#include "caf/sum_type_access.hpp"
...
...
@@ -26,10 +25,8 @@
#define CAF_VARIANT_ASSIGN_CASE(n) \
case n: { \
using tmp_t = typename detail::tl_at< \
detail::type_list<Ts...>, \
(n < sizeof...(Ts) ? n : 0) \
>::type; \
using tmp_t = typename detail::tl_at<detail::type_list<Ts...>, \
(n < sizeof...(Ts) ? n : 0)>::type; \
x.x = tmp_t{}; \
return f(get<tmp_t>(x.x)); \
}
...
...
@@ -60,7 +57,8 @@ template <class T>
struct
variant_assign_helper
{
using
result_type
=
void
;
T
&
lhs
;
variant_assign_helper
(
T
&
lhs_ref
)
:
lhs
(
lhs_ref
)
{
}
variant_assign_helper
(
T
&
lhs_ref
)
:
lhs
(
lhs_ref
)
{
}
template
<
class
U
>
void
operator
()(
const
U
&
rhs
)
const
{
lhs
=
rhs
;
...
...
@@ -71,7 +69,8 @@ template <class T>
struct
variant_move_helper
{
using
result_type
=
void
;
T
&
lhs
;
variant_move_helper
(
T
&
lhs_ref
)
:
lhs
(
lhs_ref
)
{
}
variant_move_helper
(
T
&
lhs_ref
)
:
lhs
(
lhs_ref
)
{
}
template
<
class
U
>
void
operator
()(
U
&
rhs
)
const
{
lhs
=
std
::
move
(
rhs
);
...
...
@@ -80,8 +79,8 @@ struct variant_move_helper {
template
<
bool
Valid
,
class
F
,
class
...
Ts
>
struct
variant_visit_result_impl
{
using
type
=
decltype
((
std
::
declval
<
F
&>
())(
std
::
declval
<
typename
Ts
::
type0
&>
()...));
using
type
=
decltype
((
std
::
declval
<
F
&>
())(
std
::
declval
<
typename
Ts
::
type0
&>
()...));
};
template
<
class
F
,
class
...
Ts
>
...
...
@@ -113,19 +112,16 @@ public:
static
constexpr
int
max_type_id
=
sizeof
...(
Ts
)
-
1
;
/// Stores whether all types are nothrow constructible.
static
constexpr
bool
nothrow_move_construct
=
detail
::
conjunction
<
std
::
is_nothrow_move_constructible
<
Ts
>::
value
...
>::
value
;
static
constexpr
bool
nothrow_move_construct
=
detail
::
conjunction
<
std
::
is_nothrow_move_constructible
<
Ts
>::
value
...
>::
value
;
/// Stores whether all types are nothrow assignable *and* constructible. We
/// need to check both, since assigning to a variant results in a
/// move-con
s
truct unless the before and after types are the same.
static
constexpr
bool
nothrow_move_assign
=
nothrow_move_construct
/// move-contruct unless the before and after types are the same.
static
constexpr
bool
nothrow_move_assign
=
nothrow_move_construct
&&
detail
::
conjunction
<
std
::
is_nothrow_move_assignable
<
Ts
>::
value
...
>::
value
;
std
::
is_nothrow_move_assignable
<
Ts
>::
value
...
>::
value
;
// -- sanity checks ----------------------------------------------------------
...
...
@@ -146,8 +142,8 @@ public:
}
template
<
class
U
>
variant
(
U
&&
arg
)
noexcept
(
std
::
is_rvalue_reference
<
U
&&>::
value
&&
nothrow_move_assign
)
variant
(
U
&&
arg
)
noexcept
(
std
::
is_rvalue_reference
<
U
&&>::
value
&&
nothrow_move_assign
)
:
type_
(
variant_npos
)
{
set
(
std
::
forward
<
U
>
(
arg
));
}
...
...
@@ -246,7 +242,8 @@ public:
template
<
class
Result
,
class
Self
,
class
Visitor
,
class
...
Us
>
static
Result
apply_impl
(
Self
&
x
,
Visitor
&&
f
,
Us
&&
...
xs
)
{
switch
(
x
.
type_
)
{
default:
CAF_RAISE_ERROR
(
"invalid type found"
);
default:
CAF_RAISE_ERROR
(
"invalid type found"
);
CAF_VARIANT_CASE
(
0
);
CAF_VARIANT_CASE
(
1
);
CAF_VARIANT_CASE
(
2
);
...
...
@@ -284,7 +281,8 @@ public:
private:
void
destroy_data
()
{
if
(
type_
==
variant_npos
)
return
;
// nothing to do
if
(
type_
==
variant_npos
)
return
;
// nothing to do
detail
::
variant_data_destructor
f
;
apply
<
void
>
(
f
);
}
...
...
@@ -293,18 +291,15 @@ private:
void
set
(
U
&&
arg
)
{
using
namespace
detail
;
using
type
=
typename
std
::
decay
<
U
>::
type
;
static
constexpr
int
type_id
=
detail
::
tl_index_where
<
types
,
detail
::
tbind
<
is_same_ish
,
type
>::
template
type
>
::
value
;
static
constexpr
int
type_id
=
detail
::
tl_index_where
<
types
,
detail
::
tbind
<
is_same_ish
,
type
>::
template
type
>
::
value
;
static_assert
(
type_id
>=
0
,
"invalid type for variant"
);
std
::
integral_constant
<
int
,
type_id
>
token
;
if
(
type_
!=
type_id
)
{
destroy_data
();
type_
=
type_id
;
auto
&
ref
=
data_
.
get
(
token
);
new
(
std
::
addressof
(
ref
))
type
(
std
::
forward
<
U
>
(
arg
));
new
(
std
::
addressof
(
ref
))
type
(
std
::
forward
<
U
>
(
arg
));
}
else
{
data_
.
get
(
token
)
=
std
::
forward
<
U
>
(
arg
);
}
...
...
libcaf_core/src/memory_managed.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 "caf/memory_managed.hpp"
namespace
caf
{
memory_managed
::~
memory_managed
()
{
// nop
}
void
memory_managed
::
request_deletion
(
bool
)
const
noexcept
{
delete
this
;
}
}
// namespace caf
libcaf_core/test/sum_type.cpp
View file @
48deaca9
...
...
@@ -8,14 +8,13 @@
#include "core-test.hpp"
#include <new>
#include <map>
#include <new>
#include <string>
#include "caf/default_sum_type_access.hpp"
#include "caf/detail/overload.hpp"
#include "caf/raise_error.hpp"
#include "caf/static_visitor.hpp"
#include "caf/sum_type_access.hpp"
namespace
{
...
...
@@ -106,9 +105,12 @@ private:
template
<
class
Result
,
class
Visitor
,
class
...
Ts
>
inline
Result
apply
(
Visitor
&&
f
,
Ts
&&
...
xs
)
const
{
switch
(
index_
)
{
case
0
:
return
f
(
std
::
forward
<
Ts
>
(
xs
)...,
v0
);
case
1
:
return
f
(
std
::
forward
<
Ts
>
(
xs
)...,
v1
);
case
2
:
return
f
(
std
::
forward
<
Ts
>
(
xs
)...,
v2
);
case
0
:
return
f
(
std
::
forward
<
Ts
>
(
xs
)...,
v0
);
case
1
:
return
f
(
std
::
forward
<
Ts
>
(
xs
)...,
v1
);
case
2
:
return
f
(
std
::
forward
<
Ts
>
(
xs
)...,
v2
);
}
CAF_RAISE_ERROR
(
"invalid index in union_type"
);
}
...
...
@@ -159,12 +161,12 @@ struct stringify_t {
template
<
class
T0
,
class
T1
>
string
operator
()(
const
T0
&
x0
,
const
T1
&
x1
)
const
{
return
(
*
this
)
(
x0
)
+
", "
+
(
*
this
)
(
x1
);
return
(
*
this
)
(
x0
)
+
", "
+
(
*
this
)
(
x1
);
}
template
<
class
T0
,
class
T1
,
class
T2
>
string
operator
()(
const
T0
&
x0
,
const
T1
&
x1
,
const
T2
&
x2
)
const
{
return
(
*
this
)
(
x0
,
x1
)
+
", "
+
(
*
this
)
(
x2
);
return
(
*
this
)
(
x0
,
x1
)
+
", "
+
(
*
this
)
(
x2
);
}
};
...
...
@@ -235,7 +237,7 @@ CAF_TEST(ternary visit) {
union_type
x
;
union_type
y
;
union_type
z
;
//CAF_CHECK_EQUAL(visit(stringify, x, y, z), "0, 0, 0");
//
CAF_CHECK_EQUAL(visit(stringify, x, y, z), "0, 0, 0");
x
=
42
;
y
=
string
{
"foo"
};
z
=
map_type
{{
1
,
1
},
{
2
,
2
}};
...
...
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