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
a0616f1b
Commit
a0616f1b
authored
Jan 01, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move functors to invokable impls
parent
a5b8f15a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
26 deletions
+20
-26
cppa/detail/invokable.hpp
cppa/detail/invokable.hpp
+20
-20
cppa/invoke_rules.hpp
cppa/invoke_rules.hpp
+0
-6
No files found.
cppa/detail/invokable.hpp
View file @
a0616f1b
...
...
@@ -88,8 +88,9 @@ class timed_invokable_impl : public timed_invokable
public:
timed_invokable_impl
(
util
::
duration
const
&
d
,
TargetFun
const
&
tfun
)
:
super
(
d
),
m_target
(
tfun
)
template
<
typename
F
>
timed_invokable_impl
(
util
::
duration
const
&
d
,
F
&&
fun
)
:
super
(
d
),
m_target
(
std
::
forward
<
F
>
(
fun
))
{
}
...
...
@@ -114,13 +115,15 @@ template<class TupleView, class Pattern, class TargetFun>
class
invokable_impl
:
public
invokable
{
typedef
typename
Pattern
::
mapping_vector
vector_type
;
struct
iimpl
:
intermediate
{
TargetFun
const
&
m_target
;
TargetFun
m_target
;
TupleView
m_args
;
iimpl
(
TargetFun
const
&
tf
)
:
m_target
(
tf
)
template
<
typename
F
>
iimpl
(
F
&&
fun
)
:
m_target
(
std
::
forward
<
F
>
(
fun
))
{
}
...
...
@@ -128,25 +131,21 @@ class invokable_impl : public invokable
{
cppa
::
invoke
(
m_target
,
m_args
);
}
};
typedef
util
::
fixed_vector
<
size_t
,
TupleView
::
num_elements
>
vector_type
;
std
::
unique_ptr
<
Pattern
>
m_pattern
;
TargetFun
m_target
;
iimpl
m_iimpl
;
public:
invokable_impl
(
std
::
unique_ptr
<
Pattern
>&&
pptr
,
TargetFun
const
&
mt
)
:
m_pattern
(
std
::
move
(
pptr
)),
m_target
(
mt
),
m_iimpl
(
m_target
)
template
<
typename
F
>
invokable_impl
(
std
::
unique_ptr
<
Pattern
>&&
pptr
,
F
&&
fun
)
:
m_pattern
(
std
::
move
(
pptr
)),
m_iimpl
(
std
::
forward
<
F
>
(
fun
))
{
}
bool
invoke
(
any_tuple
const
&
data
)
const
{
vector_type
mv
;
if
((
*
m_pattern
)(
data
,
&
mv
))
{
...
...
@@ -154,13 +153,13 @@ class invokable_impl : public invokable
{
// "perfect" match; no mapping needed at all
TupleView
tv
=
TupleView
::
from
(
data
.
vals
());
cppa
::
invoke
(
m_target
,
tv
);
cppa
::
invoke
(
m_
iimpl
.
m_
target
,
tv
);
}
else
{
// mapping needed
TupleView
tv
(
data
.
vals
(),
mv
);
cppa
::
invoke
(
m_target
,
tv
);
cppa
::
invoke
(
m_
iimpl
.
m_
target
,
tv
);
}
return
true
;
}
...
...
@@ -194,9 +193,10 @@ class invokable_impl<TupleClass<>, Pattern, TargetFun> : public invokable
struct
iimpl
:
intermediate
{
TargetFun
const
&
m_target
;
TargetFun
m_target
;
iimpl
(
TargetFun
const
&
tf
)
:
m_target
(
tf
)
template
<
typename
F
>
iimpl
(
F
&&
fun
)
:
m_target
(
fun
)
{
}
...
...
@@ -207,13 +207,13 @@ class invokable_impl<TupleClass<>, Pattern, TargetFun> : public invokable
};
std
::
unique_ptr
<
Pattern
>
m_pattern
;
TargetFun
m_target
;
iimpl
m_iimpl
;
public:
invokable_impl
(
std
::
unique_ptr
<
Pattern
>&&
pptr
,
TargetFun
const
&
mt
)
:
m_pattern
(
std
::
move
(
pptr
)),
m_target
(
mt
),
m_iimpl
(
m_target
)
template
<
typename
F
>
invokable_impl
(
std
::
unique_ptr
<
Pattern
>&&
pptr
,
F
&&
fun
)
:
m_pattern
(
std
::
move
(
pptr
)),
m_iimpl
(
std
::
forward
<
F
>
(
fun
))
{
}
...
...
@@ -221,7 +221,7 @@ class invokable_impl<TupleClass<>, Pattern, TargetFun> : public invokable
{
if
((
*
m_pattern
)(
data
,
nullptr
))
{
m_target
();
m_
iimpl
.
m_
target
();
return
true
;
}
return
false
;
...
...
cppa/invoke_rules.hpp
View file @
a0616f1b
...
...
@@ -39,12 +39,6 @@
namespace
cppa
{
namespace
detail
{
/*
class invokable;
class intermediate;
class timed_invokable;
*/
typedef
std
::
unique_ptr
<
detail
::
invokable
>
invokable_ptr
;
typedef
std
::
unique_ptr
<
detail
::
timed_invokable
>
timed_invokable_ptr
;
...
...
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