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
64dbf780
Commit
64dbf780
authored
Jun 05, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix
parent
32de80f3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
32 deletions
+75
-32
cppa/detail/value_guard.hpp
cppa/detail/value_guard.hpp
+46
-19
cppa/util/void_type.hpp
cppa/util/void_type.hpp
+0
-3
src/uniform_type_info.cpp
src/uniform_type_info.cpp
+29
-10
No files found.
cppa/detail/value_guard.hpp
View file @
64dbf780
...
@@ -62,30 +62,24 @@ struct vg_fwd
...
@@ -62,30 +62,24 @@ struct vg_fwd
typename
util
::
rm_ref
<
T
>::
type
>
{
typename
util
::
rm_ref
<
T
>::
type
>
{
};
};
template
<
typename
FilteredPattern
>
template
<
typename
T
>
class
value_guard
{
struct
vg_cmp
{
typename
tdata_from_type_list
<
FilteredPattern
>::
type
m_args
;
template
<
typename
U
>
inline
static
bool
_
(
const
T
&
lhs
,
const
U
&
rhs
)
{
template
<
typename
...
Args
>
static
inline
bool
_eval
(
const
util
::
void_type
&
,
const
tdata
<>&
,
const
Args
&
...)
{
return
true
;
}
template
<
typename
T0
,
typename
T1
>
static
inline
bool
cmp
(
const
T0
&
lhs
,
const
T1
&
rhs
)
{
return
lhs
==
rhs
;
return
lhs
==
rhs
;
}
}
};
template
<
typename
T0
,
typename
T1
>
template
<
>
static
inline
bool
cmp
(
const
T0
&
lhs
,
const
std
::
reference_wrapper
<
T1
>&
rhs
)
{
struct
vg_cmp
<
util
::
void_type
>
{
return
lhs
==
rhs
.
get
();
template
<
typename
T
>
inline
static
bool
_
(
const
util
::
void_type
&
,
const
T
&
)
{
return
true
;
}
}
};
template
<
typename
Head
,
typename
Tail0
,
typename
...
Tail
,
typename
Arg0
,
typename
...
Args
>
template
<
typename
FilteredPattern
>
static
inline
bool
_eval
(
const
Head
&
head
,
const
tdata
<
Tail0
,
Tail
...
>&
tail
,
class
value_guard
{
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
return
cmp
(
head
,
arg0
)
&&
_eval
(
tail
.
head
,
tail
.
tail
(),
args
...);
}
public:
public:
...
@@ -100,6 +94,39 @@ class value_guard {
...
@@ -100,6 +94,39 @@ class value_guard {
inline
bool
operator
()(
const
Args
&
...
args
)
const
{
inline
bool
operator
()(
const
Args
&
...
args
)
const
{
return
_eval
(
m_args
.
head
,
m_args
.
tail
(),
args
...);
return
_eval
(
m_args
.
head
,
m_args
.
tail
(),
args
...);
}
}
private:
typename
tdata_from_type_list
<
FilteredPattern
>::
type
m_args
;
template
<
typename
T
,
typename
U
>
static
inline
bool
cmp
(
const
T
&
lhs
,
const
U
&
rhs
)
{
return
vg_cmp
<
T
>::
_
(
lhs
,
rhs
);
}
template
<
typename
T
,
typename
U
>
static
inline
bool
cmp
(
const
T
&
lhs
,
const
std
::
reference_wrapper
<
U
>&
rhs
)
{
return
vg_cmp
<
T
>::
_
(
lhs
,
rhs
.
get
());
}
static
inline
bool
_eval
(
const
util
::
void_type
&
,
const
tdata
<>&
)
{
return
true
;
}
template
<
typename
Head
,
typename
Arg0
,
typename
...
Args
>
static
inline
bool
_eval
(
const
Head
&
head
,
const
tdata
<>&
,
const
Arg0
&
arg0
,
const
Args
&
...)
{
return
cmp
(
head
,
arg0
);
}
template
<
typename
Head
,
typename
Tail0
,
typename
...
Tail
,
typename
Arg0
,
typename
...
Args
>
static
inline
bool
_eval
(
const
Head
&
head
,
const
tdata
<
Tail0
,
Tail
...
>&
tail
,
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
return
cmp
(
head
,
arg0
)
&&
_eval
(
tail
.
head
,
tail
.
tail
(),
args
...);
}
};
};
}
}
// namespace cppa::detail
}
}
// namespace cppa::detail
...
...
cppa/util/void_type.hpp
View file @
64dbf780
...
@@ -41,9 +41,6 @@ struct void_type {
...
@@ -41,9 +41,6 @@ struct void_type {
constexpr
void_type
(
const
Arg
&
)
{
}
constexpr
void_type
(
const
Arg
&
)
{
}
};
};
inline
bool
operator
==
(
const
void_type
&
,
const
void_type
&
)
{
return
true
;
}
inline
bool
operator
!=
(
const
void_type
&
,
const
void_type
&
)
{
return
false
;
}
}
}
// namespace cppa::util
}
}
// namespace cppa::util
#endif // LIBCPPA_UTIL_VOID_TYPE_HPP
#endif // LIBCPPA_UTIL_VOID_TYPE_HPP
src/uniform_type_info.cpp
View file @
64dbf780
...
@@ -143,11 +143,11 @@ void deserialize_nullptr(deserializer* source) {
...
@@ -143,11 +143,11 @@ void deserialize_nullptr(deserializer* source) {
source
->
end_object
();
source
->
end_object
();
}
}
class
void_type_tinfo
:
public
u
til
::
abstract_uniform_type_info
<
void_type
>
{
class
void_type_tinfo
:
public
u
niform_type_info
{
protected:
protected:
void
serialize
(
void
const
*
,
serializer
*
sink
)
const
{
void
serialize
(
const
void
*
,
serializer
*
sink
)
const
{
serialize_nullptr
(
sink
);
serialize_nullptr
(
sink
);
}
}
...
@@ -159,6 +159,25 @@ class void_type_tinfo : public util::abstract_uniform_type_info<void_type> {
...
@@ -159,6 +159,25 @@ class void_type_tinfo : public util::abstract_uniform_type_info<void_type> {
deserialize_nullptr
(
source
);
deserialize_nullptr
(
source
);
}
}
bool
equals
(
const
void
*
,
const
void
*
)
const
{
return
true
;
}
void
*
new_instance
(
const
void
*
)
const
{
return
new
void_type
;
}
void
delete_instance
(
void
*
instance
)
const
{
delete
reinterpret_cast
<
void_type
*>
(
instance
);
}
public:
bool
equals
(
const
std
::
type_info
&
tinfo
)
const
{
return
typeid
(
void_type
)
==
tinfo
;
}
};
};
class
actor_ptr_tinfo
:
public
util
::
abstract_uniform_type_info
<
actor_ptr
>
{
class
actor_ptr_tinfo
:
public
util
::
abstract_uniform_type_info
<
actor_ptr
>
{
...
@@ -232,7 +251,7 @@ class actor_ptr_tinfo : public util::abstract_uniform_type_info<actor_ptr> {
...
@@ -232,7 +251,7 @@ class actor_ptr_tinfo : public util::abstract_uniform_type_info<actor_ptr> {
protected:
protected:
void
serialize
(
void
const
*
ptr
,
serializer
*
sink
)
const
{
void
serialize
(
const
void
*
ptr
,
serializer
*
sink
)
const
{
s_serialize
(
*
reinterpret_cast
<
const
actor_ptr
*>
(
ptr
),
s_serialize
(
*
reinterpret_cast
<
const
actor_ptr
*>
(
ptr
),
sink
,
sink
,
name
());
name
());
...
@@ -287,7 +306,7 @@ class group_ptr_tinfo : public util::abstract_uniform_type_info<group_ptr> {
...
@@ -287,7 +306,7 @@ class group_ptr_tinfo : public util::abstract_uniform_type_info<group_ptr> {
protected:
protected:
void
serialize
(
void
const
*
ptr
,
serializer
*
sink
)
const
{
void
serialize
(
const
void
*
ptr
,
serializer
*
sink
)
const
{
s_serialize
(
*
reinterpret_cast
<
const
group_ptr
*>
(
ptr
),
s_serialize
(
*
reinterpret_cast
<
const
group_ptr
*>
(
ptr
),
sink
,
sink
,
name
());
name
());
...
@@ -365,7 +384,7 @@ class channel_ptr_tinfo : public util::abstract_uniform_type_info<channel_ptr> {
...
@@ -365,7 +384,7 @@ class channel_ptr_tinfo : public util::abstract_uniform_type_info<channel_ptr> {
protected:
protected:
void
serialize
(
void
const
*
instance
,
serializer
*
sink
)
const
{
void
serialize
(
const
void
*
instance
,
serializer
*
sink
)
const
{
s_serialize
(
*
reinterpret_cast
<
const
channel_ptr
*>
(
instance
),
s_serialize
(
*
reinterpret_cast
<
const
channel_ptr
*>
(
instance
),
sink
,
sink
,
name
(),
name
(),
...
@@ -425,7 +444,7 @@ class any_tuple_tinfo : public util::abstract_uniform_type_info<any_tuple> {
...
@@ -425,7 +444,7 @@ class any_tuple_tinfo : public util::abstract_uniform_type_info<any_tuple> {
protected:
protected:
void
serialize
(
void
const
*
instance
,
serializer
*
sink
)
const
{
void
serialize
(
const
void
*
instance
,
serializer
*
sink
)
const
{
s_serialize
(
*
reinterpret_cast
<
const
any_tuple
*>
(
instance
),
sink
,
name
());
s_serialize
(
*
reinterpret_cast
<
const
any_tuple
*>
(
instance
),
sink
,
name
());
}
}
...
@@ -444,7 +463,7 @@ class addr_msg_tinfo : public util::abstract_uniform_type_info<addressed_message
...
@@ -444,7 +463,7 @@ class addr_msg_tinfo : public util::abstract_uniform_type_info<addressed_message
public:
public:
virtual
void
serialize
(
void
const
*
instance
,
serializer
*
sink
)
const
{
virtual
void
serialize
(
const
void
*
instance
,
serializer
*
sink
)
const
{
const
addressed_message
&
msg
=
*
reinterpret_cast
<
const
addressed_message
*>
(
instance
);
const
addressed_message
&
msg
=
*
reinterpret_cast
<
const
addressed_message
*>
(
instance
);
const
any_tuple
&
data
=
msg
.
content
();
const
any_tuple
&
data
=
msg
.
content
();
sink
->
begin_object
(
name
());
sink
->
begin_object
(
name
());
...
@@ -493,7 +512,7 @@ class process_info_ptr_tinfo : public util::abstract_uniform_type_info<process_i
...
@@ -493,7 +512,7 @@ class process_info_ptr_tinfo : public util::abstract_uniform_type_info<process_i
public:
public:
virtual
void
serialize
(
void
const
*
instance
,
serializer
*
sink
)
const
{
virtual
void
serialize
(
const
void
*
instance
,
serializer
*
sink
)
const
{
auto
&
ptr
=
*
reinterpret_cast
<
ptr_type
const
*>
(
instance
);
auto
&
ptr
=
*
reinterpret_cast
<
ptr_type
const
*>
(
instance
);
if
(
ptr
==
nullptr
)
{
if
(
ptr
==
nullptr
)
{
serialize_nullptr
(
sink
);
serialize_nullptr
(
sink
);
...
@@ -538,7 +557,7 @@ class atom_value_tinfo : public util::abstract_uniform_type_info<atom_value> {
...
@@ -538,7 +557,7 @@ class atom_value_tinfo : public util::abstract_uniform_type_info<atom_value> {
public:
public:
virtual
void
serialize
(
void
const
*
instance
,
serializer
*
sink
)
const
{
virtual
void
serialize
(
const
void
*
instance
,
serializer
*
sink
)
const
{
auto
val
=
reinterpret_cast
<
const
atom_value
*>
(
instance
);
auto
val
=
reinterpret_cast
<
const
atom_value
*>
(
instance
);
sink
->
begin_object
(
name
());
sink
->
begin_object
(
name
());
sink
->
write_value
(
static_cast
<
std
::
uint64_t
>
(
*
val
));
sink
->
write_value
(
static_cast
<
std
::
uint64_t
>
(
*
val
));
...
@@ -559,7 +578,7 @@ class atom_value_tinfo : public util::abstract_uniform_type_info<atom_value> {
...
@@ -559,7 +578,7 @@ class atom_value_tinfo : public util::abstract_uniform_type_info<atom_value> {
class
duration_tinfo
:
public
util
::
abstract_uniform_type_info
<
util
::
duration
>
{
class
duration_tinfo
:
public
util
::
abstract_uniform_type_info
<
util
::
duration
>
{
virtual
void
serialize
(
void
const
*
instance
,
serializer
*
sink
)
const
{
virtual
void
serialize
(
const
void
*
instance
,
serializer
*
sink
)
const
{
auto
val
=
reinterpret_cast
<
const
util
::
duration
*>
(
instance
);
auto
val
=
reinterpret_cast
<
const
util
::
duration
*>
(
instance
);
sink
->
begin_object
(
name
());
sink
->
begin_object
(
name
());
sink
->
write_value
(
static_cast
<
std
::
uint32_t
>
(
val
->
unit
));
sink
->
write_value
(
static_cast
<
std
::
uint32_t
>
(
val
->
unit
));
...
...
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