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
00f15911
Commit
00f15911
authored
Apr 06, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
guard expressions
parent
3652f62e
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
827 additions
and
389 deletions
+827
-389
Makefile.am
Makefile.am
+1
-1
cppa.files
cppa.files
+1
-1
cppa/detail/invokable.hpp
cppa/detail/invokable.hpp
+1
-1
cppa/detail/tdata.hpp
cppa/detail/tdata.hpp
+2
-2
cppa/guard_expr.hpp
cppa/guard_expr.hpp
+656
-0
cppa/on.hpp
cppa/on.hpp
+28
-1
cppa/util/apply_tuple.hpp
cppa/util/apply_tuple.hpp
+16
-10
cppa/util/type_list.hpp
cppa/util/type_list.hpp
+14
-0
unit_testing/test__match.cpp
unit_testing/test__match.cpp
+107
-372
unit_testing/test__spawn.cpp
unit_testing/test__spawn.cpp
+1
-1
No files found.
Makefile.am
View file @
00f15911
...
@@ -151,6 +151,7 @@ nobase_library_include_HEADERS = \
...
@@ -151,6 +151,7 @@ nobase_library_include_HEADERS = \
cppa/fsm_actor.hpp
\
cppa/fsm_actor.hpp
\
cppa/get.hpp
\
cppa/get.hpp
\
cppa/group.hpp
\
cppa/group.hpp
\
cppa/guard_expr.hpp
\
cppa/intrusive/forward_iterator.hpp
\
cppa/intrusive/forward_iterator.hpp
\
cppa/intrusive/single_reader_queue.hpp
\
cppa/intrusive/single_reader_queue.hpp
\
cppa/intrusive/singly_linked_list.hpp
\
cppa/intrusive/singly_linked_list.hpp
\
...
@@ -192,7 +193,6 @@ nobase_library_include_HEADERS = \
...
@@ -192,7 +193,6 @@ nobase_library_include_HEADERS = \
cppa/util/enable_if.hpp
\
cppa/util/enable_if.hpp
\
cppa/util/fiber.hpp
\
cppa/util/fiber.hpp
\
cppa/util/fixed_vector.hpp
\
cppa/util/fixed_vector.hpp
\
cppa/util/guard.hpp
\
cppa/util/if_else.hpp
\
cppa/util/if_else.hpp
\
cppa/util/is_array_of.hpp
\
cppa/util/is_array_of.hpp
\
cppa/util/is_builtin.hpp
\
cppa/util/is_builtin.hpp
\
...
...
cppa.files
View file @
00f15911
...
@@ -258,5 +258,5 @@ cppa/detail/tuple_view.hpp
...
@@ -258,5 +258,5 @@ cppa/detail/tuple_view.hpp
cppa/detail/container_tuple_view.hpp
cppa/detail/container_tuple_view.hpp
cppa/detail/matches.hpp
cppa/detail/matches.hpp
unit_testing/test__match.cpp
unit_testing/test__match.cpp
cppa/guard_expr.hpp
src/pattern.cpp
src/pattern.cpp
cppa/util/guard.hpp
cppa/detail/invokable.hpp
View file @
00f15911
...
@@ -163,7 +163,7 @@ enum mapping_policy
...
@@ -163,7 +163,7 @@ enum mapping_policy
map_to_option
map_to_option
};
};
template
<
mapping_policy
,
class
Pattern
>
template
<
mapping_policy
,
class
Pattern
>
// do_not_map
struct
pattern_policy
struct
pattern_policy
{
{
Pattern
m_pattern
;
Pattern
m_pattern
;
...
...
cppa/detail/tdata.hpp
View file @
00f15911
...
@@ -267,9 +267,9 @@ template<typename T>
...
@@ -267,9 +267,9 @@ template<typename T>
struct
tdata_from_type_list
;
struct
tdata_from_type_list
;
template
<
typename
...
T
>
template
<
typename
...
T
>
struct
tdata_from_type_list
<
cppa
::
util
::
type_list
<
T
...
>>
struct
tdata_from_type_list
<
util
::
type_list
<
T
...
>>
{
{
typedef
cppa
::
detail
::
tdata
<
T
...
>
type
;
typedef
tdata
<
T
...
>
type
;
};
};
}
}
// namespace cppa::detail
}
}
// namespace cppa::detail
...
...
cppa/guard_expr.hpp
0 → 100644
View file @
00f15911
This diff is collapsed.
Click to expand it.
cppa/on.hpp
View file @
00f15911
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include "cppa/anything.hpp"
#include "cppa/anything.hpp"
#include "cppa/behavior.hpp"
#include "cppa/behavior.hpp"
#include "cppa/any_tuple.hpp"
#include "cppa/any_tuple.hpp"
#include "cppa/guard_expr.hpp"
#include "cppa/partial_function.hpp"
#include "cppa/partial_function.hpp"
#include "cppa/util/duration.hpp"
#include "cppa/util/duration.hpp"
...
@@ -98,7 +99,9 @@ class rvalue_builder
...
@@ -98,7 +99,9 @@ class rvalue_builder
typedef
typename
pattern_from_type_list
<
types
>::
type
pattern_type
;
typedef
typename
pattern_from_type_list
<
types
>::
type
pattern_type
;
std
::
unique_ptr
<
value_matcher
>
m_vm
;
typedef
std
::
unique_ptr
<
value_matcher
>
vm_ptr
;
vm_ptr
m_vm
;
template
<
typename
F
>
template
<
typename
F
>
partial_function
cr_rvalue
(
F
&&
f
,
std
::
integral_constant
<
bool
,
true
>
)
partial_function
cr_rvalue
(
F
&&
f
,
std
::
integral_constant
<
bool
,
true
>
)
...
@@ -123,6 +126,30 @@ class rvalue_builder
...
@@ -123,6 +126,30 @@ class rvalue_builder
public:
public:
template
<
operator_id
OP
,
typename
F
,
typename
S
>
rvalue_builder
&
when
(
guard_expr
<
OP
,
F
,
S
>
ge
)
{
typedef
guard_expr
<
OP
,
F
,
S
>
gtype
;
struct
vm_impl
:
value_matcher
{
vm_ptr
m_ptr
;
gtype
m_ge
;
vm_impl
(
vm_ptr
&&
ptr
,
gtype
&&
g
)
:
m_ptr
(
std
::
move
(
ptr
)),
m_ge
(
std
::
move
(
g
))
{
}
bool
operator
()(
any_tuple
const
&
tup
)
const
{
static_assert
(
std
::
is_same
<
decltype
(
ge_invoke_any
<
types
>
(
m_ge
,
tup
)),
bool
>::
value
,
"guard expression does not return a boolean"
);
if
((
*
m_ptr
)(
tup
))
{
return
ge_invoke_any
<
types
>
(
m_ge
,
tup
);
}
return
false
;
}
};
m_vm
.
reset
(
new
vm_impl
(
std
::
move
(
m_vm
),
std
::
move
(
ge
)));
return
*
this
;
}
template
<
typename
...
Args
>
template
<
typename
...
Args
>
rvalue_builder
(
Args
&&
...
args
)
rvalue_builder
(
Args
&&
...
args
)
:
m_vm
(
pattern_type
::
get_value_matcher
(
std
::
forward
<
Args
>
(
args
)...))
:
m_vm
(
pattern_type
::
get_value_matcher
(
std
::
forward
<
Args
>
(
args
)...))
...
...
cppa/util/apply_tuple.hpp
View file @
00f15911
...
@@ -82,8 +82,7 @@ struct apply_tuple_util<Result, IsManipulator, 1, 0>
...
@@ -82,8 +82,7 @@ struct apply_tuple_util<Result, IsManipulator, 1, 0>
};
};
template
<
typename
F
,
template
<
typename
...
>
class
Tuple
,
typename
...
T
>
template
<
typename
F
,
template
<
typename
...
>
class
Tuple
,
typename
...
T
>
auto
apply_tuple
(
F
&&
fun
,
Tuple
<
T
...
>&
tup
)
typename
get_result_type
<
F
>::
type
apply_tuple
(
F
&&
fun
,
Tuple
<
T
...
>&
tup
)
->
typename
get_result_type
<
F
>::
type
{
{
typedef
typename
get_result_type
<
F
>::
type
result_type
;
typedef
typename
get_result_type
<
F
>::
type
result_type
;
typedef
typename
get_arg_types
<
F
>::
types
fun_args
;
typedef
typename
get_arg_types
<
F
>::
types
fun_args
;
...
@@ -98,8 +97,7 @@ auto apply_tuple(F&& fun, Tuple<T...>& tup)
...
@@ -98,8 +97,7 @@ auto apply_tuple(F&& fun, Tuple<T...>& tup)
}
}
template
<
typename
F
,
template
<
typename
...
>
class
Tuple
,
typename
...
T
>
template
<
typename
F
,
template
<
typename
...
>
class
Tuple
,
typename
...
T
>
auto
apply_tuple
(
F
&&
fun
,
Tuple
<
T
...
>
const
&
tup
)
typename
get_result_type
<
F
>::
type
apply_tuple
(
F
&&
fun
,
Tuple
<
T
...
>
const
&
tup
)
->
typename
get_result_type
<
F
>::
type
{
{
typedef
typename
get_result_type
<
F
>::
type
result_type
;
typedef
typename
get_result_type
<
F
>::
type
result_type
;
typedef
typename
get_arg_types
<
F
>::
types
fun_args
;
typedef
typename
get_arg_types
<
F
>::
types
fun_args
;
...
@@ -113,16 +111,24 @@ auto apply_tuple(F&& fun, Tuple<T...> const& tup)
...
@@ -113,16 +111,24 @@ auto apply_tuple(F&& fun, Tuple<T...> const& tup)
::
apply
(
std
::
forward
<
F
>
(
fun
),
tup
);
::
apply
(
std
::
forward
<
F
>
(
fun
),
tup
);
}
}
template
<
typename
Result
,
typename
F
,
template
<
typename
...
>
class
Tuple
,
typename
...
T
>
template
<
typename
Result
,
size_t
From
,
size_t
To
,
Result
unchecked_apply_tuple
(
F
&&
fun
,
Tuple
<
T
...
>&
tup
)
typename
F
,
template
<
typename
...
>
class
Tuple
,
typename
...
T
>
Result
unchecked_apply_tuple_in_range
(
F
&&
fun
,
Tuple
<
T
...
>
const
&
tup
)
{
{
static
constexpr
size_t
tup_size
=
sizeof
...(
T
);
return
apply_tuple_util
<
Result
,
false
,
From
,
To
>
static
constexpr
size_t
from
=
0
;
static
constexpr
size_t
to
=
tup_size
-
1
;
return
apply_tuple_util
<
Result
,
false
,
from
,
to
>
::
apply
(
std
::
forward
<
F
>
(
fun
),
tup
);
::
apply
(
std
::
forward
<
F
>
(
fun
),
tup
);
}
}
// applies all values of @p tup to @p fun
// does not evaluate result type of functor
template
<
typename
Result
,
typename
F
,
template
<
typename
...
>
class
Tuple
,
typename
...
T
>
Result
unchecked_apply_tuple
(
F
&&
fun
,
Tuple
<
T
...
>
const
&
tup
)
{
return
unchecked_apply_tuple_in_range
<
Result
,
0
,
sizeof
...(
T
)
-
1
>
(
std
::
forward
<
F
>
(
fun
),
tup
);
}
}
}
// namespace cppa::util
}
}
// namespace cppa::util
#endif // APPLY_TUPLE_HPP
#endif // APPLY_TUPLE_HPP
cppa/util/type_list.hpp
View file @
00f15911
...
@@ -314,6 +314,20 @@ struct tl_concat<type_list<ListATypes...>, type_list<ListBTypes...> >
...
@@ -314,6 +314,20 @@ struct tl_concat<type_list<ListATypes...>, type_list<ListBTypes...> >
typedef
type_list
<
ListATypes
...,
ListBTypes
...
>
type
;
typedef
type_list
<
ListATypes
...,
ListBTypes
...
>
type
;
};
};
// list list::push_back(list, type)
template
<
typename
List
,
typename
What
>
struct
tl_push_back
;
/**
* @brief Appends @p What to given list.
*/
template
<
typename
...
ListTypes
,
typename
What
>
struct
tl_push_back
<
type_list
<
ListTypes
...
>
,
What
>
{
typedef
type_list
<
ListTypes
...,
What
>
type
;
};
// list list::appy(trait)
// list list::appy(trait)
template
<
typename
List
,
template
<
typename
>
class
Trait
>
template
<
typename
List
,
template
<
typename
>
class
Trait
>
...
...
unit_testing/test__match.cpp
View file @
00f15911
This diff is collapsed.
Click to expand it.
unit_testing/test__spawn.cpp
View file @
00f15911
...
@@ -23,7 +23,7 @@ using std::endl;
...
@@ -23,7 +23,7 @@ using std::endl;
using
namespace
cppa
;
using
namespace
cppa
;
// GCC 4.7 supports non-static member initialization
// GCC 4.7 supports non-static member initialization
#if (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 7)
#if
0 //
(__GNUC__ >= 4) && (__GNUC_MINOR__ >= 7)
struct event_testee : public fsm_actor<event_testee>
struct event_testee : public fsm_actor<event_testee>
{
{
...
...
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