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
73f8c999
Commit
73f8c999
authored
Feb 03, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No longer support match w/o value storage
parent
d5284194
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
20 deletions
+16
-20
libcaf_core/caf/detail/try_match.hpp
libcaf_core/caf/detail/try_match.hpp
+2
-4
libcaf_core/src/try_match.cpp
libcaf_core/src/try_match.cpp
+14
-16
No files found.
libcaf_core/caf/detail/try_match.hpp
View file @
73f8c999
...
@@ -87,10 +87,8 @@ struct meta_elements<type_list<Ts...>> {
...
@@ -87,10 +87,8 @@ struct meta_elements<type_list<Ts...>> {
}
}
};
};
bool
try_match
(
const
message
&
msg
,
bool
try_match
(
const
message
&
msg
,
const
meta_element
*
pattern_begin
,
const
meta_element
*
pattern_begin
,
size_t
pattern_size
,
void
**
out
);
size_t
pattern_size
,
void
**
out
=
nullptr
);
}
// namespace detail
}
// namespace detail
}
// namespace caf
}
// namespace caf
...
...
libcaf_core/src/try_match.cpp
View file @
73f8c999
...
@@ -34,9 +34,7 @@ bool match_element(const meta_element& me, const message& msg,
...
@@ -34,9 +34,7 @@ bool match_element(const meta_element& me, const message& msg,
if
(
!
msg
.
match_element
(
pos
,
me
.
typenr
,
me
.
type
))
{
if
(
!
msg
.
match_element
(
pos
,
me
.
typenr
,
me
.
type
))
{
return
false
;
return
false
;
}
}
if
(
storage
)
{
*
storage
=
const_cast
<
void
*>
(
msg
.
at
(
pos
));
*
storage
=
const_cast
<
void
*>
(
msg
.
at
(
pos
));
}
return
true
;
return
true
;
}
}
...
@@ -46,19 +44,17 @@ bool match_atom_constant(const meta_element& me, const message& msg,
...
@@ -46,19 +44,17 @@ bool match_atom_constant(const meta_element& me, const message& msg,
if
(
!
msg
.
match_element
(
pos
,
detail
::
type_nr
<
atom_value
>::
value
,
nullptr
))
{
if
(
!
msg
.
match_element
(
pos
,
detail
::
type_nr
<
atom_value
>::
value
,
nullptr
))
{
return
false
;
return
false
;
}
}
if
(
storage
)
{
auto
ptr
=
msg
.
at
(
pos
);
auto
ptr
=
msg
.
at
(
pos
);
if
(
me
.
v
!=
*
reinterpret_cast
<
const
atom_value
*>
(
ptr
))
{
if
(
me
.
v
!=
*
reinterpret_cast
<
const
atom_value
*>
(
ptr
))
{
return
false
;
return
false
;
}
// This assignment casts `atom_value` to `atom_constant<V>*`.
// This type violation could theoretically cause undefined behavior.
// However, `uti` does have an address that is guaranteed to be valid
// throughout the runtime of the program and the atom constant
// does not have any members. Hence, this is nonetheless safe since
// we are never actually going to dereference the pointer.
*
storage
=
const_cast
<
void
*>
(
ptr
);
}
}
// This assignment casts `atom_value` to `atom_constant<V>*`.
// This type violation could theoretically cause undefined behavior.
// However, `uti` does have an address that is guaranteed to be valid
// throughout the runtime of the program and the atom constant
// does not have any members. Hence, this is nonetheless safe since
// we are never actually going to dereference the pointer.
*
storage
=
const_cast
<
void
*>
(
ptr
);
return
true
;
return
true
;
}
}
...
@@ -74,7 +70,7 @@ class set_commit_rollback {
...
@@ -74,7 +70,7 @@ class set_commit_rollback {
++
m_pos
;
++
m_pos
;
}
}
inline
pointer
current
()
{
inline
pointer
current
()
{
return
m_data
?
&
m_data
[
m_pos
]
:
nullptr
;
return
&
m_data
[
m_pos
]
;
}
}
inline
void
commit
()
{
inline
void
commit
()
{
m_fallback_pos
=
m_pos
;
m_fallback_pos
=
m_pos
;
...
@@ -130,6 +126,8 @@ bool try_match(const message& msg, size_t msg_pos, size_t msg_size,
...
@@ -130,6 +126,8 @@ bool try_match(const message& msg, size_t msg_pos, size_t msg_size,
}
}
bool
try_match
(
const
message
&
msg
,
pattern_iterator
pb
,
size_t
ps
,
void
**
out
)
{
bool
try_match
(
const
message
&
msg
,
pattern_iterator
pb
,
size_t
ps
,
void
**
out
)
{
CAF_REQUIRE
(
out
!=
nullptr
);
CAF_REQUIRE
(
msg
.
empty
()
||
msg
.
vals
()
->
get_reference_count
()
>
0
);
set_commit_rollback
scr
{
out
};
set_commit_rollback
scr
{
out
};
return
try_match
(
msg
,
0
,
msg
.
size
(),
pb
,
pb
+
ps
,
scr
);
return
try_match
(
msg
,
0
,
msg
.
size
(),
pb
,
pb
+
ps
,
scr
);
}
}
...
...
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