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
54f080df
Commit
54f080df
authored
May 11, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Plain Diff
merged master into unstable
parents
0b5d229b
4c39c810
Changes
124
Show whitespace changes
Inline
Side-by-side
Showing
124 changed files
with
1171 additions
and
742 deletions
+1171
-742
benchmarks/actor_creation.cpp
benchmarks/actor_creation.cpp
+1
-1
benchmarks/mixed_case.cpp
benchmarks/mixed_case.cpp
+5
-5
benchmarks/theron_actor_creation.cpp
benchmarks/theron_actor_creation.cpp
+3
-3
benchmarks/theron_mailbox_performance.cpp
benchmarks/theron_mailbox_performance.cpp
+1
-1
benchmarks/theron_mixed_case.cpp
benchmarks/theron_mixed_case.cpp
+8
-8
cppa/abstract_actor.hpp
cppa/abstract_actor.hpp
+1
-1
cppa/actor.hpp
cppa/actor.hpp
+7
-7
cppa/actor_proxy.hpp
cppa/actor_proxy.hpp
+2
-2
cppa/announce.hpp
cppa/announce.hpp
+5
-5
cppa/any_tuple.hpp
cppa/any_tuple.hpp
+10
-10
cppa/anything.hpp
cppa/anything.hpp
+2
-2
cppa/atom.hpp
cppa/atom.hpp
+1
-1
cppa/attachable.hpp
cppa/attachable.hpp
+5
-5
cppa/behavior.hpp
cppa/behavior.hpp
+5
-5
cppa/binary_deserializer.hpp
cppa/binary_deserializer.hpp
+1
-1
cppa/binary_serializer.hpp
cppa/binary_serializer.hpp
+2
-2
cppa/cow_ptr.hpp
cppa/cow_ptr.hpp
+5
-5
cppa/cow_tuple.hpp
cppa/cow_tuple.hpp
+11
-11
cppa/cppa.hpp
cppa/cppa.hpp
+17
-17
cppa/deserializer.hpp
cppa/deserializer.hpp
+3
-3
cppa/detail/abstract_scheduled_actor.hpp
cppa/detail/abstract_scheduled_actor.hpp
+1
-1
cppa/detail/abstract_tuple.hpp
cppa/detail/abstract_tuple.hpp
+6
-6
cppa/detail/actor_proxy_cache.hpp
cppa/detail/actor_proxy_cache.hpp
+2
-2
cppa/detail/actor_registry.hpp
cppa/detail/actor_registry.hpp
+1
-1
cppa/detail/addressed_message.hpp
cppa/detail/addressed_message.hpp
+7
-7
cppa/detail/channel.hpp
cppa/detail/channel.hpp
+1
-1
cppa/detail/decorated_tuple.hpp
cppa/detail/decorated_tuple.hpp
+6
-6
cppa/detail/default_uniform_type_info_impl.hpp
cppa/detail/default_uniform_type_info_impl.hpp
+2
-2
cppa/detail/empty_tuple.hpp
cppa/detail/empty_tuple.hpp
+1
-1
cppa/detail/get_behavior.hpp
cppa/detail/get_behavior.hpp
+8
-8
cppa/detail/group_manager.hpp
cppa/detail/group_manager.hpp
+2
-2
cppa/detail/implicit_conversions.hpp
cppa/detail/implicit_conversions.hpp
+2
-2
cppa/detail/invokable.hpp
cppa/detail/invokable.hpp
+22
-22
cppa/detail/list_member.hpp
cppa/detail/list_member.hpp
+2
-2
cppa/detail/map_member.hpp
cppa/detail/map_member.hpp
+4
-4
cppa/detail/matches.hpp
cppa/detail/matches.hpp
+40
-40
cppa/detail/object_array.hpp
cppa/detail/object_array.hpp
+3
-3
cppa/detail/object_impl.hpp
cppa/detail/object_impl.hpp
+3
-3
cppa/detail/post_office.hpp
cppa/detail/post_office.hpp
+2
-2
cppa/detail/post_office_msg.hpp
cppa/detail/post_office_msg.hpp
+158
-0
cppa/detail/projection.hpp
cppa/detail/projection.hpp
+10
-10
cppa/detail/pseudo_tuple.hpp
cppa/detail/pseudo_tuple.hpp
+1
-1
cppa/detail/receive_loop_helper.hpp
cppa/detail/receive_loop_helper.hpp
+1
-1
cppa/detail/ref_counted_impl.hpp
cppa/detail/ref_counted_impl.hpp
+2
-2
cppa/detail/tdata.hpp
cppa/detail/tdata.hpp
+28
-28
cppa/detail/thread.hpp
cppa/detail/thread.hpp
+3
-3
cppa/detail/to_uniform_name.hpp
cppa/detail/to_uniform_name.hpp
+2
-2
cppa/detail/tuple_cast_impl.hpp
cppa/detail/tuple_cast_impl.hpp
+11
-11
cppa/detail/tuple_iterator.hpp
cppa/detail/tuple_iterator.hpp
+4
-4
cppa/detail/tuple_vals.hpp
cppa/detail/tuple_vals.hpp
+4
-4
cppa/detail/tuple_view.hpp
cppa/detail/tuple_view.hpp
+2
-2
cppa/detail/types_array.hpp
cppa/detail/types_array.hpp
+1
-1
cppa/detail/uniform_type_info_map.hpp
cppa/detail/uniform_type_info_map.hpp
+4
-4
cppa/detail/value_guard.hpp
cppa/detail/value_guard.hpp
+9
-10
cppa/either.hpp
cppa/either.hpp
+16
-16
cppa/exception.hpp
cppa/exception.hpp
+2
-2
cppa/from_string.hpp
cppa/from_string.hpp
+2
-2
cppa/get.hpp
cppa/get.hpp
+6
-6
cppa/group.hpp
cppa/group.hpp
+12
-12
cppa/guard_expr.hpp
cppa/guard_expr.hpp
+52
-50
cppa/intrusive/forward_iterator.hpp
cppa/intrusive/forward_iterator.hpp
+15
-15
cppa/intrusive/single_reader_queue.hpp
cppa/intrusive/single_reader_queue.hpp
+2
-2
cppa/intrusive/singly_linked_list.hpp
cppa/intrusive/singly_linked_list.hpp
+6
-6
cppa/intrusive_ptr.hpp
cppa/intrusive_ptr.hpp
+17
-16
cppa/match.hpp
cppa/match.hpp
+8
-8
cppa/match_expr.hpp
cppa/match_expr.hpp
+43
-43
cppa/object.hpp
cppa/object.hpp
+10
-10
cppa/on.hpp
cppa/on.hpp
+5
-5
cppa/option.hpp
cppa/option.hpp
+11
-11
cppa/partial_function.hpp
cppa/partial_function.hpp
+6
-6
cppa/pattern.hpp
cppa/pattern.hpp
+17
-17
cppa/primitive_variant.hpp
cppa/primitive_variant.hpp
+16
-16
cppa/process_information.hpp
cppa/process_information.hpp
+13
-13
cppa/receive.hpp
cppa/receive.hpp
+2
-2
cppa/scheduler.hpp
cppa/scheduler.hpp
+2
-2
cppa/self.hpp
cppa/self.hpp
+2
-2
cppa/serializer.hpp
cppa/serializer.hpp
+5
-5
cppa/to_string.hpp
cppa/to_string.hpp
+1
-1
cppa/tpartial_function.hpp
cppa/tpartial_function.hpp
+3
-3
cppa/tuple_cast.hpp
cppa/tuple_cast.hpp
+7
-7
cppa/type_value_pair.hpp
cppa/type_value_pair.hpp
+7
-7
cppa/uniform_type_info.hpp
cppa/uniform_type_info.hpp
+18
-18
cppa/util/abstract_uniform_type_info.hpp
cppa/util/abstract_uniform_type_info.hpp
+3
-3
cppa/util/apply_args.hpp
cppa/util/apply_args.hpp
+2
-2
cppa/util/apply_tuple.hpp
cppa/util/apply_tuple.hpp
+5
-5
cppa/util/comparable.hpp
cppa/util/comparable.hpp
+18
-18
cppa/util/compare_tuples.hpp
cppa/util/compare_tuples.hpp
+7
-7
cppa/util/deduce_ref_type.hpp
cppa/util/deduce_ref_type.hpp
+2
-2
cppa/util/duration.hpp
cppa/util/duration.hpp
+3
-3
cppa/util/fixed_vector.hpp
cppa/util/fixed_vector.hpp
+3
-3
cppa/util/guard.hpp
cppa/util/guard.hpp
+1
-1
cppa/util/is_mutable_ref.hpp
cppa/util/is_mutable_ref.hpp
+1
-1
cppa/util/left_or_right.hpp
cppa/util/left_or_right.hpp
+1
-1
cppa/util/producer_consumer_list.hpp
cppa/util/producer_consumer_list.hpp
+1
-1
cppa/util/ripemd_160.hpp
cppa/util/ripemd_160.hpp
+1
-1
cppa/util/rm_ref.hpp
cppa/util/rm_ref.hpp
+1
-1
cppa/util/static_foreach.hpp
cppa/util/static_foreach.hpp
+4
-4
cppa/util/type_list.hpp
cppa/util/type_list.hpp
+4
-4
cppa/util/void_type.hpp
cppa/util/void_type.hpp
+3
-3
examples/announce_example_4.cpp
examples/announce_example_4.cpp
+2
-2
examples/dining_philosophers.cpp
examples/dining_philosophers.cpp
+3
-3
src/abstract_scheduled_actor.cpp
src/abstract_scheduled_actor.cpp
+269
-0
src/abstract_tuple.cpp
src/abstract_tuple.cpp
+1
-1
src/actor_registry.cpp
src/actor_registry.cpp
+2
-2
src/any_tuple.cpp
src/any_tuple.cpp
+2
-2
src/atom.cpp
src/atom.cpp
+1
-1
src/group.cpp
src/group.cpp
+10
-10
src/group_manager.cpp
src/group_manager.cpp
+1
-1
src/invokable.cpp
src/invokable.cpp
+2
-2
src/object.cpp
src/object.cpp
+3
-3
src/object_array.cpp
src/object_array.cpp
+1
-1
src/pattern.cpp
src/pattern.cpp
+1
-1
src/process_information.cpp
src/process_information.cpp
+9
-9
src/ripemd_160.cpp
src/ripemd_160.cpp
+1
-1
src/uniform_type_info.cpp
src/uniform_type_info.cpp
+10
-10
unit_testing/main.cpp
unit_testing/main.cpp
+6
-6
unit_testing/test.hpp
unit_testing/test.hpp
+5
-5
unit_testing/test__atom.cpp
unit_testing/test__atom.cpp
+1
-1
unit_testing/test__intrusive_containers.cpp
unit_testing/test__intrusive_containers.cpp
+4
-4
unit_testing/test__match.cpp
unit_testing/test__match.cpp
+6
-6
unit_testing/test__pattern.cpp
unit_testing/test__pattern.cpp
+3
-3
unit_testing/test__primitive_variant.cpp
unit_testing/test__primitive_variant.cpp
+2
-2
unit_testing/test__remote_actor.cpp
unit_testing/test__remote_actor.cpp
+3
-3
unit_testing/test__tuple.cpp
unit_testing/test__tuple.cpp
+7
-7
No files found.
benchmarks/actor_creation.cpp
View file @
54f080df
...
...
@@ -48,7 +48,7 @@ struct testee : fsm_actor<testee>
{
actor_ptr
parent
;
behavior
init_state
;
testee
(
actor_ptr
const
&
pptr
)
:
parent
(
pptr
)
testee
(
const
actor_ptr
&
pptr
)
:
parent
(
pptr
)
{
init_state
=
(
...
...
benchmarks/mixed_case.cpp
View file @
54f080df
...
...
@@ -55,7 +55,7 @@ constexpr uint64_t s_task_n = uint64_t(86028157)*329545133;
constexpr
uint64_t
s_factor1
=
86028157
;
constexpr
uint64_t
s_factor2
=
329545133
;
void
check_factors
(
factors
const
&
vec
)
void
check_factors
(
const
factors
&
vec
)
{
assert
(
vec
.
size
()
==
2
);
assert
(
vec
[
0
]
==
s_factor1
);
...
...
@@ -69,7 +69,7 @@ struct fsm_worker : fsm_actor<fsm_worker>
{
actor_ptr
mc
;
behavior
init_state
;
fsm_worker
(
actor_ptr
const
&
msgcollector
)
:
mc
(
msgcollector
)
fsm_worker
(
const
actor_ptr
&
msgcollector
)
:
mc
(
msgcollector
)
{
init_state
=
(
...
...
@@ -89,7 +89,7 @@ struct fsm_chain_link : fsm_actor<fsm_chain_link>
{
actor_ptr
next
;
behavior
init_state
;
fsm_chain_link
(
actor_ptr
const
&
n
)
:
next
(
n
)
fsm_chain_link
(
const
actor_ptr
&
n
)
:
next
(
n
)
{
init_state
=
(
...
...
@@ -165,7 +165,7 @@ struct fsm_supervisor : fsm_actor<fsm_supervisor>
{
if
(
--
left
==
0
)
become_void
();
},
on
<
atom
(
"result"
),
factors
>
()
>>
[
=
](
factors
const
&
vec
)
on
<
atom
(
"result"
),
factors
>
()
>>
[
=
](
const
factors
&
vec
)
{
check_factors
(
vec
);
if
(
--
left
==
0
)
become_void
();
...
...
@@ -259,7 +259,7 @@ void supervisor(int num_msgs)
{
--
num_msgs
;
},
on
<
atom
(
"result"
),
factors
>
()
>>
[
&
](
factors
const
&
vec
)
on
<
atom
(
"result"
),
factors
>
()
>>
[
&
](
const
factors
&
vec
)
{
--
num_msgs
;
check_factors
(
vec
);
...
...
benchmarks/theron_actor_creation.cpp
View file @
54f080df
...
...
@@ -26,7 +26,7 @@ struct testee : Actor
uint32_t
m_first_result
;
std
::
vector
<
ActorRef
>
m_children
;
void
spread_handler
(
spread
const
&
arg
,
const
Address
)
void
spread_handler
(
const
spread
&
arg
,
const
Address
)
{
if
(
arg
.
value
==
0
)
{
...
...
@@ -44,7 +44,7 @@ struct testee : Actor
}
}
void
result_handler
(
result
cons
t
&
arg
,
const
Address
)
void
result_handler
(
const
resul
t
&
arg
,
const
Address
)
{
if
(
!
m_first_result_received
)
{
...
...
@@ -60,7 +60,7 @@ struct testee : Actor
typedef
struct
{
Address
arg0
;
}
Parameters
;
testee
(
Parameters
const
&
p
)
:
m_parent
(
p
.
arg0
),
m_first_result_received
(
false
)
testee
(
const
Parameters
&
p
)
:
m_parent
(
p
.
arg0
),
m_first_result_received
(
false
)
{
RegisterHandler
(
this
,
&
testee
::
spread_handler
);
RegisterHandler
(
this
,
&
testee
::
result_handler
);
...
...
benchmarks/theron_mailbox_performance.cpp
View file @
54f080df
...
...
@@ -23,7 +23,7 @@ struct receiver : Actor
int64_t
m_num
;
void
handler
(
int64_t
cons
t
&
,
const
Address
from
)
void
handler
(
const
int64_
t
&
,
const
Address
from
)
{
if
(
++
m_num
==
t_max
)
Send
(
t_max
,
from
);
...
...
benchmarks/theron_mixed_case.cpp
View file @
54f080df
...
...
@@ -32,11 +32,11 @@ struct worker_done { };
struct
worker
:
Actor
{
void
handle_calc
(
c
alc_msg
const
&
msg
,
Address
from
)
void
handle_calc
(
c
onst
calc_msg
&
msg
,
Address
from
)
{
factorize
(
msg
.
value
);
}
void
handle_master_done
(
master_done
const
&
,
Address
from
)
void
handle_master_done
(
const
master_done
&
,
Address
from
)
{
Send
(
worker_done
(),
from
);
}
...
...
@@ -51,12 +51,12 @@ struct worker : Actor
struct
chain_link
:
Actor
{
Address
next
;
void
handle_token
(
token_msg
const
&
msg
,
Address
)
void
handle_token
(
const
token_msg
&
msg
,
Address
)
{
Send
(
msg
,
next
);
}
typedef
struct
{
Address
next
;
}
Parameters
;
chain_link
(
Parameters
const
&
p
)
:
next
(
p
.
next
)
chain_link
(
const
Parameters
&
p
)
:
next
(
p
.
next
)
{
RegisterHandler
(
this
,
&
chain_link
::
handle_token
);
}
...
...
@@ -84,7 +84,7 @@ struct master : Actor
}
Send
(
token_msg
{
initial_token_value
},
next
);
}
void
handle_init
(
init_msg
const
&
msg
,
Address
)
void
handle_init
(
const
init_msg
&
msg
,
Address
)
{
w
=
GetFramework
().
CreateActor
<
worker
>
();
iteration
=
0
;
...
...
@@ -93,7 +93,7 @@ struct master : Actor
max_iterations
=
msg
.
iterations
;
new_ring
();
}
void
handle_token
(
token_msg
const
&
msg
,
Address
)
void
handle_token
(
const
token_msg
&
msg
,
Address
)
{
if
(
msg
.
value
==
0
)
{
...
...
@@ -111,13 +111,13 @@ struct master : Actor
Send
(
token_msg
{
msg
.
value
-
1
},
next
);
}
}
void
handle_worker_done
(
worker_done
const
&
,
Address
)
void
handle_worker_done
(
const
worker_done
&
,
Address
)
{
Send
(
master_done
(),
mc
);
w
=
ActorRef
::
Null
();
}
typedef
struct
{
Address
mc
;
}
Parameters
;
master
(
Parameters
const
&
p
)
:
mc
(
p
.
mc
),
iteration
(
0
)
master
(
const
Parameters
&
p
)
:
mc
(
p
.
mc
),
iteration
(
0
)
{
RegisterHandler
(
this
,
&
master
::
handle_init
);
RegisterHandler
(
this
,
&
master
::
handle_token
);
...
...
cppa/abstract_actor.hpp
View file @
54f080df
...
...
@@ -95,7 +95,7 @@ class abstract_actor : public Base
}
}
void
detach
(
attachable
::
token
const
&
what
)
// override
void
detach
(
const
attachable
::
token
&
what
)
// override
{
attachable_ptr
uptr
;
// lifetime scope of guard
...
...
cppa/actor.hpp
View file @
54f080df
...
...
@@ -96,7 +96,7 @@ class actor : public channel
/**
* @brief Detaches the first attached object that matches @p what.
*/
virtual
void
detach
(
attachable
::
token
const
&
what
)
=
0
;
virtual
void
detach
(
const
attachable
::
token
&
what
)
=
0
;
template
<
typename
T
>
bool
attach
(
std
::
unique_ptr
<
T
>&&
ptr
,
...
...
@@ -118,7 +118,7 @@ class actor : public channel
* @note Groups are leaved automatically if the Actor finishes
* execution.
*/
void
leave
(
group_ptr
const
&
what
);
void
leave
(
const
group_ptr
&
what
);
/**
* @brief Links this actor to @p other.
...
...
@@ -175,7 +175,7 @@ class actor : public channel
* @brief Gets the {@link process_information} of the parent process.
* @returns The {@link process_information} of the parent process.
*/
inline
process_information
const
&
parent_process
()
const
;
inline
const
process_information
&
parent_process
()
const
;
/**
* @brief Gets the {@link process_information} pointer
...
...
@@ -202,10 +202,10 @@ class actor : public channel
protected:
actor
(
process_information_ptr
const
&
parent
=
process_information
::
get
());
actor
(
const
process_information_ptr
&
parent
=
process_information
::
get
());
actor
(
std
::
uint32_t
aid
,
process_information_ptr
const
&
parent
=
process_information
::
get
());
const
process_information_ptr
&
parent
=
process_information
::
get
());
private:
...
...
@@ -224,7 +224,7 @@ typedef intrusive_ptr<actor> actor_ptr;
* inline and template member function implementations *
******************************************************************************/
inline
process_information
const
&
actor
::
parent_process
()
const
inline
const
process_information
&
actor
::
parent_process
()
const
{
return
*
m_parent_process
;
}
...
...
@@ -271,7 +271,7 @@ class functor_attachable : public attachable
m_functor
(
reason
);
}
bool
matches
(
attachable
::
token
const
&
)
bool
matches
(
const
attachable
::
token
&
)
{
return
false
;
}
...
...
cppa/actor_proxy.hpp
View file @
54f080df
...
...
@@ -52,7 +52,7 @@ class actor_proxy : public abstract_actor<actor>
public:
actor_proxy
(
std
::
uint32_t
mid
,
process_information_ptr
const
&
parent
);
actor_proxy
(
std
::
uint32_t
mid
,
const
process_information_ptr
&
parent
);
void
enqueue
(
actor
*
sender
,
any_tuple
msg
);
...
...
@@ -74,7 +74,7 @@ class actor_proxy : public abstract_actor<actor>
public:
void
forward_message
(
process_information_ptr
const
&
,
actor
*
,
any_tuple
&&
);
void
forward_message
(
const
process_information_ptr
&
,
actor
*
,
any_tuple
&&
);
};
...
...
cppa/announce.hpp
View file @
54f080df
...
...
@@ -98,7 +98,7 @@ namespace cppa {
* instance (mapped to @p plain_type); otherwise @c false
* is returned and @p uniform_type was deleted.
*/
bool
announce
(
std
::
type_info
const
&
tinfo
,
uniform_type_info
*
utype
);
bool
announce
(
const
std
::
type_info
&
tinfo
,
uniform_type_info
*
utype
);
// deals with member pointer
/**
...
...
@@ -110,7 +110,7 @@ bool announce(std::type_info const& tinfo, uniform_type_info* utype);
*/
template
<
class
C
,
class
Parent
,
typename
...
Args
>
std
::
pair
<
C
Parent
::*
,
util
::
abstract_uniform_type_info
<
C
>*>
compound_member
(
C
Parent
::*
c_ptr
,
Args
const
&
...
args
)
compound_member
(
C
Parent
::*
c_ptr
,
const
Args
&
...
args
)
{
return
{
c_ptr
,
new
detail
::
default_uniform_type_info_impl
<
C
>
(
args
...)
};
}
...
...
@@ -118,7 +118,7 @@ compound_member(C Parent::*c_ptr, Args const&... args)
// deals with getter returning a mutable reference
template
<
class
C
,
class
Parent
,
typename
...
Args
>
std
::
pair
<
C
&
(
Parent
::*
)(),
util
::
abstract_uniform_type_info
<
C
>*>
compound_member
(
C
&
(
Parent
::*
c_ptr
)(),
Args
const
&
...
args
)
compound_member
(
C
&
(
Parent
::*
c_ptr
)(),
const
Args
&
...
args
)
{
return
{
c_ptr
,
new
detail
::
default_uniform_type_info_impl
<
C
>
(
args
...)
};
}
...
...
@@ -129,7 +129,7 @@ template<class Parent, typename GRes,
std
::
pair
<
std
::
pair
<
GRes
(
Parent
::*
)()
const
,
SRes
(
Parent
::*
)(
SArg
)
>
,
util
::
abstract_uniform_type_info
<
typename
util
::
rm_ref
<
GRes
>::
type
>*>
compound_member
(
const
std
::
pair
<
GRes
(
Parent
::*
)()
const
,
SRes
(
Parent
::*
)(
SArg
)
>&
gspair
,
Args
const
&
...
args
)
const
Args
&
...
args
)
{
return
{
gspair
,
new
detail
::
default_uniform_type_info_impl
<
typename
util
::
rm_ref
<
GRes
>::
type
>
(
args
...)
};
}
...
...
@@ -142,7 +142,7 @@ compound_member(const std::pair<GRes (Parent::*)() const, SRes (Parent::*)(SArg)
* otherwise @c false.
*/
template
<
typename
T
,
typename
...
Args
>
inline
bool
announce
(
Args
const
&
...
args
)
inline
bool
announce
(
const
Args
&
...
args
)
{
return
announce
(
typeid
(
T
),
new
detail
::
default_uniform_type_info_impl
<
T
>
(
args
...));
...
...
cppa/any_tuple.hpp
View file @
54f080df
...
...
@@ -67,7 +67,7 @@ class any_tuple
* @brief Creates a tuple from @p t.
*/
template
<
typename
...
Args
>
any_tuple
(
co
w_tuple
<
Args
...
>
const
&
t
)
:
m_vals
(
t
.
vals
())
{
}
any_tuple
(
co
nst
cow_tuple
<
Args
...
>
&
t
)
:
m_vals
(
t
.
vals
())
{
}
/**
* @brief Creates a tuple and moves the content from @p t.
...
...
@@ -85,7 +85,7 @@ class any_tuple
/**
* @brief Copy constructor.
*/
any_tuple
(
any_tuple
const
&
)
=
default
;
any_tuple
(
const
any_tuple
&
)
=
default
;
/**
* @brief Move assignment.
...
...
@@ -95,7 +95,7 @@ class any_tuple
/**
* @brief Copy assignment.
*/
any_tuple
&
operator
=
(
any_tuple
const
&
)
=
default
;
any_tuple
&
operator
=
(
const
any_tuple
&
)
=
default
;
/**
* @brief Gets the size of this tuple.
...
...
@@ -121,7 +121,7 @@ class any_tuple
/**
* @brief Returns @c true if <tt>*this == other</tt>, otherwise false.
*/
bool
equals
(
any_tuple
const
&
other
)
const
;
bool
equals
(
const
any_tuple
&
other
)
const
;
/**
* @brief Returns true if <tt>size() == 0</tt>, otherwise false.
...
...
@@ -129,7 +129,7 @@ class any_tuple
inline
bool
empty
()
const
{
return
size
()
==
0
;
}
template
<
typename
T
>
inline
T
const
&
get_as
(
size_t
p
)
const
inline
const
T
&
get_as
(
size_t
p
)
const
{
CPPA_REQUIRE
(
*
(
type_at
(
p
))
==
typeid
(
T
));
return
*
reinterpret_cast
<
T
const
*>
(
at
(
p
));
...
...
@@ -147,8 +147,8 @@ class any_tuple
inline
const_iterator
end
()
const
{
return
m_vals
->
end
();
}
inline
cow_ptr
<
detail
::
abstract_tuple
>&
vals
()
{
return
m_vals
;
}
inline
co
w_ptr
<
detail
::
abstract_tuple
>
const
&
vals
()
const
{
return
m_vals
;
}
inline
co
w_ptr
<
detail
::
abstract_tuple
>
const
&
cvals
()
const
{
return
m_vals
;
}
inline
co
nst
cow_ptr
<
detail
::
abstract_tuple
>
&
vals
()
const
{
return
m_vals
;
}
inline
co
nst
cow_ptr
<
detail
::
abstract_tuple
>
&
cvals
()
const
{
return
m_vals
;
}
inline
std
::
type_info
const
*
type_token
()
const
{
...
...
@@ -205,7 +205,7 @@ class any_tuple
cow_ptr
<
detail
::
abstract_tuple
>
m_vals
;
explicit
any_tuple
(
co
w_ptr
<
detail
::
abstract_tuple
>
const
&
vals
);
explicit
any_tuple
(
co
nst
cow_ptr
<
detail
::
abstract_tuple
>
&
vals
);
typedef
detail
::
abstract_tuple
*
tup_ptr
;
...
...
@@ -260,7 +260,7 @@ class any_tuple
/**
* @relates any_tuple
*/
inline
bool
operator
==
(
any_tuple
const
&
lhs
,
any_tuple
const
&
rhs
)
inline
bool
operator
==
(
const
any_tuple
&
lhs
,
const
any_tuple
&
rhs
)
{
return
lhs
.
equals
(
rhs
);
}
...
...
@@ -268,7 +268,7 @@ inline bool operator==(any_tuple const& lhs, any_tuple const& rhs)
/**
* @relates any_tuple
*/
inline
bool
operator
!=
(
any_tuple
const
&
lhs
,
any_tuple
const
&
rhs
)
inline
bool
operator
!=
(
const
any_tuple
&
lhs
,
const
any_tuple
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
...
...
cppa/anything.hpp
View file @
54f080df
...
...
@@ -40,12 +40,12 @@ namespace cppa {
*/
struct
anything
{
};
inline
bool
operator
==
(
anything
const
&
,
anything
const
&
)
inline
bool
operator
==
(
const
anything
&
,
const
anything
&
)
{
return
true
;
}
inline
bool
operator
!=
(
anything
const
&
,
anything
const
&
)
inline
bool
operator
!=
(
const
anything
&
,
const
anything
&
)
{
return
false
;
}
...
...
cppa/atom.hpp
View file @
54f080df
...
...
@@ -39,7 +39,7 @@ namespace cppa {
enum
class
atom_value
:
std
::
uint64_t
{
dirty_little_hack
=
37337
};
std
::
string
to_string
(
atom_value
const
&
a
);
std
::
string
to_string
(
const
atom_value
&
a
);
/**
* @brief Creates an atom from given string literal.
...
...
cppa/attachable.hpp
View file @
54f080df
...
...
@@ -42,8 +42,8 @@ namespace cppa {
class
attachable
{
attachable
(
attachable
const
&
)
=
delete
;
attachable
&
operator
=
(
attachable
const
&
)
=
delete
;
attachable
(
const
attachable
&
)
=
delete
;
attachable
&
operator
=
(
const
attachable
&
)
=
delete
;
protected:
...
...
@@ -59,12 +59,12 @@ class attachable
/**
* @brief Denotes the type of @c ptr.
*/
std
::
type_info
const
&
subtype
;
const
std
::
type_info
&
subtype
;
/**
* @brief Any value, used to identify @c attachable instances.
*/
void
const
*
ptr
;
inline
token
(
std
::
type_info
const
&
msubtype
,
void
const
*
mptr
)
inline
token
(
const
std
::
type_info
&
msubtype
,
void
const
*
mptr
)
:
subtype
(
msubtype
),
ptr
(
mptr
)
{
}
...
...
@@ -85,7 +85,7 @@ class attachable
* @param what A value that selects zero or more @c attachable instances.
* @returns @c true if @p what selects this instance; otherwise @c false.
*/
virtual
bool
matches
(
token
const
&
what
)
=
0
;
virtual
bool
matches
(
const
token
&
what
)
=
0
;
};
...
...
cppa/behavior.hpp
View file @
54f080df
...
...
@@ -54,8 +54,8 @@ class behavior
friend
behavior
operator
,(
partial_function
&&
lhs
,
behavior
&&
rhs
);
behavior
(
behavior
const
&
)
=
delete
;
behavior
&
operator
=
(
behavior
const
&
)
=
delete
;
behavior
(
const
behavior
&
)
=
delete
;
behavior
&
operator
=
(
const
behavior
&
)
=
delete
;
public:
...
...
@@ -67,7 +67,7 @@ class behavior
}
template
<
typename
...
Cases
>
behavior
(
match_expr
<
Cases
...
>
const
&
me
)
:
m_fun
(
me
)
{
}
behavior
(
const
match_expr
<
Cases
...
>
&
me
)
:
m_fun
(
me
)
{
}
inline
behavior
(
util
::
duration
tout
,
std
::
function
<
void
()
>&&
handler
)
:
m_timeout
(
tout
),
m_timeout_handler
(
std
::
move
(
handler
))
...
...
@@ -87,7 +87,7 @@ class behavior
m_timeout_handler
();
}
inline
util
::
duration
const
&
timeout
()
const
inline
const
util
::
duration
&
timeout
()
const
{
return
m_timeout
;
}
...
...
@@ -124,7 +124,7 @@ class behavior
};
template
<
typename
...
Lhs
>
behavior
operator
,(
match_expr
<
Lhs
...
>
const
&
lhs
,
behavior
operator
,(
const
match_expr
<
Lhs
...
>
&
lhs
,
behavior
&&
rhs
)
{
rhs
.
get_partial_function
()
=
lhs
;
...
...
cppa/binary_deserializer.hpp
View file @
54f080df
...
...
@@ -54,7 +54,7 @@ class binary_deserializer : public deserializer
std
::
string
seek_object
();
std
::
string
peek_object
();
void
begin_object
(
std
::
string
const
&
type_name
);
void
begin_object
(
const
std
::
string
&
type_name
);
void
end_object
();
size_t
begin_sequence
();
void
end_sequence
();
...
...
cppa/binary_serializer.hpp
View file @
54f080df
...
...
@@ -60,7 +60,7 @@ class binary_serializer : public serializer
~
binary_serializer
();
void
begin_object
(
std
::
string
const
&
tname
);
void
begin_object
(
const
std
::
string
&
tname
);
void
end_object
();
...
...
@@ -68,7 +68,7 @@ class binary_serializer : public serializer
void
end_sequence
();
void
write_value
(
primitive_variant
cons
t
&
value
);
void
write_value
(
const
primitive_varian
t
&
value
);
void
write_tuple
(
size_t
size
,
primitive_variant
const
*
values
);
...
...
cppa/cow_ptr.hpp
View file @
54f080df
...
...
@@ -58,10 +58,10 @@ class cow_ptr
cow_ptr
(
cow_ptr
&&
other
)
:
m_ptr
(
std
::
move
(
other
.
m_ptr
))
{
}
cow_ptr
(
co
w_ptr
const
&
other
)
:
m_ptr
(
other
.
m_ptr
)
{
}
cow_ptr
(
co
nst
cow_ptr
&
other
)
:
m_ptr
(
other
.
m_ptr
)
{
}
template
<
typename
Y
>
cow_ptr
(
co
w_ptr
<
Y
>
const
&
other
)
:
m_ptr
(
const_cast
<
Y
*>
(
other
.
get
()))
{
}
cow_ptr
(
co
nst
cow_ptr
<
Y
>
&
other
)
:
m_ptr
(
const_cast
<
Y
*>
(
other
.
get
()))
{
}
inline
void
swap
(
cow_ptr
&
other
)
{
...
...
@@ -74,7 +74,7 @@ class cow_ptr
return
*
this
;
}
cow_ptr
&
operator
=
(
co
w_ptr
const
&
other
)
cow_ptr
&
operator
=
(
co
nst
cow_ptr
&
other
)
{
cow_ptr
tmp
{
other
};
swap
(
tmp
);
...
...
@@ -82,7 +82,7 @@ class cow_ptr
}
template
<
typename
Y
>
cow_ptr
&
operator
=
(
co
w_ptr
<
Y
>
const
&
other
)
cow_ptr
&
operator
=
(
co
nst
cow_ptr
<
Y
>
&
other
)
{
cow_ptr
tmp
{
other
};
swap
(
tmp
);
...
...
@@ -104,7 +104,7 @@ class cow_ptr
inline
T
const
*
get
()
const
{
return
ptr
();
}
inline
T
const
&
operator
*
()
const
{
return
*
ptr
();
}
inline
const
T
&
operator
*
()
const
{
return
*
ptr
();
}
inline
T
const
*
operator
->
()
const
{
return
ptr
();
}
...
...
cppa/cow_tuple.hpp
View file @
54f080df
...
...
@@ -102,7 +102,7 @@ class cow_tuple
* @brief Initializes the cow_tuple with @p args.
* @param args Initialization values.
*/
cow_tuple
(
ElementTypes
const
&
...
args
)
:
m_vals
(
new
data_type
(
args
...))
cow_tuple
(
const
ElementTypes
&
...
args
)
:
m_vals
(
new
data_type
(
args
...))
{
}
...
...
@@ -115,9 +115,9 @@ class cow_tuple
}
cow_tuple
(
cow_tuple
&&
)
=
default
;
cow_tuple
(
co
w_tuple
const
&
)
=
default
;
cow_tuple
(
co
nst
cow_tuple
&
)
=
default
;
cow_tuple
&
operator
=
(
cow_tuple
&&
)
=
default
;
cow_tuple
&
operator
=
(
co
w_tuple
const
&
)
=
default
;
cow_tuple
&
operator
=
(
co
nst
cow_tuple
&
)
=
default
;
inline
static
cow_tuple
from
(
cow_ptr_type
ptr
)
{
...
...
@@ -125,7 +125,7 @@ class cow_tuple
}
inline
static
cow_tuple
from
(
cow_ptr_type
ptr
,
util
::
fixed_vector
<
size_t
,
num_elements
>
const
&
mv
)
const
util
::
fixed_vector
<
size_t
,
num_elements
>
&
mv
)
{
return
{
priv_ctor
{},
decorated_type
::
create
(
std
::
move
(
ptr
),
mv
)};
}
...
...
@@ -169,7 +169,7 @@ class cow_tuple
return
m_vals
->
type_at
(
p
);
}
inline
co
w_ptr
<
detail
::
abstract_tuple
>
const
&
vals
()
const
inline
co
nst
cow_ptr
<
detail
::
abstract_tuple
>
&
vals
()
const
{
return
m_vals
;
}
...
...
@@ -196,7 +196,7 @@ struct cow_tuple_from_type_list< util::type_list<Types...> >
* @relates cow_tuple
*/
template
<
size_t
N
,
typename
T
>
T
const
&
get
(
cow_tuple
<
...
>
const
&
tup
);
const
T
&
get
(
const
cow_tuple
<
...
>
&
tup
);
/**
* @ingroup CopyOnWrite
...
...
@@ -223,7 +223,7 @@ cow_tuple<Args...> make_cow_tuple(Args&&... args);
#else
template
<
size_t
N
,
typename
...
Types
>
const
typename
util
::
at
<
N
,
Types
...
>::
type
&
get
(
co
w_tuple
<
Types
...
>
const
&
tup
)
const
typename
util
::
at
<
N
,
Types
...
>::
type
&
get
(
co
nst
cow_tuple
<
Types
...
>
&
tup
)
{
typedef
typename
util
::
at
<
N
,
Types
...
>::
type
result_type
;
return
*
reinterpret_cast
<
result_type
const
*>
(
tup
.
at
(
N
));
...
...
@@ -253,8 +253,8 @@ make_cow_tuple(Args&&... args)
* @relates cow_tuple
*/
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
inline
bool
operator
==
(
co
w_tuple
<
LhsTypes
...
>
const
&
lhs
,
co
w_tuple
<
RhsTypes
...
>
const
&
rhs
)
inline
bool
operator
==
(
co
nst
cow_tuple
<
LhsTypes
...
>
&
lhs
,
co
nst
cow_tuple
<
RhsTypes
...
>
&
rhs
)
{
return
util
::
compare_tuples
(
lhs
,
rhs
);
}
...
...
@@ -267,8 +267,8 @@ inline bool operator==(cow_tuple<LhsTypes...> const& lhs,
* @relates cow_tuple
*/
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
inline
bool
operator
!=
(
co
w_tuple
<
LhsTypes
...
>
const
&
lhs
,
co
w_tuple
<
RhsTypes
...
>
const
&
rhs
)
inline
bool
operator
!=
(
co
nst
cow_tuple
<
LhsTypes
...
>
&
lhs
,
co
nst
cow_tuple
<
RhsTypes
...
>
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
...
...
cppa/cppa.hpp
View file @
54f080df
...
...
@@ -217,7 +217,7 @@
* @code
* receive
* (
* on<atom("hello"), std::string>() >> [](
std::string const
& msg)
* on<atom("hello"), std::string>() >> [](
const std::string
& msg)
* {
* cout << "received hello message: " << msg << endl;
* },
...
...
@@ -242,7 +242,7 @@
* @code
* receive
* (
* on(atom("hello"), val<std::string>()) >> [](
std::string const
& msg)
* on(atom("hello"), val<std::string>()) >> [](
const std::string
& msg)
* {
* cout << "received hello message: " << msg << endl;
* },
...
...
@@ -541,7 +541,7 @@ inline actor_ptr spawn(F&& what, Arg0&& arg0, Args&&... args)
* /
template<scheduling_hint Hint, typename F, typename... Args>
auto //actor_ptr
spawn(F&& what,
Args const
&... args)
spawn(F&& what,
const Args
&... args)
-> typename std::enable_if<
!std::is_convertible<typename util::rm_ref<F>::type, scheduled_actor*>::value
&& !std::is_convertible<typename util::rm_ref<F>::type, event_based_actor*>::value,
...
...
@@ -560,7 +560,7 @@ spawn(F&& what, Args const&... args)
* /
template<typename F, typename... Args>
auto // actor_ptr
spawn(F&& what,
Args const
&... args)
spawn(F&& what,
const Args
&... args)
-> typename std::enable_if<
!std::is_convertible<typename util::rm_ref<F>::type, scheduled_actor*>::value
&& !std::is_convertible<typename util::rm_ref<F>::type, event_based_actor*>::value,
...
...
@@ -578,7 +578,7 @@ spawn(F&& what, Args const&... args)
* @brief Sends <tt>{arg0, args...}</tt> as a message to @p whom.
*/
template
<
typename
Arg0
,
typename
...
Args
>
void
send
(
channel_ptr
&
whom
,
Arg0
const
&
arg0
,
Args
const
&
...
args
);
void
send
(
channel_ptr
&
whom
,
const
Arg0
&
arg0
,
const
Args
&
...
args
);
/**
* @ingroup MessageHandling
...
...
@@ -590,19 +590,19 @@ void send(channel_ptr& whom, Arg0 const& arg0, Args const&... args);
* @endcode
* @returns @p whom.
*/
channel_ptr
&
operator
<<
(
channel_ptr
&
whom
,
any_tuple
const
&
what
);
channel_ptr
&
operator
<<
(
channel_ptr
&
whom
,
const
any_tuple
&
what
);
#else
template
<
class
C
,
typename
Arg0
,
typename
...
Args
>
void
send
(
intrusive_ptr
<
C
>&
whom
,
Arg0
const
&
arg0
,
Args
const
&
...
args
)
void
send
(
intrusive_ptr
<
C
>&
whom
,
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
static_assert
(
std
::
is_base_of
<
channel
,
C
>::
value
,
"C is not a channel"
);
if
(
whom
)
self
->
send_message
(
whom
.
get
(),
make_cow_tuple
(
arg0
,
args
...));
}
template
<
class
C
,
typename
Arg0
,
typename
...
Args
>
void
send
(
intrusive_ptr
<
C
>&&
whom
,
Arg0
const
&
arg0
,
Args
const
&
...
args
)
void
send
(
intrusive_ptr
<
C
>&&
whom
,
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
static_assert
(
std
::
is_base_of
<
channel
,
C
>::
value
,
"C is not a channel"
);
intrusive_ptr
<
C
>
tmp
(
std
::
move
(
whom
));
...
...
@@ -611,7 +611,7 @@ void send(intrusive_ptr<C>&& whom, Arg0 const& arg0, Args const&... args)
// matches "send(this, ...)" in event-based actors
template
<
typename
Arg0
,
typename
...
Args
>
inline
void
send
(
local_actor
*
whom
,
Arg0
const
&
arg0
,
Args
const
&
...
args
)
inline
void
send
(
local_actor
*
whom
,
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
CPPA_REQUIRE
(
whom
!=
nullptr
);
whom
->
enqueue
(
whom
,
make_cow_tuple
(
arg0
,
args
...));
...
...
@@ -620,7 +620,7 @@ inline void send(local_actor* whom, Arg0 const& arg0, Args const&... args)
// matches send(self, ...);
template
<
typename
Arg0
,
typename
...
Args
>
inline
void
send
(
self_type
const
&
,
Arg0
const
&
arg0
,
Args
const
&
...
args
)
inline
void
send
(
const
self_type
&
,
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
send
(
static_cast
<
local_actor
*>
(
self
),
arg0
,
args
...);
}
...
...
@@ -630,7 +630,7 @@ typename std::enable_if<
std
::
is_base_of
<
channel
,
C
>::
value
,
intrusive_ptr
<
C
>&
>::
type
operator
<<
(
intrusive_ptr
<
C
>&
whom
,
any_tuple
const
&
what
)
operator
<<
(
intrusive_ptr
<
C
>&
whom
,
const
any_tuple
&
what
)
{
if
(
whom
)
self
->
send_message
(
whom
.
get
(),
what
);
return
whom
;
...
...
@@ -641,7 +641,7 @@ typename std::enable_if<
std
::
is_base_of
<
channel
,
C
>::
value
,
intrusive_ptr
<
C
>
>::
type
operator
<<
(
intrusive_ptr
<
C
>&&
whom
,
any_tuple
const
&
what
)
operator
<<
(
intrusive_ptr
<
C
>&&
whom
,
const
any_tuple
&
what
)
{
intrusive_ptr
<
C
>
tmp
(
std
::
move
(
whom
));
tmp
<<
what
;
...
...
@@ -671,9 +671,9 @@ operator<<(intrusive_ptr<C>&& whom, any_tuple&& what)
return
std
::
move
(
tmp
);
}
self_type
const
&
operator
<<
(
self_type
const
&
s
,
any_tuple
const
&
what
);
const
self_type
&
operator
<<
(
const
self_type
&
s
,
const
any_tuple
&
what
);
self_type
const
&
operator
<<
(
self_type
const
&
s
,
any_tuple
&&
what
);
const
self_type
&
operator
<<
(
const
self_type
&
s
,
any_tuple
&&
what
);
#endif // CPPA_DOCUMENTATION
...
...
@@ -682,7 +682,7 @@ self_type const& operator<<(self_type const& s, any_tuple&& what);
* @brief Sends a message to the sender of the last received message.
*/
template
<
typename
Arg0
,
typename
...
Args
>
void
reply
(
Arg0
const
&
arg0
,
Args
const
&
...
args
)
void
reply
(
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
send
(
self
->
last_sender
(),
arg0
,
args
...);
}
...
...
@@ -695,7 +695,7 @@ void reply(Arg0 const& arg0, Args const&... args)
* @param data Any number of values for the message content.
*/
template
<
typename
Duration
,
typename
...
Data
>
void
future_send
(
actor_ptr
whom
,
Duration
const
&
rel_time
,
Data
const
&
...
data
)
void
future_send
(
actor_ptr
whom
,
const
Duration
&
rel_time
,
const
Data
&
...
data
)
{
get_scheduler
()
->
future_send
(
whom
,
rel_time
,
data
...);
}
...
...
@@ -706,7 +706,7 @@ void future_send(actor_ptr whom, Duration const& rel_time, Data const&... data)
* @see future_send()
*/
template
<
typename
Duration
,
typename
...
Data
>
void
delayed_reply
(
Duration
const
&
rel_time
,
Data
const
...
data
)
void
delayed_reply
(
const
Duration
&
rel_time
,
Data
const
...
data
)
{
future_send
(
self
->
last_sender
(),
rel_time
,
data
...);
}
...
...
cppa/deserializer.hpp
View file @
54f080df
...
...
@@ -48,8 +48,8 @@ class object;
class
deserializer
{
deserializer
(
deserializer
const
&
)
=
delete
;
deserializer
&
operator
=
(
deserializer
const
&
)
=
delete
;
deserializer
(
const
deserializer
&
)
=
delete
;
deserializer
&
operator
=
(
const
deserializer
&
)
=
delete
;
public:
...
...
@@ -73,7 +73,7 @@ class deserializer
* @brief Begins deserialization of an object of type @p type_name.
* @param type_name The platform-independent @p libcppa type name.
*/
virtual
void
begin_object
(
std
::
string
const
&
type_name
)
=
0
;
virtual
void
begin_object
(
const
std
::
string
&
type_name
)
=
0
;
/**
* @brief Ends deserialization of an object.
...
...
cppa/detail/abstract_scheduled_actor.hpp
View file @
54f080df
...
...
@@ -93,7 +93,7 @@ class abstract_scheduled_actor : public abstract_actor<scheduled_actor>
return
m_has_pending_timeout_request
;
}
void
request_timeout
(
util
::
duration
const
&
d
)
void
request_timeout
(
const
util
::
duration
&
d
)
{
if
(
d
.
valid
())
{
...
...
cppa/detail/abstract_tuple.hpp
View file @
54f080df
...
...
@@ -58,7 +58,7 @@ class abstract_tuple : public ref_counted
public:
inline
abstract_tuple
(
tuple_impl_info
tii
)
:
m_impl_type
(
tii
)
{
}
abstract_tuple
(
abstract_tuple
const
&
other
);
abstract_tuple
(
const
abstract_tuple
&
other
);
// mutators
virtual
void
*
mutable_at
(
size_t
pos
)
=
0
;
...
...
@@ -85,7 +85,7 @@ class abstract_tuple : public ref_counted
// (default returns &typeid(void))
virtual
std
::
type_info
const
*
type_token
()
const
;
bool
equals
(
abstract_tuple
const
&
other
)
const
;
bool
equals
(
const
abstract_tuple
&
other
)
const
;
typedef
tuple_iterator
<
abstract_tuple
>
const_iterator
;
...
...
@@ -101,8 +101,8 @@ struct full_eq_type
{
constexpr
full_eq_type
()
{
}
template
<
class
Tuple
>
inline
bool
operator
()(
tuple_iterator
<
Tuple
>
const
&
lhs
,
tuple_iterator
<
Tuple
>
const
&
rhs
)
const
inline
bool
operator
()(
const
tuple_iterator
<
Tuple
>
&
lhs
,
const
tuple_iterator
<
Tuple
>
&
rhs
)
const
{
return
lhs
.
type
()
==
rhs
.
type
()
&&
lhs
.
type
()
->
equals
(
lhs
.
value
(),
rhs
.
value
());
...
...
@@ -113,14 +113,14 @@ struct types_only_eq_type
{
constexpr
types_only_eq_type
()
{
}
template
<
class
Tuple
>
inline
bool
operator
()(
tuple_iterator
<
Tuple
>
const
&
lhs
,
inline
bool
operator
()(
const
tuple_iterator
<
Tuple
>
&
lhs
,
uniform_type_info
const
*
rhs
)
const
{
return
lhs
.
type
()
==
rhs
;
}
template
<
class
Tuple
>
inline
bool
operator
()(
uniform_type_info
const
*
lhs
,
tuple_iterator
<
Tuple
>
const
&
rhs
)
const
const
tuple_iterator
<
Tuple
>
&
rhs
)
const
{
return
lhs
==
rhs
.
type
();
}
...
...
cppa/detail/actor_proxy_cache.hpp
View file @
54f080df
...
...
@@ -54,7 +54,7 @@ class actor_proxy_cache
process_information
::
node_id_type
const
&
node_id
);
// @returns true if pptr was successfully removed, false otherwise
bool
erase
(
actor_proxy_ptr
const
&
pptr
);
bool
erase
(
const
actor_proxy_ptr
&
pptr
);
template
<
typename
Fun
>
void
erase_all
(
process_information
::
node_id_type
const
&
nid
,
...
...
@@ -94,7 +94,7 @@ class actor_proxy_cache
util
::
shared_spinlock
m_lock
;
std
::
map
<
key_tuple
,
actor_proxy_ptr
,
key_tuple_less
>
m_entries
;
actor_proxy_ptr
get_impl
(
key_tuple
const
&
key
);
actor_proxy_ptr
get_impl
(
const
key_tuple
&
key
);
};
...
...
cppa/detail/actor_registry.hpp
View file @
54f080df
...
...
@@ -52,7 +52,7 @@ class actor_registry
// return nullptr if the actor wasn't put *or* finished execution
actor_ptr
get
(
actor_id
key
)
const
;
void
put
(
actor_id
key
,
actor_ptr
const
&
value
);
void
put
(
actor_id
key
,
const
actor_ptr
&
value
);
void
erase
(
actor_id
key
);
...
...
cppa/detail/addressed_message.hpp
View file @
54f080df
...
...
@@ -49,16 +49,16 @@ class addressed_message
addressed_message
()
=
default
;
addressed_message
(
addressed_message
&&
)
=
default
;
addressed_message
(
addressed_message
const
&
)
=
default
;
addressed_message
(
const
addressed_message
&
)
=
default
;
addressed_message
&
operator
=
(
addressed_message
&&
)
=
default
;
addressed_message
&
operator
=
(
addressed_message
const
&
)
=
default
;
addressed_message
&
operator
=
(
const
addressed_message
&
)
=
default
;
inline
actor_ptr
&
sender
()
{
return
m_sender
;
}
inline
actor_ptr
const
&
sender
()
const
inline
const
actor_ptr
&
sender
()
const
{
return
m_sender
;
}
...
...
@@ -68,7 +68,7 @@ class addressed_message
return
m_receiver
;
}
inline
c
hannel_ptr
const
&
receiver
()
const
inline
c
onst
channel_ptr
&
receiver
()
const
{
return
m_receiver
;
}
...
...
@@ -78,7 +78,7 @@ class addressed_message
return
m_content
;
}
inline
any_tuple
const
&
content
()
const
inline
const
any_tuple
&
content
()
const
{
return
m_content
;
}
...
...
@@ -96,9 +96,9 @@ class addressed_message
};
bool
operator
==
(
addressed_message
const
&
lhs
,
addressed_message
const
&
rhs
);
bool
operator
==
(
const
addressed_message
&
lhs
,
const
addressed_message
&
rhs
);
inline
bool
operator
!=
(
addressed_message
const
&
lhs
,
addressed_message
const
&
rhs
)
inline
bool
operator
!=
(
const
addressed_message
&
lhs
,
const
addressed_message
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
...
...
cppa/detail/channel.hpp
View file @
54f080df
...
...
@@ -40,7 +40,7 @@ namespace cppa { namespace detail {
// public part of the actor interface
struct
channel
:
ref_counted
{
virtual
void
enqueue_msg
(
message
const
&
msg
)
=
0
;
virtual
void
enqueue_msg
(
const
message
&
msg
)
=
0
;
};
}
}
// namespace cppa::detail
...
...
cppa/detail/decorated_tuple.hpp
View file @
54f080df
...
...
@@ -65,7 +65,7 @@ class decorated_tuple : public abstract_tuple
typedef
cow_ptr
<
abstract_tuple
>
cow_pointer_type
;
static
inline
cow_pointer_type
create
(
cow_pointer_type
d
,
vector_type
const
&
v
)
const
vector_type
&
v
)
{
return
cow_pointer_type
{
new
decorated_tuple
(
std
::
move
(
d
),
v
)};
}
...
...
@@ -114,12 +114,12 @@ class decorated_tuple : public abstract_tuple
cow_pointer_type
m_decorated
;
vector_type
m_mapping
;
decorated_tuple
(
cow_pointer_type
d
,
vector_type
const
&
v
)
decorated_tuple
(
cow_pointer_type
d
,
const
vector_type
&
v
)
:
super
(
tuple_impl_info
::
statically_typed
)
,
m_decorated
(
std
::
move
(
d
)),
m_mapping
(
v
)
{
# ifdef CPPA_DEBUG
co
w_pointer_type
const
&
ptr
=
m_decorated
;
// prevent detaching
co
nst
cow_pointer_type
&
ptr
=
m_decorated
;
// prevent detaching
# endif
CPPA_REQUIRE
(
ptr
->
size
()
>=
sizeof
...(
ElementTypes
));
CPPA_REQUIRE
(
v
.
size
()
==
sizeof
...(
ElementTypes
));
...
...
@@ -130,7 +130,7 @@ class decorated_tuple : public abstract_tuple
:
super
(
tuple_impl_info
::
statically_typed
),
m_decorated
(
std
::
move
(
d
))
{
# ifdef CPPA_DEBUG
co
w_pointer_type
const
&
ptr
=
m_decorated
;
// prevent detaching
co
nst
cow_pointer_type
&
ptr
=
m_decorated
;
// prevent detaching
# endif
CPPA_REQUIRE
((
ptr
->
size
()
-
offset
)
>=
sizeof
...(
ElementTypes
));
CPPA_REQUIRE
(
offset
>
0
);
...
...
@@ -139,9 +139,9 @@ class decorated_tuple : public abstract_tuple
std
::
generate
(
m_mapping
.
begin
(),
m_mapping
.
end
(),
[
&
]()
{
return
i
++
;});
}
decorated_tuple
(
decorated_tuple
const
&
)
=
default
;
decorated_tuple
(
const
decorated_tuple
&
)
=
default
;
decorated_tuple
&
operator
=
(
decorated_tuple
const
&
)
=
delete
;
decorated_tuple
&
operator
=
(
const
decorated_tuple
&
)
=
delete
;
};
...
...
cppa/detail/default_uniform_type_info_impl.hpp
View file @
54f080df
...
...
@@ -127,8 +127,8 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
void
*
,
deserializer
*
)
>
m_deserialize
;
member
(
member
const
&
)
=
delete
;
member
&
operator
=
(
member
const
&
)
=
delete
;
member
(
const
member
&
)
=
delete
;
member
&
operator
=
(
const
member
&
)
=
delete
;
void
swap
(
member
&
other
)
{
...
...
cppa/detail/empty_tuple.hpp
View file @
54f080df
...
...
@@ -45,7 +45,7 @@ struct empty_tuple : abstract_tuple
void
*
mutable_at
(
size_t
);
abstract_tuple
*
copy
()
const
;
void
const
*
at
(
size_t
)
const
;
bool
equals
(
abstract_tuple
const
&
other
)
const
;
bool
equals
(
const
abstract_tuple
&
other
)
const
;
uniform_type_info
const
*
type_at
(
size_t
)
const
;
std
::
type_info
const
*
type_token
()
const
;
...
...
cppa/detail/get_behavior.hpp
View file @
54f080df
...
...
@@ -73,7 +73,7 @@ class ftor_behavior<true, true, F, Args...> : public scheduled_actor
public:
ftor_behavior
(
F
ptr
,
Args
const
&
...
args
)
:
m_fun
(
ptr
),
m_args
(
args
...)
{
}
ftor_behavior
(
F
ptr
,
const
Args
&
...
args
)
:
m_fun
(
ptr
),
m_args
(
args
...)
{
}
virtual
void
act
()
{
util
::
apply_tuple
(
m_fun
,
m_args
);
}
...
...
@@ -87,7 +87,7 @@ class ftor_behavior<false, false, F> : public scheduled_actor
public:
ftor_behavior
(
F
const
&
arg
)
:
m_fun
(
arg
)
{
}
ftor_behavior
(
const
F
&
arg
)
:
m_fun
(
arg
)
{
}
ftor_behavior
(
F
&&
arg
)
:
m_fun
(
std
::
move
(
arg
))
{
}
...
...
@@ -112,11 +112,11 @@ class ftor_behavior<false, true, F, Args...> : public scheduled_actor
public:
ftor_behavior
(
F
const
&
f
,
Args
const
&
...
args
)
:
m_fun
(
f
),
m_args
(
args
...)
ftor_behavior
(
const
F
&
f
,
const
Args
&
...
args
)
:
m_fun
(
f
),
m_args
(
args
...)
{
}
ftor_behavior
(
F
&&
f
,
Args
const
&
...
args
)
:
m_fun
(
std
::
move
(
f
))
ftor_behavior
(
F
&&
f
,
const
Args
&
...
args
)
:
m_fun
(
std
::
move
(
f
))
,
m_args
(
args
...)
{
}
...
...
@@ -149,8 +149,8 @@ scheduled_actor* get_behavior(std::integral_constant<bool,false>, F&& ftor)
template
<
typename
F
,
typename
Arg0
,
typename
...
Args
>
scheduled_actor
*
get_behavior
(
std
::
integral_constant
<
bool
,
true
>
,
F
fptr
,
Arg0
const
&
arg0
,
Args
const
&
...
args
)
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
static_assert
(
std
::
is_convertible
<
decltype
(
fptr
(
arg0
,
args
...)),
scheduled_actor
*>::
value
==
false
,
"Spawning a function returning an actor_behavior? "
...
...
@@ -163,8 +163,8 @@ scheduled_actor* get_behavior(std::integral_constant<bool,true>,
template
<
typename
F
,
typename
Arg0
,
typename
...
Args
>
scheduled_actor
*
get_behavior
(
std
::
integral_constant
<
bool
,
false
>
,
F
ftor
,
Arg0
const
&
arg0
,
Args
const
&
...
args
)
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
static_assert
(
std
::
is_convertible
<
decltype
(
ftor
(
arg0
,
args
...)),
scheduled_actor
*>::
value
==
false
,
"Spawning a functor returning an actor_behavior? "
...
...
cppa/detail/group_manager.hpp
View file @
54f080df
...
...
@@ -46,8 +46,8 @@ class group_manager
group_manager
();
intrusive_ptr
<
group
>
get
(
std
::
string
const
&
module_name
,
std
::
string
const
&
group_identifier
);
intrusive_ptr
<
group
>
get
(
const
std
::
string
&
module_name
,
const
std
::
string
&
group_identifier
);
intrusive_ptr
<
group
>
anonymous
();
...
...
cppa/detail/implicit_conversions.hpp
View file @
54f080df
...
...
@@ -56,13 +56,13 @@ struct implicit_conversions
subtype1
;
typedef
typename
util
::
replace_type
<
subtype1
,
std
::
u16string
,
std
::
is_same
<
subtype1
,
c
har16_t
cons
t
*>
,
std
::
is_same
<
subtype1
,
c
onst
char16_
t
*>
,
std
::
is_same
<
subtype1
,
char16_t
*>
,
util
::
is_array_of
<
subtype1
,
char16_t
>>::
type
subtype2
;
typedef
typename
util
::
replace_type
<
subtype2
,
std
::
u32string
,
std
::
is_same
<
subtype2
,
c
har32_t
cons
t
*>
,
std
::
is_same
<
subtype2
,
c
onst
char32_
t
*>
,
std
::
is_same
<
subtype2
,
char32_t
*>
,
util
::
is_array_of
<
subtype2
,
char32_t
>>::
type
subtype3
;
...
...
cppa/detail/invokable.hpp
View file @
54f080df
...
...
@@ -51,8 +51,8 @@ namespace cppa { namespace detail {
class
invokable
{
invokable
(
invokable
const
&
)
=
delete
;
invokable
&
operator
=
(
invokable
const
&
)
=
delete
;
invokable
(
const
invokable
&
)
=
delete
;
invokable
&
operator
=
(
const
invokable
&
)
=
delete
;
public:
...
...
@@ -62,9 +62,9 @@ class invokable
virtual
~
invokable
();
// Checks whether the types of @p value match the pattern.
virtual
bool
types_match
(
any_tuple
const
&
value
)
const
;
virtual
bool
types_match
(
const
any_tuple
&
value
)
const
;
// Checks whether this invokable could be invoked with @p value.
virtual
bool
could_invoke
(
any_tuple
const
&
value
)
const
;
virtual
bool
could_invoke
(
const
any_tuple
&
value
)
const
;
// Type checking.
virtual
bool
invoke
(
any_tuple
&
value
)
const
;
...
...
@@ -86,22 +86,22 @@ struct pattern_policy
Pattern
m_pattern
;
template
<
typename
...
Args
>
pattern_policy
(
Args
&&
...
args
)
:
m_pattern
(
std
::
forward
<
Args
>
(
args
)...)
{
}
bool
types_match
(
any_tuple
const
&
value
)
const
bool
types_match
(
const
any_tuple
&
value
)
const
{
return
matches_types
(
value
,
m_pattern
);
}
bool
could_invoke
(
any_tuple
const
&
value
)
const
bool
could_invoke
(
const
any_tuple
&
value
)
const
{
return
matches
(
value
,
m_pattern
);
}
template
<
typename
Fun
>
bool
call
(
Fun
const
&
fun
,
any_tuple
&
value
)
const
bool
call
(
const
Fun
&
fun
,
any_tuple
&
value
)
const
{
fun
(
value
);
return
true
;
}
template
<
typename
Fun
>
bool
call_unsafe
(
Fun
const
&
fun
,
any_tuple
&
value
)
const
bool
call_unsafe
(
const
Fun
&
fun
,
any_tuple
&
value
)
const
{
fun
(
value
);
return
true
;
...
...
@@ -114,16 +114,16 @@ struct pattern_policy<map_to_option, Pattern>
Pattern
m_pattern
;
template
<
typename
...
Args
>
pattern_policy
(
Args
&&
...
args
)
:
m_pattern
(
std
::
forward
<
Args
>
(
args
)...)
{
}
bool
types_match
(
any_tuple
const
&
value
)
const
bool
types_match
(
const
any_tuple
&
value
)
const
{
return
matches_types
(
value
,
m_pattern
);
}
bool
could_invoke
(
any_tuple
const
&
value
)
const
bool
could_invoke
(
const
any_tuple
&
value
)
const
{
return
matches
(
value
,
m_pattern
);
}
template
<
typename
Fun
>
bool
call
(
Fun
const
&
fun
,
any_tuple
&
value
)
const
bool
call
(
const
Fun
&
fun
,
any_tuple
&
value
)
const
{
auto
result
=
moving_tuple_cast
(
value
,
m_pattern
);
if
(
result
)
...
...
@@ -134,7 +134,7 @@ struct pattern_policy<map_to_option, Pattern>
return
false
;
}
template
<
typename
Fun
>
bool
call_unsafe
(
Fun
const
&
fun
,
any_tuple
&
value
)
const
bool
call_unsafe
(
const
Fun
&
fun
,
any_tuple
&
value
)
const
{
auto
result
=
unsafe_tuple_cast
(
value
,
m_pattern
);
if
(
result
)
...
...
@@ -152,16 +152,16 @@ struct pattern_policy<map_to_bool, Pattern>
Pattern
m_pattern
;
template
<
typename
...
Args
>
pattern_policy
(
Args
&&
...
args
)
:
m_pattern
(
std
::
forward
<
Args
>
(
args
)...)
{
}
bool
types_match
(
any_tuple
const
&
value
)
const
bool
types_match
(
const
any_tuple
&
value
)
const
{
return
matches_types
(
value
,
m_pattern
);
}
bool
could_invoke
(
any_tuple
const
&
value
)
const
bool
could_invoke
(
const
any_tuple
&
value
)
const
{
return
matches
(
value
,
m_pattern
);
}
template
<
typename
Fun
>
bool
call
(
Fun
const
&
fun
,
any_tuple
&
value
)
const
bool
call
(
const
Fun
&
fun
,
any_tuple
&
value
)
const
{
if
(
could_invoke
(
value
))
{
...
...
@@ -171,7 +171,7 @@ struct pattern_policy<map_to_bool, Pattern>
return
false
;
}
template
<
typename
Fun
>
bool
call_unsafe
(
Fun
const
&
fun
,
any_tuple
&
value
)
const
bool
call_unsafe
(
const
Fun
&
fun
,
any_tuple
&
value
)
const
{
if
(
could_invoke
(
value
))
{
...
...
@@ -184,22 +184,22 @@ struct pattern_policy<map_to_bool, Pattern>
struct
dummy_policy
{
inline
bool
types_match
(
any_tuple
const
&
)
const
inline
bool
types_match
(
const
any_tuple
&
)
const
{
return
true
;
}
inline
bool
could_invoke
(
any_tuple
const
&
)
const
inline
bool
could_invoke
(
const
any_tuple
&
)
const
{
return
true
;
}
template
<
typename
Fun
>
inline
bool
call
(
Fun
const
&
fun
,
any_tuple
&
)
const
inline
bool
call
(
const
Fun
&
fun
,
any_tuple
&
)
const
{
fun
();
return
true
;
}
template
<
typename
Fun
>
inline
bool
call_unsafe
(
Fun
const
&
fun
,
any_tuple
&
)
const
inline
bool
call_unsafe
(
const
Fun
&
fun
,
any_tuple
&
)
const
{
fun
();
return
true
;
...
...
@@ -230,12 +230,12 @@ struct invokable_impl : public invokable
return
m_policy
.
call_unsafe
(
m_fun
,
value
);
}
bool
types_match
(
any_tuple
const
&
value
)
const
bool
types_match
(
const
any_tuple
&
value
)
const
{
return
m_policy
.
types_match
(
value
);
}
bool
could_invoke
(
any_tuple
const
&
value
)
const
bool
could_invoke
(
const
any_tuple
&
value
)
const
{
return
m_policy
.
could_invoke
(
value
);
}
...
...
cppa/detail/list_member.hpp
View file @
54f080df
...
...
@@ -41,7 +41,7 @@ struct list_member_util
{
typedef
typename
List
::
value_type
value_type
;
static
constexpr
primitive_type
vptype
=
type_to_ptype
<
value_type
>::
ptype
;
void
operator
()(
List
con
st
&
list
,
serializer
*
s
)
const
void
operator
()(
const
Li
st
&
list
,
serializer
*
s
)
const
{
s
->
begin_sequence
(
list
.
size
());
for
(
auto
i
=
list
.
begin
();
i
!=
list
.
end
();
++
i
)
...
...
@@ -73,7 +73,7 @@ struct list_member_util<List, false>
{
}
void
operator
()(
List
con
st
&
list
,
serializer
*
s
)
const
void
operator
()(
const
Li
st
&
list
,
serializer
*
s
)
const
{
s
->
begin_sequence
(
list
.
size
());
for
(
auto
i
=
list
.
begin
();
i
!=
list
.
end
();
++
i
)
...
...
cppa/detail/map_member.hpp
View file @
54f080df
...
...
@@ -53,7 +53,7 @@ struct map_member_util<T, false, true>
{
primitive_member
<
T
>
impl
;
void
serialize_value
(
T
const
&
what
,
serializer
*
s
)
const
void
serialize_value
(
const
T
&
what
,
serializer
*
s
)
const
{
impl
.
serialize
(
&
what
,
s
);
}
...
...
@@ -77,7 +77,7 @@ struct map_member_util<T, false, false>
{
}
void
serialize_value
(
T
const
&
what
,
serializer
*
s
)
const
void
serialize_value
(
const
T
&
what
,
serializer
*
s
)
const
{
m_type
->
serialize
(
&
what
,
s
);
}
...
...
@@ -103,7 +103,7 @@ struct map_member_util<T, true, false>
pair_member
<
first_type
,
second_type
>
impl
;
void
serialize_value
(
T
const
&
what
,
serializer
*
s
)
const
void
serialize_value
(
const
T
&
what
,
serializer
*
s
)
const
{
// impl needs a pair without const modifier
std
::
pair
<
first_type
,
second_type
>
p
(
what
.
first
,
what
.
second
);
...
...
@@ -139,7 +139,7 @@ class map_member : public util::abstract_uniform_type_info<Map>
{
auto
&
mp
=
*
reinterpret_cast
<
Map
const
*>
(
obj
);
s
->
begin_sequence
(
mp
.
size
());
for
(
auto
const
&
val
:
mp
)
for
(
const
auto
&
val
:
mp
)
{
m_helper
.
serialize_value
(
val
,
s
);
}
...
...
cppa/detail/matches.hpp
View file @
54f080df
...
...
@@ -44,7 +44,7 @@ struct matcher;
template
<
class
Tuple
,
typename
...
T
>
struct
matcher
<
wildcard_position
::
nil
,
Tuple
,
T
...
>
{
static
inline
bool
tmatch
(
Tuple
const
&
tup
)
static
inline
bool
tmatch
(
const
Tuple
&
tup
)
{
if
(
tup
.
impl_type
()
==
tuple_impl_info
::
statically_typed
)
{
...
...
@@ -62,7 +62,7 @@ struct matcher<wildcard_position::nil, Tuple, T...>
return
false
;
}
static
inline
bool
tmatch
(
Tuple
const
&
tup
,
static
inline
bool
tmatch
(
const
Tuple
&
tup
,
util
::
fixed_vector
<
size_t
,
sizeof
...(
T
)
>&
mv
)
{
if
(
tmatch
(
tup
))
...
...
@@ -74,7 +74,7 @@ struct matcher<wildcard_position::nil, Tuple, T...>
return
false
;
}
static
inline
bool
vmatch
(
Tuple
const
&
tup
,
pattern
<
T
...
>
const
&
ptrn
)
static
inline
bool
vmatch
(
const
Tuple
&
tup
,
const
pattern
<
T
...
>
&
ptrn
)
{
CPPA_REQUIRE
(
tup
.
size
()
==
sizeof
...(
T
));
return
ptrn
.
_matches_values
(
tup
);
...
...
@@ -86,7 +86,7 @@ struct matcher<wildcard_position::trailing, Tuple, T...>
{
static
constexpr
size_t
size
=
sizeof
...(
T
)
-
1
;
static
inline
bool
tmatch
(
Tuple
const
&
tup
)
static
inline
bool
tmatch
(
const
Tuple
&
tup
)
{
if
(
tup
.
size
()
>=
size
)
{
...
...
@@ -98,7 +98,7 @@ struct matcher<wildcard_position::trailing, Tuple, T...>
return
false
;
}
static
inline
bool
tmatch
(
Tuple
const
&
tup
,
static
inline
bool
tmatch
(
const
Tuple
&
tup
,
util
::
fixed_vector
<
size_t
,
size
>&
mv
)
{
if
(
tmatch
(
tup
))
...
...
@@ -110,7 +110,7 @@ struct matcher<wildcard_position::trailing, Tuple, T...>
return
false
;
}
static
inline
bool
vmatch
(
Tuple
const
&
tup
,
pattern
<
T
...
>
const
&
ptrn
)
static
inline
bool
vmatch
(
const
Tuple
&
tup
,
const
pattern
<
T
...
>
&
ptrn
)
{
return
ptrn
.
_matches_values
(
tup
);
}
...
...
@@ -119,15 +119,15 @@ struct matcher<wildcard_position::trailing, Tuple, T...>
template
<
class
Tuple
>
struct
matcher
<
wildcard_position
::
leading
,
Tuple
,
anything
>
{
static
inline
bool
tmatch
(
Tuple
const
&
)
static
inline
bool
tmatch
(
const
Tuple
&
)
{
return
true
;
}
static
inline
bool
tmatch
(
Tuple
const
&
,
util
::
fixed_vector
<
size_t
,
0
>&
)
static
inline
bool
tmatch
(
const
Tuple
&
,
util
::
fixed_vector
<
size_t
,
0
>&
)
{
return
true
;
}
static
inline
bool
vmatch
(
Tuple
const
&
,
pattern
<
anything
>
const
&
)
static
inline
bool
vmatch
(
const
Tuple
&
,
const
pattern
<
anything
>
&
)
{
return
true
;
}
...
...
@@ -138,7 +138,7 @@ struct matcher<wildcard_position::leading, Tuple, T...>
{
static
constexpr
size_t
size
=
sizeof
...(
T
)
-
1
;
static
inline
bool
tmatch
(
Tuple
const
&
tup
)
static
inline
bool
tmatch
(
const
Tuple
&
tup
)
{
auto
tup_size
=
tup
.
size
();
if
(
tup_size
>=
size
)
...
...
@@ -153,7 +153,7 @@ struct matcher<wildcard_position::leading, Tuple, T...>
return
false
;
}
static
inline
bool
tmatch
(
Tuple
const
&
tup
,
static
inline
bool
tmatch
(
const
Tuple
&
tup
,
util
::
fixed_vector
<
size_t
,
size
>&
mv
)
{
if
(
tmatch
(
tup
))
...
...
@@ -165,7 +165,7 @@ struct matcher<wildcard_position::leading, Tuple, T...>
return
false
;
}
static
inline
bool
vmatch
(
Tuple
const
&
tup
,
pattern
<
T
...
>
const
&
ptrn
)
static
inline
bool
vmatch
(
const
Tuple
&
tup
,
const
pattern
<
T
...
>
&
ptrn
)
{
return
ptrn
.
_matches_values
(
tup
);
}
...
...
@@ -184,7 +184,7 @@ struct matcher<wildcard_position::in_between, Tuple, T...>
&&
signed_wc_pos
!=
(
sizeof
...(
T
)
-
1
),
"illegal wildcard position"
);
static
inline
bool
tmatch
(
Tuple
const
&
tup
)
static
inline
bool
tmatch
(
const
Tuple
&
tup
)
{
auto
tup_size
=
tup
.
size
();
if
(
tup_size
>=
size
)
...
...
@@ -205,7 +205,7 @@ struct matcher<wildcard_position::in_between, Tuple, T...>
return
false
;
}
static
inline
bool
tmatch
(
Tuple
const
&
tup
,
static
inline
bool
tmatch
(
const
Tuple
&
tup
,
util
::
fixed_vector
<
size_t
,
size
-
1
>&
mv
)
{
if
(
tmatch
(
tup
))
...
...
@@ -222,7 +222,7 @@ struct matcher<wildcard_position::in_between, Tuple, T...>
return
false
;
}
static
inline
bool
vmatch
(
Tuple
const
&
tup
,
pattern
<
T
...
>
const
&
ptrn
)
static
inline
bool
vmatch
(
const
Tuple
&
tup
,
const
pattern
<
T
...
>
&
ptrn
)
{
return
ptrn
.
_matches_values
(
tup
);
}
...
...
@@ -281,12 +281,12 @@ struct matcher<wildcard_position::multiple, Tuple, T...>
return
true
;
// pbegin == pend && tbegin == tend
}
static
inline
bool
tmatch
(
Tuple
const
&
tup
)
static
inline
bool
tmatch
(
const
Tuple
&
tup
)
{
auto
&
tarr
=
static_types_array
<
T
...
>::
arr
;
if
(
tup
.
size
()
>=
(
sizeof
...(
T
)
-
wc_count
))
{
auto
fpush
=
[](
typename
Tuple
::
const_iterator
const
&
)
{
};
auto
fpush
=
[](
const
typename
Tuple
::
const_iterator
&
)
{
};
auto
fcommit
=
[]()
{
};
auto
frollback
=
[]()
{
};
return
match
(
tup
.
begin
(),
tup
.
end
(),
tarr
.
begin
(),
tarr
.
end
(),
...
...
@@ -296,13 +296,13 @@ struct matcher<wildcard_position::multiple, Tuple, T...>
}
template
<
class
MappingVector
>
static
inline
bool
tmatch
(
Tuple
const
&
tup
,
MappingVector
&
mv
)
static
inline
bool
tmatch
(
const
Tuple
&
tup
,
MappingVector
&
mv
)
{
auto
&
tarr
=
static_types_array
<
T
...
>::
arr
;
if
(
tup
.
size
()
>=
(
sizeof
...(
T
)
-
wc_count
))
{
size_t
commited_size
=
0
;
auto
fpush
=
[
&
](
typename
Tuple
::
const_iterator
const
&
iter
)
auto
fpush
=
[
&
](
const
typename
Tuple
::
const_iterator
&
iter
)
{
mv
.
push_back
(
iter
.
position
());
};
...
...
@@ -314,9 +314,9 @@ struct matcher<wildcard_position::multiple, Tuple, T...>
return
false
;
}
static
inline
bool
vmatch
(
Tuple
const
&
tup
,
pattern
<
T
...
>
const
&
ptrn
,
typename
pattern
<
T
...
>::
mapping_vector
const
&
mv
)
static
inline
bool
vmatch
(
const
Tuple
&
tup
,
const
pattern
<
T
...
>
&
ptrn
,
const
typename
pattern
<
T
...
>::
mapping_vector
&
mv
)
{
return
ptrn
.
_matches_values
(
tup
,
&
mv
);
}
...
...
@@ -326,28 +326,28 @@ struct matcher<wildcard_position::multiple, Tuple, T...>
template
<
wildcard_position
PC
,
class
Tuple
,
typename
...
Ts
>
struct
match_impl
{
static
inline
bool
_
(
Tuple
const
&
tup
)
static
inline
bool
_
(
const
Tuple
&
tup
)
{
return
matcher
<
PC
,
Tuple
,
Ts
...
>::
tmatch
(
tup
);
}
template
<
size_t
Size
>
static
inline
bool
_
(
Tuple
const
&
tup
,
static
inline
bool
_
(
const
Tuple
&
tup
,
util
::
fixed_vector
<
size_t
,
Size
>&
mv
)
{
return
matcher
<
PC
,
Tuple
,
Ts
...
>::
tmatch
(
tup
,
mv
);
}
static
inline
bool
_
(
Tuple
const
&
tup
,
pattern
<
Ts
...
>
const
&
p
)
static
inline
bool
_
(
const
Tuple
&
tup
,
const
pattern
<
Ts
...
>
&
p
)
{
return
matcher
<
PC
,
Tuple
,
Ts
...
>::
tmatch
(
tup
)
&&
(
p
.
has_values
()
==
false
||
matcher
<
PC
,
Tuple
,
Ts
...
>::
vmatch
(
tup
,
p
));
}
static
inline
bool
_
(
Tuple
const
&
tup
,
pattern
<
Ts
...
>
const
&
p
,
static
inline
bool
_
(
const
Tuple
&
tup
,
const
pattern
<
Ts
...
>
&
p
,
typename
pattern
<
Ts
...
>::
mapping_vector
&
mv
)
{
return
matcher
<
PC
,
Tuple
,
Ts
...
>::
tmatch
(
tup
,
mv
)
...
...
@@ -362,19 +362,19 @@ struct match_impl<wildcard_position::multiple, Tuple, Ts...>
{
static
constexpr
auto
PC
=
wildcard_position
::
multiple
;
static
inline
bool
_
(
Tuple
const
&
tup
)
static
inline
bool
_
(
const
Tuple
&
tup
)
{
return
matcher
<
PC
,
Tuple
,
Ts
...
>::
tmatch
(
tup
);
}
template
<
size_t
Size
>
static
inline
bool
_
(
Tuple
const
&
tup
,
static
inline
bool
_
(
const
Tuple
&
tup
,
util
::
fixed_vector
<
size_t
,
Size
>&
mv
)
{
return
matcher
<
PC
,
Tuple
,
Ts
...
>::
tmatch
(
tup
,
mv
);
}
static
inline
bool
_
(
Tuple
const
&
tup
,
pattern
<
Ts
...
>
const
&
p
)
static
inline
bool
_
(
const
Tuple
&
tup
,
const
pattern
<
Ts
...
>
&
p
)
{
if
(
p
.
has_values
())
{
...
...
@@ -385,7 +385,7 @@ struct match_impl<wildcard_position::multiple, Tuple, Ts...>
return
matcher
<
PC
,
Tuple
,
Ts
...
>::
tmatch
(
tup
);
}
static
inline
bool
_
(
Tuple
const
&
tup
,
pattern
<
Ts
...
>
const
&
p
,
static
inline
bool
_
(
const
Tuple
&
tup
,
const
pattern
<
Ts
...
>
&
p
,
typename
pattern
<
Ts
...
>::
mapping_vector
&
mv
)
{
if
(
p
.
has_values
())
...
...
@@ -414,7 +414,7 @@ struct match_impl_from_type_list<Tuple, util::type_list<Ts...> >
* @brief Returns true if this tuple matches the pattern <tt>{Ts...}</tt>.
*/
template
<
typename
...
Ts
>
bool
matches
(
any_tuple
const
&
tup
)
bool
matches
(
const
any_tuple
&
tup
)
{
typedef
util
::
type_list
<
Ts
...
>
tl
;
return
match_impl
<
get_wildcard_position
<
tl
>
(),
any_tuple
,
Ts
...
>
...
...
@@ -425,7 +425,7 @@ bool matches(any_tuple const& tup)
* @brief Returns true if this tuple matches the pattern <tt>{Ts...}</tt>.
*/
template
<
typename
...
Ts
>
bool
matches
(
any_tuple
const
&
tup
,
bool
matches
(
const
any_tuple
&
tup
,
util
::
fixed_vector
<
size_t
,
util
::
tl_count_not
<
...
...
@@ -441,7 +441,7 @@ bool matches(any_tuple const& tup,
* @brief Returns true if this tuple matches @p pn.
*/
template
<
typename
...
Ts
>
bool
matches
(
any_tuple
const
&
tup
,
pattern
<
Ts
...
>
const
&
pn
)
bool
matches
(
const
any_tuple
&
tup
,
const
pattern
<
Ts
...
>
&
pn
)
{
typedef
util
::
type_list
<
Ts
...
>
tl
;
return
match_impl
<
get_wildcard_position
<
tl
>
(),
any_tuple
,
Ts
...
>
...
...
@@ -452,7 +452,7 @@ bool matches(any_tuple const& tup, pattern<Ts...> const& pn)
* @brief Returns true if this tuple matches @p pn.
*/
template
<
typename
...
Ts
>
bool
matches
(
any_tuple
const
&
tup
,
pattern
<
Ts
...
>
const
&
pn
,
bool
matches
(
const
any_tuple
&
tup
,
const
pattern
<
Ts
...
>
&
pn
,
typename
pattern
<
Ts
...
>::
mapping_vector
&
mv
)
{
typedef
util
::
type_list
<
Ts
...
>
tl
;
...
...
@@ -462,13 +462,13 @@ bool matches(any_tuple const& tup, pattern<Ts...> const& pn,
// support for type_list based matching
template
<
typename
...
Ts
>
inline
bool
matches
(
any_tuple
const
&
tup
,
util
::
type_list
<
Ts
...
>
const
&
)
inline
bool
matches
(
const
any_tuple
&
tup
,
const
util
::
type_list
<
Ts
...
>
&
)
{
return
matches
<
Ts
...
>
(
tup
);
}
template
<
typename
...
Ts
>
inline
bool
matches
(
any_tuple
const
&
tup
,
util
::
type_list
<
Ts
...
>
const
&
,
inline
bool
matches
(
const
any_tuple
&
tup
,
const
util
::
type_list
<
Ts
...
>
&
,
util
::
fixed_vector
<
size_t
,
util
::
tl_count_not
<
...
...
@@ -483,13 +483,13 @@ inline bool matches(any_tuple const& tup, util::type_list<Ts...> const&,
* (does not match for values).
*/
template
<
typename
...
Ts
>
inline
bool
matches_types
(
any_tuple
const
&
tup
,
pattern
<
Ts
...
>
const
&
)
inline
bool
matches_types
(
const
any_tuple
&
tup
,
const
pattern
<
Ts
...
>
&
)
{
return
matches
<
Ts
...
>
(
tup
);
}
template
<
typename
...
Ts
>
inline
bool
matches_types
(
any_tuple
const
&
tup
,
util
::
type_list
<
Ts
...
>
const
&
)
inline
bool
matches_types
(
const
any_tuple
&
tup
,
const
util
::
type_list
<
Ts
...
>
&
)
{
return
matches
<
Ts
...
>
(
tup
);
}
...
...
cppa/detail/object_array.hpp
View file @
54f080df
...
...
@@ -50,11 +50,11 @@ class object_array : public abstract_tuple
object_array
();
object_array
(
object_array
&&
)
=
default
;
object_array
(
object_array
const
&
)
=
default
;
object_array
(
const
object_array
&
)
=
default
;
void
push_back
(
object
&&
what
);
void
push_back
(
object
cons
t
&
what
);
void
push_back
(
const
objec
t
&
what
);
void
*
mutable_at
(
size_t
pos
);
...
...
@@ -64,7 +64,7 @@ class object_array : public abstract_tuple
void
const
*
at
(
size_t
pos
)
const
;
bool
equals
(
c
ppa
::
detail
::
abstract_tuple
const
&
)
const
;
bool
equals
(
c
onst
cppa
::
detail
::
abstract_tuple
&
)
const
;
uniform_type_info
const
*
type_at
(
size_t
pos
)
const
;
...
...
cppa/detail/object_impl.hpp
View file @
54f080df
...
...
@@ -36,7 +36,7 @@
namespace
cppa
{
template
<
typename
T
>
utype
const
&
uniform_type_info
();
const
utype
&
uniform_type_info
();
}
...
...
@@ -47,9 +47,9 @@ struct obj_impl : object
{
T
m_value
;
obj_impl
()
:
m_value
()
{
}
obj_impl
(
T
const
&
v
)
:
m_value
(
v
)
{
}
obj_impl
(
const
T
&
v
)
:
m_value
(
v
)
{
}
virtual
object
*
copy
()
const
{
return
new
obj_impl
(
m_value
);
}
virtual
utype
const
&
type
()
const
{
return
uniform_type_info
<
T
>
();
}
virtual
const
utype
&
type
()
const
{
return
uniform_type_info
<
T
>
();
}
virtual
void
*
mutable_value
()
{
return
&
m_value
;
}
virtual
void
const
*
value
()
const
{
return
&
m_value
;
}
virtual
void
serialize
(
serializer
&
s
)
const
...
...
cppa/detail/post_office.hpp
View file @
54f080df
...
...
@@ -49,10 +49,10 @@ struct po_message
void
post_office_loop
(
int
input_fd
);
void
post_office_add_peer
(
native_socket_type
peer_socket
,
process_information_ptr
const
&
peer_ptr
);
const
process_information_ptr
&
peer_ptr
);
void
post_office_publish
(
native_socket_type
server_socket
,
actor_ptr
const
&
published_actor
);
const
actor_ptr
&
published_actor
);
void
post_office_unpublish
(
actor_id
whom
);
...
...
cppa/detail/post_office_msg.hpp
0 → 100644
View file @
54f080df
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, 2012 *
* Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#ifndef POST_OFFICE_MSG_HPP
#define POST_OFFICE_MSG_HPP
#include "cppa/attachable.hpp"
#include "cppa/actor_proxy.hpp"
#include "cppa/intrusive_ptr.hpp"
#include "cppa/process_information.hpp"
#include "cppa/detail/native_socket.hpp"
#include "cppa/intrusive/single_reader_queue.hpp"
namespace
cppa
{
namespace
detail
{
class
post_office_msg
{
friend
class
intrusive
::
singly_linked_list
<
post_office_msg
>
;
friend
class
intrusive
::
single_reader_queue
<
post_office_msg
>
;
public:
enum
msg_type
{
invalid_type
,
add_peer_type
,
add_server_socket_type
,
proxy_exited_type
};
struct
add_peer
{
native_socket_type
sockfd
;
process_information_ptr
peer
;
actor_proxy_ptr
first_peer_actor
;
std
::
unique_ptr
<
attachable
>
attachable_ptr
;
add_peer
(
native_socket_type
peer_socket
,
const
process_information_ptr
&
peer_ptr
,
const
actor_proxy_ptr
&
peer_actor_ptr
,
std
::
unique_ptr
<
attachable
>&&
peer_observer
);
};
struct
add_server_socket
{
native_socket_type
server_sockfd
;
actor_ptr
published_actor
;
add_server_socket
(
native_socket_type
ssockfd
,
const
actor_ptr
&
whom
);
};
struct
proxy_exited
{
actor_proxy_ptr
proxy_ptr
;
inline
proxy_exited
(
const
actor_proxy_ptr
&
who
)
:
proxy_ptr
(
who
)
{
}
};
inline
post_office_msg
()
:
next
(
nullptr
),
m_type
(
invalid_type
)
{
}
post_office_msg
(
native_socket_type
arg0
,
const
process_information_ptr
&
arg1
,
const
actor_proxy_ptr
&
arg2
,
std
::
unique_ptr
<
attachable
>&&
arg3
);
post_office_msg
(
native_socket_type
arg0
,
const
actor_ptr
&
arg1
);
post_office_msg
(
const
actor_proxy_ptr
&
proxy_ptr
);
inline
bool
is_add_peer_msg
()
const
{
return
m_type
==
add_peer_type
;
}
inline
bool
is_add_server_socket_msg
()
const
{
return
m_type
==
add_server_socket_type
;
}
inline
bool
is_proxy_exited_msg
()
const
{
return
m_type
==
proxy_exited_type
;
}
inline
add_peer
&
as_add_peer_msg
()
{
return
m_add_peer_msg
;
}
inline
add_server_socket
&
as_add_server_socket_msg
()
{
return
m_add_server_socket
;
}
inline
proxy_exited
&
as_proxy_exited_msg
()
{
return
m_proxy_exited
;
}
~
post_office_msg
();
private:
post_office_msg
*
next
;
msg_type
m_type
;
union
{
add_peer
m_add_peer_msg
;
add_server_socket
m_add_server_socket
;
proxy_exited
m_proxy_exited
;
};
};
constexpr
std
::
uint32_t
rd_queue_event
=
0x00
;
constexpr
std
::
uint32_t
unpublish_actor_event
=
0x01
;
constexpr
std
::
uint32_t
close_socket_event
=
0x02
;
constexpr
std
::
uint32_t
shutdown_event
=
0x03
;
typedef
std
::
uint32_t
pipe_msg
[
2
];
constexpr
size_t
pipe_msg_size
=
2
*
sizeof
(
std
::
uint32_t
);
}
}
// namespace cppa::detail
#endif // POST_OFFICE_MSG_HPP
cppa/detail/projection.hpp
View file @
54f080df
...
...
@@ -47,8 +47,8 @@ namespace cppa { namespace detail {
template
<
class
PartialFun
>
struct
projection_helper
{
PartialFun
const
&
fun
;
projection_helper
(
PartialFun
const
&
pfun
)
:
fun
(
pfun
)
{
}
const
PartialFun
&
fun
;
projection_helper
(
const
PartialFun
&
pfun
)
:
fun
(
pfun
)
{
}
template
<
typename
...
Args
>
bool
operator
()(
Args
&&
...
args
)
const
{
...
...
@@ -76,9 +76,9 @@ class projection
projection
(
fun_container
&&
args
)
:
m_funs
(
std
::
move
(
args
))
{
}
projection
(
fun_container
const
&
args
)
:
m_funs
(
args
)
{
}
projection
(
const
fun_container
&
args
)
:
m_funs
(
args
)
{
}
projection
(
projection
const
&
)
=
default
;
projection
(
const
projection
&
)
=
default
;
/**
* @brief Invokes @p fun with a projection of <tt>args...</tt>.
...
...
@@ -130,24 +130,24 @@ class projection
}
template
<
class
Storage
,
typename
Fun
,
typename
T
>
static
inline
bool
fetch
(
Storage
&
storage
,
Fun
const
&
fun
,
T
&&
arg
)
static
inline
bool
fetch
(
Storage
&
storage
,
const
Fun
&
fun
,
T
&&
arg
)
{
return
fetch_
(
storage
,
fun
(
std
::
forward
<
T
>
(
arg
)));
}
template
<
typename
Storage
,
typename
T
>
static
inline
bool
fetch
(
Storage
&
storage
,
util
::
void_type
const
&
,
T
&&
arg
)
static
inline
bool
fetch
(
Storage
&
storage
,
const
util
::
void_type
&
,
T
&&
arg
)
{
return
fetch_
(
storage
,
std
::
forward
<
T
>
(
arg
));
}
static
inline
bool
collect
(
tdata
<>&
,
tdata
<>
const
&
)
static
inline
bool
collect
(
tdata
<>&
,
const
tdata
<>
&
)
{
return
true
;
}
template
<
class
TData
,
class
Trans
,
typename
T0
,
typename
...
Ts
>
static
inline
bool
collect
(
TData
&
td
,
Trans
const
&
tr
,
static
inline
bool
collect
(
TData
&
td
,
const
Trans
&
tr
,
T0
&&
arg0
,
Ts
&&
...
args
)
{
return
fetch
(
td
.
head
,
tr
.
head
,
std
::
forward
<
T0
>
(
arg0
))
...
...
@@ -165,8 +165,8 @@ class projection<util::type_list<> >
public:
projection
()
=
default
;
projection
(
tdata
<>
const
&
)
{
}
projection
(
projection
const
&
)
=
default
;
projection
(
const
tdata
<>
&
)
{
}
projection
(
const
projection
&
)
=
default
;
template
<
class
PartialFun
>
bool
operator
()(
PartialFun
&
fun
)
const
...
...
cppa/detail/pseudo_tuple.hpp
View file @
54f080df
...
...
@@ -73,7 +73,7 @@ struct pseudo_tuple_from_type_list<util::type_list<Ts...> >
namespace
cppa
{
template
<
size_t
N
,
typename
...
Tn
>
typename
util
::
at
<
N
,
Tn
...
>::
type
const
&
get
(
detail
::
pseudo_tuple
<
Tn
...
>
const
&
tv
)
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
const
detail
::
pseudo_tuple
<
Tn
...
>
&
tv
)
{
static_assert
(
N
<
sizeof
...(
Tn
),
"N >= tv.size()"
);
return
*
reinterpret_cast
<
typename
util
::
at
<
N
,
Tn
...
>::
type
const
*>
(
tv
.
at
(
N
));
...
...
cppa/detail/receive_loop_helper.hpp
View file @
54f080df
...
...
@@ -86,7 +86,7 @@ class receive_for_helper
public:
receive_for_helper
(
T
&
first
,
T
const
&
last
)
:
begin
(
first
),
end
(
last
)
{
}
receive_for_helper
(
T
&
first
,
const
T
&
last
)
:
begin
(
first
),
end
(
last
)
{
}
void
operator
()(
behavior
&
bhvr
)
{
...
...
cppa/detail/ref_counted_impl.hpp
View file @
54f080df
...
...
@@ -39,9 +39,9 @@ class ref_counted_impl
T
m_rc
;
ref_counted_impl
(
ref_counted_impl
const
&
)
=
delete
;
ref_counted_impl
(
const
ref_counted_impl
&
)
=
delete
;
ref_counted_impl
&
operator
=
(
ref_counted_impl
const
&
)
=
delete
;
ref_counted_impl
&
operator
=
(
const
ref_counted_impl
&
)
=
delete
;
public:
...
...
cppa/detail/tdata.hpp
View file @
54f080df
...
...
@@ -51,7 +51,7 @@
namespace
cppa
{
class
uniform_type_info
;
uniform_type_info
const
*
uniform_typeid
(
std
::
type_info
const
&
);
uniform_type_info
const
*
uniform_typeid
(
const
std
::
type_info
&
);
}
// namespace cppa
namespace
cppa
{
namespace
detail
{
...
...
@@ -60,7 +60,7 @@ template<typename T>
inline
void
*
ptr_to
(
T
&
what
)
{
return
&
what
;
}
template
<
typename
T
>
inline
void
const
*
ptr_to
(
T
const
&
what
)
{
return
&
what
;
}
inline
void
const
*
ptr_to
(
const
T
&
what
)
{
return
&
what
;
}
template
<
typename
T
>
inline
void
*
ptr_to
(
T
*
what
)
{
return
what
;
}
...
...
@@ -69,25 +69,25 @@ template<typename T>
inline
void
const
*
ptr_to
(
T
const
*
what
)
{
return
what
;
}
template
<
typename
T
>
inline
void
*
ptr_to
(
std
::
reference_wrapper
<
T
>
const
&
what
)
inline
void
*
ptr_to
(
const
std
::
reference_wrapper
<
T
>
&
what
)
{
return
&
(
what
.
get
());
}
template
<
typename
T
>
inline
void
const
*
ptr_to
(
std
::
reference_wrapper
<
const
T
>
const
&
what
)
inline
void
const
*
ptr_to
(
const
std
::
reference_wrapper
<
const
T
>
&
what
)
{
return
&
(
what
.
get
());
}
template
<
typename
T
>
inline
uniform_type_info
const
*
utype_of
(
T
const
&
)
inline
uniform_type_info
const
*
utype_of
(
const
T
&
)
{
return
static_types_array
<
T
>::
arr
[
0
];
}
template
<
typename
T
>
inline
uniform_type_info
const
*
utype_of
(
std
::
reference_wrapper
<
T
>
const
&
)
inline
uniform_type_info
const
*
utype_of
(
const
std
::
reference_wrapper
<
T
>
&
)
{
return
static_types_array
<
typename
util
::
rm_ref
<
T
>::
type
>::
arr
[
0
];
}
...
...
@@ -167,9 +167,9 @@ struct tdata<>
tdata
<>&
tail
()
{
return
*
this
;
}
tdata
<>
const
&
tail
()
const
{
return
*
this
;
}
const
tdata
<>
&
tail
()
const
{
return
*
this
;
}
tdata
<>
const
&
ctail
()
const
{
return
*
this
;
}
const
tdata
<>
&
ctail
()
const
{
return
*
this
;
}
inline
void
const
*
at
(
size_t
)
const
{
...
...
@@ -188,7 +188,7 @@ struct tdata<>
inline
void
set
()
{
}
inline
bool
operator
==
(
tdata
const
&
)
const
{
return
true
;
}
inline
bool
operator
==
(
const
tdata
&
)
const
{
return
true
;
}
inline
tuple_impl_info
impl_type
()
const
{
...
...
@@ -200,7 +200,7 @@ struct tdata<>
template
<
bool
IsBoxed
,
bool
IsFunction
,
typename
Head
,
typename
T
>
struct
td_filter_
{
static
inline
T
const
&
_
(
T
const
&
arg
)
{
return
arg
;
}
static
inline
const
T
&
_
(
const
T
&
arg
)
{
return
arg
;
}
static
inline
T
&&
_
(
T
&&
arg
)
{
return
std
::
move
(
arg
);
}
static
inline
T
&
_
(
T
&
arg
)
{
return
arg
;
}
};
...
...
@@ -214,7 +214,7 @@ struct td_filter_<false, true, Head, T>
template
<
typename
Head
,
typename
T
>
struct
td_filter_
<
true
,
false
,
Head
,
T
>
{
static
inline
Head
_
(
T
const
&
)
{
return
Head
{};
}
static
inline
Head
_
(
const
T
&
)
{
return
Head
{};
}
};
template
<
typename
Head
,
typename
T
>
...
...
@@ -241,7 +241,7 @@ auto td_filter(T&& arg)
}
template
<
typename
...
X
,
typename
...
Y
>
void
tdata_set
(
tdata
<
X
...
>&
rhs
,
tdata
<
Y
...
>
const
&
lhs
);
void
tdata_set
(
tdata
<
X
...
>&
rhs
,
const
tdata
<
Y
...
>
&
lhs
);
template
<
typename
Head
,
typename
...
Tail
>
struct
tdata
<
Head
,
Tail
...
>
:
tdata
<
Tail
...
>
...
...
@@ -270,7 +270,7 @@ struct tdata<Head, Tail...> : tdata<Tail...>
inline
tdata
()
:
super
(),
head
()
{
}
//tdata(
Head const& v0, Tail const
&... vals) : super(vals...), head(v0) { }
//tdata(
const Head& v0, const Tail
&... vals) : super(vals...), head(v0) { }
tdata
(
Head
arg
)
:
super
(),
head
(
std
::
move
(
arg
))
{
}
...
...
@@ -281,7 +281,7 @@ struct tdata<Head, Tail...> : tdata<Tail...>
{
}
tdata
(
tdata
const
&
)
=
default
;
tdata
(
const
tdata
&
)
=
default
;
tdata
(
tdata
&&
other
)
:
super
(
std
::
move
(
other
.
tail
())),
head
(
std
::
move
(
other
.
head
))
...
...
@@ -296,7 +296,7 @@ struct tdata<Head, Tail...> : tdata<Tail...>
}
template
<
typename
...
Y
>
tdata
(
tdata
<
Y
...
>
const
&
other
)
:
super
(
other
.
tail
()),
head
(
other
.
head
)
tdata
(
const
tdata
<
Y
...
>
&
other
)
:
super
(
other
.
tail
()),
head
(
other
.
head
)
{
}
...
...
@@ -307,7 +307,7 @@ struct tdata<Head, Tail...> : tdata<Tail...>
}
template
<
typename
...
Y
>
tdata
&
operator
=
(
tdata
<
Y
...
>
const
&
other
)
tdata
&
operator
=
(
const
tdata
<
Y
...
>
&
other
)
{
tdata_set
(
*
this
,
other
);
return
*
this
;
...
...
@@ -334,9 +334,9 @@ struct tdata<Head, Tail...> : tdata<Tail...>
// upcast
inline
tdata
<
Tail
...
>&
tail
()
{
return
*
this
;
}
inline
tdata
<
Tail
...
>
const
&
tail
()
const
{
return
*
this
;
}
inline
const
tdata
<
Tail
...
>
&
tail
()
const
{
return
*
this
;
}
inline
tdata
<
Tail
...
>
const
&
ctail
()
const
{
return
*
this
;
}
inline
const
tdata
<
Tail
...
>
&
ctail
()
const
{
return
*
this
;
}
inline
void
const
*
at
(
size_t
p
)
const
{
...
...
@@ -395,19 +395,19 @@ struct tdata<Head, Tail...> : tdata<Tail...>
return
_back
(
token
);
}
Head
const
&
_back
(
std
::
integral_constant
<
size_t
,
0
>
)
const
const
Head
&
_back
(
std
::
integral_constant
<
size_t
,
0
>
)
const
{
return
head
;
}
template
<
size_t
Pos
>
back_type
const
&
_back
(
std
::
integral_constant
<
size_t
,
Pos
>
)
const
const
back_type
&
_back
(
std
::
integral_constant
<
size_t
,
Pos
>
)
const
{
std
::
integral_constant
<
size_t
,
Pos
-
1
>
token
;
return
super
::
_back
(
token
);
}
back_type
const
&
back
()
const
const
back_type
&
back
()
const
{
std
::
integral_constant
<
size_t
,
sizeof
...(
Tail
)
>
token
;
return
_back
(
token
);
...
...
@@ -415,10 +415,10 @@ struct tdata<Head, Tail...> : tdata<Tail...>
};
template
<
typename
...
X
>
void
tdata_set
(
tdata
<
X
...
>&
,
tdata
<>
const
&
)
{
}
void
tdata_set
(
tdata
<
X
...
>&
,
const
tdata
<>
&
)
{
}
template
<
typename
Head
,
typename
...
X
,
typename
...
Y
>
void
tdata_set
(
tdata
<
Head
,
X
...
>&
lhs
,
tdata
<
Head
,
Y
...
>
const
&
rhs
)
void
tdata_set
(
tdata
<
Head
,
X
...
>&
lhs
,
tdata
<
Head
,
const
Y
...
>
&
rhs
)
{
lhs
.
head
=
rhs
.
head
;
tdata_set
(
lhs
.
tail
(),
rhs
.
tail
());
...
...
@@ -452,13 +452,13 @@ template<typename... T>
inline
void
collect_tdata
(
tdata
<
T
...
>&
)
{
}
template
<
typename
Storage
,
typename
...
Args
>
void
collect_tdata
(
Storage
&
storage
,
tdata
<>
const
&
,
Args
const
&
...
args
)
void
collect_tdata
(
Storage
&
storage
,
const
tdata
<>&
,
const
Args
&
...
args
)
{
collect_tdata
(
storage
,
args
...);
}
template
<
typename
Storage
,
typename
Arg0
,
typename
...
Args
>
void
collect_tdata
(
Storage
&
storage
,
Arg0
const
&
arg0
,
Args
const
&
...
args
)
void
collect_tdata
(
Storage
&
storage
,
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
storage
.
head
=
arg0
.
head
;
collect_tdata
(
storage
.
tail
(),
arg0
.
tail
(),
args
...);
...
...
@@ -476,17 +476,17 @@ mk_tdata(Args&&... args)
}
template
<
size_t
N
,
typename
...
Tn
>
typename
util
::
at
<
N
,
Tn
...
>::
type
const
&
get
(
detail
::
tdata
<
Tn
...
>
const
&
tv
)
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
const
detail
::
tdata
<
Tn
...
>
&
tv
)
{
static_assert
(
N
<
sizeof
...(
Tn
),
"N >= tv.size()"
);
return
static_cast
<
typename
detail
::
tdata_upcast_helper
<
N
,
Tn
...
>::
type
const
&>
(
tv
).
head
;
return
static_cast
<
const
typename
detail
::
tdata_upcast_helper
<
N
,
Tn
...
>::
type
&>
(
tv
).
head
;
}
template
<
size_t
N
,
typename
...
Tn
>
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get_ref
(
detail
::
tdata
<
Tn
...
>&
tv
)
{
static_assert
(
N
<
sizeof
...(
Tn
),
"N >= tv.size()"
);
return
static_cast
<
typename
detail
::
tdata_upcast_helper
<
N
,
Tn
...
>::
type
&>
(
tv
).
head
;
return
static_cast
<
typename
detail
::
tdata_upcast_helper
<
N
,
Tn
...
>::
type
&>
(
tv
).
head
;
}
}
// namespace cppa
...
...
cppa/detail/thread.hpp
View file @
54f080df
...
...
@@ -48,7 +48,7 @@ namespace this_thread { using namespace boost::this_thread; }
template
<
class
Lock
,
class
Condition
>
inline
bool
wait_until
(
Lock
&
lock
,
Condition
&
cond
,
boost
::
system_time
const
&
timeout
)
const
boost
::
system_time
&
timeout
)
{
return
cond
.
timed_wait
(
lock
,
timeout
);
}
...
...
@@ -61,7 +61,7 @@ inline boost::system_time now()
}
}
// namespace cppa::detail
inline
boost
::
system_time
&
operator
+=
(
boost
::
system_time
&
lhs
,
c
ppa
::
util
::
duration
const
&
rhs
)
c
onst
cppa
::
util
::
duration
&
rhs
)
{
switch
(
rhs
.
unit
)
{
...
...
@@ -100,7 +100,7 @@ namespace this_thread { using namespace std::this_thread; }
// returns false if a timeout occured
template
<
class
Lock
,
class
Condition
,
typename
TimePoint
>
inline
bool
wait_until
(
Lock
&
lock
,
Condition
&
cond
,
TimePoint
cons
t
&
timeout
)
inline
bool
wait_until
(
Lock
&
lock
,
Condition
&
cond
,
const
TimePoin
t
&
timeout
)
{
return
cond
.
wait_until
(
lock
,
timeout
)
!=
std
::
cv_status
::
timeout
;
}
...
...
cppa/detail/to_uniform_name.hpp
View file @
54f080df
...
...
@@ -36,8 +36,8 @@
namespace
cppa
{
namespace
detail
{
std
::
string
to_uniform_name
(
std
::
string
const
&
demangled_name
);
std
::
string
to_uniform_name
(
std
::
type_info
const
&
tinfo
);
std
::
string
to_uniform_name
(
const
std
::
string
&
demangled_name
);
std
::
string
to_uniform_name
(
const
std
::
type_info
&
tinfo
);
}
}
// namespace cppa::detail
...
...
cppa/detail/tuple_cast_impl.hpp
View file @
54f080df
...
...
@@ -69,14 +69,14 @@ struct tuple_cast_impl
mv
)};
return
{};
}
static
inline
option
<
Result
>
safe
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
p
)
static
inline
option
<
Result
>
safe
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
p
)
{
mapping_vector
mv
;
if
(
matches
(
tup
,
p
,
mv
))
return
{
Result
::
from
(
std
::
move
(
tup
.
vals
()),
mv
)};
return
{};
}
static
inline
option
<
Result
>
unsafe
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
p
)
static
inline
option
<
Result
>
unsafe
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
p
)
{
mapping_vector
mv
;
if
(
WP
==
wildcard_position
::
in_between
)
...
...
@@ -100,7 +100,7 @@ struct tuple_cast_impl
}
return
{};
}
static
inline
Result
force
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
p
)
static
inline
Result
force
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
p
)
{
mapping_vector
mv
;
if
(
WP
==
wildcard_position
::
in_between
)
...
...
@@ -130,7 +130,7 @@ struct tuple_cast_impl<wildcard_position::nil, Result, T...>
if
(
matches
<
T
...
>
(
tup
))
return
{
Result
::
from
(
std
::
move
(
tup
.
vals
()))};
return
{};
}
static
inline
option
<
Result
>
safe
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
p
)
static
inline
option
<
Result
>
safe
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
p
)
{
if
(
matches
(
tup
,
p
))
{
...
...
@@ -138,7 +138,7 @@ struct tuple_cast_impl<wildcard_position::nil, Result, T...>
}
return
{};
}
static
inline
option
<
Result
>
unsafe
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
p
)
static
inline
option
<
Result
>
unsafe
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
p
)
{
if
(
p
.
has_values
()
==
false
||
matcher
<
wildcard_position
::
nil
,
any_tuple
,
T
...
>::
vmatch
(
tup
,
p
))
...
...
@@ -147,7 +147,7 @@ struct tuple_cast_impl<wildcard_position::nil, Result, T...>
}
return
{};
}
static
inline
Result
force
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
)
static
inline
Result
force
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
)
{
return
{
Result
::
from
(
std
::
move
(
tup
.
vals
()))};
}
...
...
@@ -157,7 +157,7 @@ template<class Result, typename... T>
struct
tuple_cast_impl
<
wildcard_position
::
trailing
,
Result
,
T
...
>
:
tuple_cast_impl
<
wildcard_position
::
nil
,
Result
,
T
...
>
{
static
inline
option
<
Result
>
unsafe
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
p
)
static
inline
option
<
Result
>
unsafe
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
p
)
{
if
(
p
.
has_values
()
==
false
||
matcher
<
wildcard_position
::
trailing
,
any_tuple
,
T
...
>
...
...
@@ -167,7 +167,7 @@ struct tuple_cast_impl<wildcard_position::trailing, Result, T...>
}
return
{};
}
static
inline
Result
force
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
)
static
inline
Result
force
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
)
{
return
{
Result
::
from
(
std
::
move
(
tup
.
vals
()))};
}
...
...
@@ -182,13 +182,13 @@ struct tuple_cast_impl<wildcard_position::leading, Result, T...>
if
(
matches
<
T
...
>
(
tup
))
return
{
Result
::
offset_subtuple
(
tup
.
vals
(),
o
)};
return
{};
}
static
inline
option
<
Result
>
safe
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
p
)
static
inline
option
<
Result
>
safe
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
p
)
{
size_t
o
=
tup
.
size
()
-
(
sizeof
...(
T
)
-
1
);
if
(
matches
(
tup
,
p
))
return
{
Result
::
offset_subtuple
(
tup
.
vals
(),
o
)};
return
{};
}
static
inline
option
<
Result
>
unsafe
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
p
)
static
inline
option
<
Result
>
unsafe
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
p
)
{
if
(
p
.
has_values
()
==
false
||
matcher
<
wildcard_position
::
leading
,
any_tuple
,
T
...
>
...
...
@@ -199,7 +199,7 @@ struct tuple_cast_impl<wildcard_position::leading, Result, T...>
}
return
{};
}
static
inline
Result
force
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
)
static
inline
Result
force
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
)
{
size_t
o
=
tup
.
size
()
-
(
sizeof
...(
T
)
-
1
);
return
Result
::
offset_subtuple
(
tup
.
vals
(),
o
);
...
...
cppa/detail/tuple_iterator.hpp
View file @
54f080df
...
...
@@ -51,17 +51,17 @@ class tuple_iterator
{
}
tuple_iterator
(
tuple_iterator
const
&
)
=
default
;
tuple_iterator
(
const
tuple_iterator
&
)
=
default
;
tuple_iterator
&
operator
=
(
tuple_iterator
const
&
)
=
default
;
tuple_iterator
&
operator
=
(
const
tuple_iterator
&
)
=
default
;
inline
bool
operator
==
(
tuple_iterator
const
&
other
)
const
inline
bool
operator
==
(
const
tuple_iterator
&
other
)
const
{
CPPA_REQUIRE
(
other
.
m_tuple
==
other
.
m_tuple
);
return
other
.
m_pos
==
m_pos
;
}
inline
bool
operator
!=
(
tuple_iterator
const
&
other
)
const
inline
bool
operator
!=
(
const
tuple_iterator
&
other
)
const
{
return
!
(
*
this
==
other
);
}
...
...
cppa/detail/tuple_vals.hpp
View file @
54f080df
...
...
@@ -61,9 +61,9 @@ class tuple_vals : public abstract_tuple
tuple_vals
()
:
super
(
tuple_impl_info
::
statically_typed
),
m_data
()
{
}
tuple_vals
(
tuple_vals
const
&
)
=
default
;
tuple_vals
(
const
tuple_vals
&
)
=
default
;
tuple_vals
(
ElementTypes
const
&
...
args
)
tuple_vals
(
const
ElementTypes
&
...
args
)
:
super
(
tuple_impl_info
::
statically_typed
),
m_data
(
args
...)
{
}
...
...
@@ -83,7 +83,7 @@ class tuple_vals : public abstract_tuple
return
m_data
;
}
inline
data_type
const
&
data
()
const
inline
const
data_type
&
data
()
const
{
return
m_data
;
}
...
...
@@ -116,7 +116,7 @@ class tuple_vals : public abstract_tuple
return
m_types
[
pos
];
}
bool
equals
(
abstract_tuple
const
&
other
)
const
bool
equals
(
const
abstract_tuple
&
other
)
const
{
if
(
size
()
!=
other
.
size
())
return
false
;
tuple_vals
const
*
o
=
dynamic_cast
<
tuple_vals
const
*>
(
&
other
);
...
...
cppa/detail/tuple_view.hpp
View file @
54f080df
...
...
@@ -66,7 +66,7 @@ class tuple_view : public abstract_tuple
typedef
types_array
<
ElementTypes
...
>
element_types
;
tuple_view
()
=
delete
;
tuple_view
(
tuple_view
const
&
)
=
delete
;
tuple_view
(
const
tuple_view
&
)
=
delete
;
/**
* @warning @p tuple_view does @b NOT takes ownership for given pointers
...
...
@@ -81,7 +81,7 @@ class tuple_view : public abstract_tuple
return
m_data
;
}
inline
data_type
const
&
data
()
const
inline
const
data_type
&
data
()
const
{
return
m_data
;
}
...
...
cppa/detail/types_array.hpp
View file @
54f080df
...
...
@@ -11,7 +11,7 @@
// forward declarations
namespace
cppa
{
class
uniform_type_info
;
uniform_type_info
const
*
uniform_typeid
(
std
::
type_info
const
&
);
uniform_type_info
const
*
uniform_typeid
(
const
std
::
type_info
&
);
}
// namespace cppa
namespace
cppa
{
namespace
detail
{
...
...
cppa/detail/uniform_type_info_map.hpp
View file @
54f080df
...
...
@@ -59,19 +59,19 @@ class uniform_type_info_map
~
uniform_type_info_map
();
inline
int_map
const
&
int_names
()
const
inline
const
int_map
&
int_names
()
const
{
return
m_ints
;
}
uniform_type_info
*
by_raw_name
(
std
::
string
const
&
name
)
const
;
uniform_type_info
*
by_raw_name
(
const
std
::
string
&
name
)
const
;
uniform_type_info
*
by_uniform_name
(
std
::
string
const
&
name
)
const
;
uniform_type_info
*
by_uniform_name
(
const
std
::
string
&
name
)
const
;
std
::
vector
<
uniform_type_info
*>
get_all
()
const
;
// NOT thread safe!
bool
insert
(
std
::
set
<
std
::
string
>
const
&
raw_names
,
uniform_type_info
*
uti
);
bool
insert
(
const
std
::
set
<
std
::
string
>
&
raw_names
,
uniform_type_info
*
uti
);
private:
...
...
cppa/detail/value_guard.hpp
View file @
54f080df
...
...
@@ -43,7 +43,7 @@ namespace cppa { namespace detail {
template
<
bool
IsFun
,
typename
T
>
struct
vg_fwd_
{
static
inline
T
const
&
_
(
T
const
&
arg
)
{
return
arg
;
}
static
inline
const
T
&
_
(
const
T
&
arg
)
{
return
arg
;
}
static
inline
T
&&
_
(
T
&&
arg
)
{
return
std
::
move
(
arg
);
}
static
inline
T
&
_
(
T
&
arg
)
{
return
arg
;
}
};
...
...
@@ -69,15 +69,14 @@ class value_guard
typename
tdata_from_type_list
<
FilteredPattern
>::
type
m_args
;
template
<
typename
...
Args
>
static
inline
bool
_eval
(
util
::
void_type
const
&
,
tdata
<>
const
&
,
Args
const
&
...)
static
inline
bool
_eval
(
const
util
::
void_type
&
,
const
tdata
<>&
,
const
Args
&
...)
{
return
true
;
}
template
<
class
Tail
,
typename
Arg0
,
typename
...
Args
>
static
inline
bool
_eval
(
util
::
void_type
const
&
,
Tail
const
&
tail
,
Arg0
const
&
,
Args
const
&
...
args
)
static
inline
bool
_eval
(
const
util
::
void_type
&
,
const
Tail
&
tail
,
const
Arg0
&
,
const
Args
&
...
args
)
{
return
_eval
(
tail
.
head
,
tail
.
tail
(),
args
...);
}
...
...
@@ -95,8 +94,8 @@ class value_guard
}
template
<
typename
Head
,
class
Tail
,
typename
Arg0
,
typename
...
Args
>
static
inline
bool
_eval
(
Head
const
&
head
,
Tail
const
&
tail
,
Arg0
const
&
arg0
,
Args
const
&
...
args
)
static
inline
bool
_eval
(
const
Head
&
head
,
const
Tail
&
tail
,
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
return
cmp
(
head
,
arg0
)
&&
_eval
(
tail
.
head
,
tail
.
tail
(),
args
...);
}
...
...
@@ -104,15 +103,15 @@ class value_guard
public:
value_guard
()
=
default
;
value_guard
(
value_guard
const
&
)
=
default
;
value_guard
(
const
value_guard
&
)
=
default
;
template
<
typename
...
Args
>
value_guard
(
Args
const
&
...
args
)
:
m_args
(
vg_fwd
<
Args
>::
_
(
args
)...)
value_guard
(
const
Args
&
...
args
)
:
m_args
(
vg_fwd
<
Args
>::
_
(
args
)...)
{
}
template
<
typename
...
Args
>
inline
bool
operator
()(
Args
const
&
...
args
)
const
inline
bool
operator
()(
const
Args
&
...
args
)
const
{
return
_eval
(
m_args
.
head
,
m_args
.
tail
(),
args
...);
}
...
...
cppa/either.hpp
View file @
54f080df
...
...
@@ -62,7 +62,7 @@ class either
/**
* @brief Creates a @p Left from @p value.
*/
either
(
left_type
const
&
value
)
:
m_is_left
(
true
)
{
cr_left
(
value
);
}
either
(
const
left_type
&
value
)
:
m_is_left
(
true
)
{
cr_left
(
value
);
}
/**
* @brief Creates a @p Left from @p value.
...
...
@@ -72,14 +72,14 @@ class either
/**
* @brief Creates a @p Right from @p value.
*/
either
(
right_type
const
&
value
)
:
m_is_left
(
false
)
{
cr_right
(
value
);
}
either
(
const
right_type
&
value
)
:
m_is_left
(
false
)
{
cr_right
(
value
);
}
/**
* @brief Creates a @p Right from @p value.
*/
either
(
Right
&&
value
)
:
m_is_left
(
false
)
{
cr_right
(
std
::
move
(
value
));
}
either
(
either
const
&
other
)
:
m_is_left
(
other
.
m_is_left
)
either
(
const
either
&
other
)
:
m_is_left
(
other
.
m_is_left
)
{
if
(
other
.
m_is_left
)
cr_left
(
other
.
m_left
);
else
cr_right
(
other
.
m_right
);
...
...
@@ -93,7 +93,7 @@ class either
~
either
()
{
destroy
();
}
either
&
operator
=
(
either
const
&
other
)
either
&
operator
=
(
const
either
&
other
)
{
if
(
m_is_left
==
other
.
m_is_left
)
{
...
...
@@ -149,7 +149,7 @@ class either
/**
* @brief Returns this @p either as a @p Left.
*/
inline
left_type
const
&
left
()
const
inline
const
left_type
&
left
()
const
{
CPPA_REQUIRE
(
m_is_left
);
return
m_left
;
...
...
@@ -167,7 +167,7 @@ class either
/**
* @brief Returns this @p either as a @p Right.
*/
inline
right_type
const
&
right
()
const
inline
const
right_type
&
right
()
const
{
CPPA_REQUIRE
(
!
m_is_left
);
return
m_right
;
...
...
@@ -205,7 +205,7 @@ class either
/** @relates either */
template
<
typename
Left
,
typename
Right
>
bool
operator
==
(
either
<
Left
,
Right
>
const
&
lhs
,
either
<
Left
,
Right
>
const
&
rhs
)
bool
operator
==
(
const
either
<
Left
,
Right
>&
lhs
,
const
either
<
Left
,
Right
>
&
rhs
)
{
if
(
lhs
.
is_left
()
==
rhs
.
is_left
())
{
...
...
@@ -217,63 +217,63 @@ bool operator==(either<Left, Right> const& lhs, either<Left, Right> const& rhs)
/** @relates either */
template
<
typename
Left
,
typename
Right
>
bool
operator
==
(
either
<
Left
,
Right
>
const
&
lhs
,
Left
cons
t
&
rhs
)
bool
operator
==
(
const
either
<
Left
,
Right
>&
lhs
,
const
Lef
t
&
rhs
)
{
return
lhs
.
is_left
()
&&
lhs
.
left
()
==
rhs
;
}
/** @relates either */
template
<
typename
Left
,
typename
Right
>
bool
operator
==
(
Left
const
&
lhs
,
either
<
Left
,
Right
>
const
&
rhs
)
bool
operator
==
(
const
Left
&
lhs
,
const
either
<
Left
,
Right
>
&
rhs
)
{
return
rhs
==
lhs
;
}
/** @relates either */
template
<
typename
Left
,
typename
Right
>
bool
operator
==
(
either
<
Left
,
Right
>
const
&
lhs
,
Right
cons
t
&
rhs
)
bool
operator
==
(
const
either
<
Left
,
Right
>&
lhs
,
const
Righ
t
&
rhs
)
{
return
lhs
.
is_right
()
&&
lhs
.
right
()
==
rhs
;
}
/** @relates either */
template
<
typename
Left
,
typename
Right
>
bool
operator
==
(
Right
const
&
lhs
,
either
<
Left
,
Right
>
const
&
rhs
)
bool
operator
==
(
const
Right
&
lhs
,
const
either
<
Left
,
Right
>
&
rhs
)
{
return
rhs
==
lhs
;
}
/** @relates either */
template
<
typename
Left
,
typename
Right
>
bool
operator
!=
(
either
<
Left
,
Right
>
const
&
lhs
,
either
<
Left
,
Right
>
const
&
rhs
)
bool
operator
!=
(
const
either
<
Left
,
Right
>&
lhs
,
const
either
<
Left
,
Right
>
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
/** @relates either */
template
<
typename
Left
,
typename
Right
>
bool
operator
!=
(
either
<
Left
,
Right
>
const
&
lhs
,
Left
cons
t
&
rhs
)
bool
operator
!=
(
const
either
<
Left
,
Right
>&
lhs
,
const
Lef
t
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
/** @relates either */
template
<
typename
Left
,
typename
Right
>
bool
operator
!=
(
Left
const
&
lhs
,
either
<
Left
,
Right
>
const
&
rhs
)
bool
operator
!=
(
const
Left
&
lhs
,
const
either
<
Left
,
Right
>
&
rhs
)
{
return
!
(
rhs
==
lhs
);
}
/** @relates either */
template
<
typename
Left
,
typename
Right
>
bool
operator
!=
(
either
<
Left
,
Right
>
const
&
lhs
,
Right
cons
t
&
rhs
)
bool
operator
!=
(
const
either
<
Left
,
Right
>&
lhs
,
const
Righ
t
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
/** @relates either */
template
<
typename
Left
,
typename
Right
>
bool
operator
!=
(
Right
const
&
lhs
,
either
<
Left
,
Right
>
const
&
rhs
)
bool
operator
!=
(
const
Right
&
lhs
,
const
either
<
Left
,
Right
>
&
rhs
)
{
return
!
(
rhs
==
lhs
);
}
...
...
cppa/exception.hpp
View file @
54f080df
...
...
@@ -66,7 +66,7 @@ class exception : public std::exception
* @brief Creates an exception with the error string @p what_str.
* @param what_str Error message as string.
*/
exception
(
std
::
string
const
&
what_str
);
exception
(
const
std
::
string
&
what_str
);
private:
...
...
@@ -107,7 +107,7 @@ class network_error : public exception
public:
network_error
(
std
::
string
&&
what_str
);
network_error
(
std
::
string
const
&
what_str
);
network_error
(
const
std
::
string
&
what_str
);
};
...
...
cppa/from_string.hpp
View file @
54f080df
...
...
@@ -40,13 +40,13 @@
namespace
cppa
{
object
from_string
(
std
::
string
const
&
what
);
object
from_string
(
const
std
::
string
&
what
);
template
<
typename
T
>
T
from_string
(
const
std
::
string
&
what
)
{
object
o
=
from_string
(
what
);
std
::
type_info
const
&
tinfo
=
typeid
(
T
);
const
std
::
type_info
&
tinfo
=
typeid
(
T
);
if
(
tinfo
==
*
(
o
.
type
()))
{
return
std
::
move
(
get
<
T
>
(
o
));
...
...
cppa/get.hpp
View file @
54f080df
...
...
@@ -47,17 +47,17 @@ template<typename...> struct pseudo_tuple;
// forward declaration of cow_tuple
template
<
typename
...
>
class
cow_tuple
;
// forward declaration of get(
detail::tdata<...> const
&)
// forward declaration of get(
const detail::tdata<...>
&)
template
<
size_t
N
,
typename
...
Tn
>
typename
util
::
at
<
N
,
Tn
...
>::
type
const
&
get
(
detail
::
tdata
<
Tn
...
>
const
&
);
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
const
detail
::
tdata
<
Tn
...
>
&
);
// forward declarations of get(
tuple<...> const
&)
// forward declarations of get(
const tuple<...>
&)
template
<
size_t
N
,
typename
...
Tn
>
typename
util
::
at
<
N
,
Tn
...
>::
type
const
&
get
(
cow_tuple
<
Tn
...
>
const
&
);
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
const
cow_tuple
<
Tn
...
>
&
);
// forward declarations of get(detail::pseudo_tuple<...>&)
template
<
size_t
N
,
typename
...
Tn
>
typename
util
::
at
<
N
,
Tn
...
>::
type
const
&
get
(
detail
::
pseudo_tuple
<
Tn
...
>
const
&
tv
);
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
const
detail
::
pseudo_tuple
<
Tn
...
>
&
tv
);
// forward declarations of get_ref(detail::tdata<...>&)
template
<
size_t
N
,
typename
...
Tn
>
...
...
@@ -73,7 +73,7 @@ typename util::at<N, Tn...>::type& get_ref(detail::pseudo_tuple<Tn...>& tv);
// support container-like access for type lists containing tokens
template
<
size_t
N
,
typename
...
Ts
>
typename
util
::
at
<
N
,
Ts
...
>::
type
get
(
util
::
type_list
<
Ts
...
>
const
&
)
typename
util
::
at
<
N
,
Ts
...
>::
type
get
(
const
util
::
type_list
<
Ts
...
>
&
)
{
return
{};
}
...
...
cppa/group.hpp
View file @
54f080df
...
...
@@ -57,9 +57,9 @@ class group : public channel
group
(
std
::
string
&&
id
,
std
::
string
&&
mod_name
);
group
(
std
::
string
const
&
id
,
std
::
string
const
&
mod_name
);
group
(
const
std
::
string
&
id
,
const
std
::
string
&
mod_name
);
virtual
void
unsubscribe
(
c
hannel_ptr
const
&
who
)
=
0
;
virtual
void
unsubscribe
(
c
onst
channel_ptr
&
who
)
=
0
;
public:
...
...
@@ -79,14 +79,14 @@ class group : public channel
public:
unsubscriber
(
c
hannel_ptr
const
&
s
,
intrusive_ptr
<
group
>
const
&
g
);
unsubscriber
(
c
onst
channel_ptr
&
s
,
const
intrusive_ptr
<
group
>
&
g
);
~
unsubscriber
();
void
actor_exited
(
std
::
uint32_t
);
// matches on m_group
bool
matches
(
attachable
::
token
const
&
what
);
bool
matches
(
const
attachable
::
token
&
what
);
};
...
...
@@ -103,7 +103,7 @@ class group : public channel
protected:
module
(
std
::
string
&&
module_name
);
module
(
std
::
string
const
&
module_name
);
module
(
const
std
::
string
&
module_name
);
public:
...
...
@@ -112,14 +112,14 @@ class group : public channel
* @returns The name of this module implementation.
* @threadsafe
*/
std
::
string
const
&
name
();
const
std
::
string
&
name
();
/**
* @brief Get a pointer to the group associated with
* the name @p group_name.
* @threadsafe
*/
virtual
intrusive_ptr
<
group
>
get
(
std
::
string
const
&
group_name
)
=
0
;
virtual
intrusive_ptr
<
group
>
get
(
const
std
::
string
&
group_name
)
=
0
;
};
...
...
@@ -128,28 +128,28 @@ class group : public channel
* @returns The group identifier as string (e.g. "224.0.0.1" for IPv4
* multicast or a user-defined string for local groups).
*/
std
::
string
const
&
identifier
()
const
;
const
std
::
string
&
identifier
()
const
;
/**
* @brief The name of the module.
* @returns The module name of this group (e.g. "local").
*/
std
::
string
const
&
module_name
()
const
;
const
std
::
string
&
module_name
()
const
;
/**
* @brief Subscribe @p who to this group.
* @returns A {@link subscription} object that unsubscribes @p who
* if the lifetime of @p who ends.
*/
virtual
subscription
subscribe
(
c
hannel_ptr
const
&
who
)
=
0
;
virtual
subscription
subscribe
(
c
onst
channel_ptr
&
who
)
=
0
;
/**
* @brief Get a pointer to the group associated with
* @p group_identifier from the module @p module_name.
* @threadsafe
*/
static
intrusive_ptr
<
group
>
get
(
std
::
string
const
&
module_name
,
std
::
string
const
&
group_identifier
);
static
intrusive_ptr
<
group
>
get
(
const
std
::
string
&
module_name
,
const
std
::
string
&
group_identifier
);
/**
* @brief Returns an anonymous group.
...
...
cppa/guard_expr.hpp
View file @
54f080df
...
...
@@ -98,11 +98,11 @@ struct guard_expr
{
}
guard_expr
(
guard_expr
const
&
)
=
default
;
guard_expr
(
const
guard_expr
&
)
=
default
;
guard_expr
(
guard_expr
&&
other
)
:
m_args
(
std
::
move
(
other
.
m_args
))
{
}
template
<
typename
...
Args
>
bool
operator
()(
Args
const
&
...
args
)
const
;
bool
operator
()(
const
Args
&
...
args
)
const
;
};
...
...
@@ -122,13 +122,13 @@ struct ge_mutable_reference_wrapper
ge_mutable_reference_wrapper
()
:
value
(
nullptr
)
{
}
ge_mutable_reference_wrapper
(
T
&&
)
=
delete
;
ge_mutable_reference_wrapper
(
T
&
vref
)
:
value
(
&
vref
)
{
}
ge_mutable_reference_wrapper
(
ge_mutable_reference_wrapper
const
&
)
=
default
;
ge_mutable_reference_wrapper
(
const
ge_mutable_reference_wrapper
&
)
=
default
;
ge_mutable_reference_wrapper
&
operator
=
(
T
&
vref
)
{
value
=
&
vref
;
return
*
this
;
}
ge_mutable_reference_wrapper
&
operator
=
(
ge_mutable_reference_wrapper
const
&
)
=
default
;
ge_mutable_reference_wrapper
&
operator
=
(
const
ge_mutable_reference_wrapper
&
)
=
default
;
T
&
get
()
const
{
CPPA_REQUIRE
(
value
!=
0
);
return
*
value
;
}
operator
T
&
()
const
{
CPPA_REQUIRE
(
value
!=
0
);
return
*
value
;
}
};
...
...
@@ -139,16 +139,16 @@ struct ge_reference_wrapper
T
const
*
value
;
ge_reference_wrapper
(
T
&&
)
=
delete
;
ge_reference_wrapper
()
:
value
(
nullptr
)
{
}
ge_reference_wrapper
(
T
const
&
val_ref
)
:
value
(
&
val_ref
)
{
}
ge_reference_wrapper
(
ge_reference_wrapper
const
&
)
=
default
;
ge_reference_wrapper
&
operator
=
(
T
const
&
vref
)
ge_reference_wrapper
(
const
T
&
val_ref
)
:
value
(
&
val_ref
)
{
}
ge_reference_wrapper
(
const
ge_reference_wrapper
&
)
=
default
;
ge_reference_wrapper
&
operator
=
(
const
T
&
vref
)
{
value
=
&
vref
;
return
*
this
;
}
ge_reference_wrapper
&
operator
=
(
ge_reference_wrapper
const
&
)
=
default
;
T
const
&
get
()
const
{
CPPA_REQUIRE
(
value
!=
0
);
return
*
value
;
}
operator
T
const
&
()
const
{
CPPA_REQUIRE
(
value
!=
0
);
return
*
value
;
}
ge_reference_wrapper
&
operator
=
(
const
ge_reference_wrapper
&
)
=
default
;
const
T
&
get
()
const
{
CPPA_REQUIRE
(
value
!=
0
);
return
*
value
;
}
operator
const
T
&
()
const
{
CPPA_REQUIRE
(
value
!=
0
);
return
*
value
;
}
};
// support use of gref(BooleanVariable) as receive loop 'guard'
...
...
@@ -157,11 +157,11 @@ struct ge_reference_wrapper<bool>
{
bool
const
*
value
;
ge_reference_wrapper
(
bool
&&
)
=
delete
;
ge_reference_wrapper
(
bool
const
&
val_ref
)
:
value
(
&
val_ref
)
{
}
ge_reference_wrapper
(
ge_reference_wrapper
const
&
)
=
default
;
ge_reference_wrapper
&
operator
=
(
ge_reference_wrapper
const
&
)
=
default
;
bool
const
&
get
()
const
{
CPPA_REQUIRE
(
value
!=
0
);
return
*
value
;
}
operator
bool
const
&
()
const
{
CPPA_REQUIRE
(
value
!=
0
);
return
*
value
;
}
ge_reference_wrapper
(
const
bool
&
val_ref
)
:
value
(
&
val_ref
)
{
}
ge_reference_wrapper
(
const
ge_reference_wrapper
&
)
=
default
;
ge_reference_wrapper
&
operator
=
(
const
ge_reference_wrapper
&
)
=
default
;
const
bool
&
get
()
const
{
CPPA_REQUIRE
(
value
!=
0
);
return
*
value
;
}
operator
const
bool
&
()
const
{
CPPA_REQUIRE
(
value
!=
0
);
return
*
value
;
}
bool
operator
()()
const
{
CPPA_REQUIRE
(
value
!=
0
);
return
*
value
;
}
};
...
...
@@ -170,7 +170,7 @@ struct ge_reference_wrapper<bool>
* that could be used in guard expressions or to enforce lazy evaluation.
*/
template
<
typename
T
>
ge_reference_wrapper
<
T
>
gref
(
T
const
&
value
)
{
return
{
value
};
}
ge_reference_wrapper
<
T
>
gref
(
const
T
&
value
)
{
return
{
value
};
}
// bind utility for placeholders
...
...
@@ -237,22 +237,22 @@ struct ge_search_container
ge_search_container
(
bool
should_contain
)
:
sc
(
should_contain
)
{
}
template
<
class
C
>
bool
operator
()(
C
const
&
haystack
,
typename
C
::
value_type
const
&
needle
)
const
bool
operator
()(
const
C
&
haystack
,
const
typename
C
::
value_type
&
needle
)
const
{
typedef
typename
C
::
value_type
vtype
;
if
(
sc
)
return
std
::
any_of
(
haystack
.
begin
(),
haystack
.
end
(),
[
&
](
vtype
const
&
val
)
{
return
needle
==
val
;
});
[
&
](
const
vtype
&
val
)
{
return
needle
==
val
;
});
return
std
::
none_of
(
haystack
.
begin
(),
haystack
.
end
(),
[
&
](
vtype
const
&
val
)
{
return
needle
==
val
;
});
[
&
](
const
vtype
&
val
)
{
return
needle
==
val
;
});
}
};
struct
ge_get_size
{
template
<
class
C
>
inline
auto
operator
()(
C
const
&
what
)
const
->
decltype
(
what
.
size
())
inline
auto
operator
()(
const
C
&
what
)
const
->
decltype
(
what
.
size
())
{
return
what
.
size
();
}
...
...
@@ -263,7 +263,7 @@ struct ge_is_empty
bool
expected
;
ge_is_empty
(
bool
expected_value
)
:
expected
(
expected_value
)
{
}
template
<
class
C
>
inline
bool
operator
()(
C
const
&
what
)
const
inline
bool
operator
()(
const
C
&
what
)
const
{
return
what
.
empty
()
==
expected
;
}
...
...
@@ -272,7 +272,7 @@ struct ge_is_empty
struct
ge_get_front
{
template
<
class
C
>
inline
auto
operator
()(
C
const
&
what
,
inline
auto
operator
()(
const
C
&
what
,
typename
std
::
enable_if
<
std
::
is_reference
<
decltype
(
what
.
front
())
...
...
@@ -286,7 +286,7 @@ struct ge_get_front
return
{};
}
template
<
class
C
>
inline
auto
operator
()(
C
const
&
what
,
inline
auto
operator
()(
const
C
&
what
,
typename
std
::
enable_if
<
std
::
is_reference
<
decltype
(
what
.
front
())
...
...
@@ -318,7 +318,7 @@ struct guard_placeholder
}
// utility function for starts_with()
static
bool
u8_starts_with
(
std
::
string
const
&
lhs
,
std
::
string
const
&
rhs
)
static
bool
u8_starts_with
(
const
std
::
string
&
lhs
,
const
std
::
string
&
rhs
)
{
return
std
::
equal
(
rhs
.
begin
(),
rhs
.
end
(),
lhs
.
begin
());
}
...
...
@@ -496,7 +496,7 @@ struct ge_eval_op;
#define CPPA_EVAL_OP_IMPL(EnumValue, Operator) \
template<> struct ge_eval_op< EnumValue > { \
template<typename T1, typename T2> \
static inline auto _(
T1 const& lhs, T2 const
& rhs) \
static inline auto _(
const T1& lhs, const T2
& rhs) \
-> decltype(lhs Operator rhs) { return lhs Operator rhs; } \
};
...
...
@@ -594,45 +594,46 @@ operator||(guard_expr<OP1, F1, S1> lhs,
// evaluation of guard_expr
template
<
class
Tuple
,
typename
T
>
inline
T
const
&
ge_resolve
(
Tuple
const
&
,
T
const
&
value
)
inline
const
T
&
ge_resolve
(
const
Tuple
&
,
const
T
&
value
)
{
return
value
;
}
template
<
class
Tuple
,
typename
T
>
inline
T
const
&
ge_resolve
(
Tuple
const
&
,
std
::
reference_wrapper
<
T
>
const
&
value
)
inline
const
T
&
ge_resolve
(
const
Tuple
&
,
const
std
::
reference_wrapper
<
T
>
&
value
)
{
return
value
.
get
();
}
template
<
class
Tuple
,
typename
T
>
inline
T
const
&
ge_resolve
(
Tuple
const
&
,
std
::
reference_wrapper
<
const
T
>
const
&
value
)
inline
const
T
&
ge_resolve
(
const
Tuple
&
,
const
std
::
reference_wrapper
<
const
T
>
&
value
)
{
return
value
.
get
();
}
template
<
class
Tuple
,
typename
T
>
inline
T
const
&
ge_resolve
(
Tuple
const
&
,
ge_reference_wrapper
<
T
>
const
&
value
)
inline
const
T
&
ge_resolve
(
const
Tuple
&
,
const
ge_reference_wrapper
<
T
>
&
value
)
{
return
value
.
get
();
}
template
<
class
Tuple
,
int
X
>
inline
auto
ge_resolve
(
Tuple
const
&
tup
,
guard_placeholder
<
X
>
)
inline
auto
ge_resolve
(
const
Tuple
&
tup
,
guard_placeholder
<
X
>
)
->
decltype
(
get
<
X
>
(
tup
).
get
())
{
return
get
<
X
>
(
tup
).
get
();
}
template
<
class
Tuple
,
operator_id
OP
,
typename
First
,
typename
Second
>
auto
ge_resolve
(
Tuple
const
&
tup
,
guard_expr
<
OP
,
First
,
Second
>
const
&
ge
)
auto
ge_resolve
(
const
Tuple
&
tup
,
const
guard_expr
<
OP
,
First
,
Second
>&
ge
)
->
typename
ge_result
<
OP
,
First
,
Second
,
Tuple
>::
type
;
template
<
operator_id
OP
,
class
Tuple
,
typename
First
,
typename
Second
>
struct
ge_eval_
{
static
inline
typename
ge_result
<
OP
,
First
,
Second
,
Tuple
>::
type
_
(
Tuple
const
&
tup
,
First
const
&
lhs
,
Second
const
&
rhs
)
_
(
const
Tuple
&
tup
,
const
First
&
lhs
,
const
Second
&
rhs
)
{
return
ge_eval_op
<
OP
>::
_
(
ge_resolve
(
tup
,
lhs
),
ge_resolve
(
tup
,
rhs
));
}
...
...
@@ -641,7 +642,7 @@ struct ge_eval_
template
<
class
Tuple
,
typename
First
,
typename
Second
>
struct
ge_eval_
<
logical_and_op
,
Tuple
,
First
,
Second
>
{
static
inline
bool
_
(
Tuple
const
&
tup
,
First
const
&
lhs
,
Second
const
&
rhs
)
static
inline
bool
_
(
const
Tuple
&
tup
,
const
First
&
lhs
,
const
Second
&
rhs
)
{
// emulate short-circuit evaluation
if
(
ge_resolve
(
tup
,
lhs
))
return
ge_resolve
(
tup
,
rhs
);
...
...
@@ -652,7 +653,7 @@ struct ge_eval_<logical_and_op, Tuple, First, Second>
template
<
class
Tuple
,
typename
First
,
typename
Second
>
struct
ge_eval_
<
logical_or_op
,
Tuple
,
First
,
Second
>
{
static
inline
bool
_
(
Tuple
const
&
tup
,
First
const
&
lhs
,
Second
const
&
rhs
)
static
inline
bool
_
(
const
Tuple
&
tup
,
const
First
&
lhs
,
const
Second
&
rhs
)
{
// emulate short-circuit evaluation
if
(
ge_resolve
(
tup
,
lhs
))
return
true
;
...
...
@@ -663,7 +664,7 @@ struct ge_eval_<logical_or_op, Tuple, First, Second>
template
<
class
Tuple
,
typename
Fun
>
struct
ge_eval_
<
exec_xfun_op
,
Tuple
,
Fun
,
util
::
void_type
>
{
static
inline
bool
_
(
Tuple
const
&
tup
,
Fun
const
&
fun
,
util
::
void_type
const
&
)
static
inline
bool
_
(
const
Tuple
&
tup
,
const
Fun
&
fun
,
const
util
::
void_type
&
)
{
return
util
::
unchecked_apply_tuple
<
bool
>
(
fun
,
tup
);
}
...
...
@@ -672,7 +673,7 @@ struct ge_eval_<exec_xfun_op, Tuple, Fun, util::void_type>
template
<
class
Tuple
,
typename
First
,
typename
Second
>
struct
ge_eval_
<
exec_fun1_op
,
Tuple
,
First
,
Second
>
{
static
inline
auto
_
(
Tuple
const
&
tup
,
First
const
&
fun
,
Second
const
&
arg0
)
static
inline
auto
_
(
const
Tuple
&
tup
,
const
First
&
fun
,
const
Second
&
arg0
)
->
decltype
(
fun
(
ge_resolve
(
tup
,
arg0
)))
{
return
fun
(
ge_resolve
(
tup
,
arg0
));
...
...
@@ -682,7 +683,7 @@ struct ge_eval_<exec_fun1_op, Tuple, First, Second>
template
<
class
Tuple
,
typename
First
,
typename
Second
>
struct
ge_eval_
<
exec_fun2_op
,
Tuple
,
First
,
Second
>
{
static
inline
auto
_
(
Tuple
const
&
tup
,
First
const
&
lhs
,
Second
const
&
rhs
)
static
inline
auto
_
(
const
Tuple
&
tup
,
const
First
&
lhs
,
const
Second
&
rhs
)
->
decltype
(
lhs
.
m_args
.
first
(
ge_resolve
(
tup
,
lhs
.
m_args
.
second
),
ge_resolve
(
tup
,
rhs
)))
{
...
...
@@ -694,7 +695,7 @@ struct ge_eval_<exec_fun2_op, Tuple, First, Second>
template
<
class
Tuple
,
typename
First
,
typename
Second
>
struct
ge_eval_
<
exec_fun3_op
,
Tuple
,
First
,
Second
>
{
static
inline
auto
_
(
Tuple
const
&
tup
,
First
const
&
lhs
,
Second
const
&
rhs
)
static
inline
auto
_
(
const
Tuple
&
tup
,
const
First
&
lhs
,
const
Second
&
rhs
)
->
decltype
(
lhs
.
m_args
.
first
(
ge_resolve
(
tup
,
lhs
.
m_args
.
second
),
ge_resolve
(
tup
,
rhs
.
m_args
.
first
),
ge_resolve
(
tup
,
rhs
.
m_args
.
second
)))
...
...
@@ -707,29 +708,30 @@ struct ge_eval_<exec_fun3_op, Tuple, First, Second>
template
<
operator_id
OP
,
class
Tuple
,
typename
First
,
typename
Second
>
inline
typename
ge_result
<
OP
,
First
,
Second
,
Tuple
>::
type
ge_eval
(
Tuple
const
&
tup
,
First
const
&
lhs
,
Second
const
&
rhs
)
ge_eval
(
const
Tuple
&
tup
,
const
First
&
lhs
,
const
Second
&
rhs
)
{
return
ge_eval_
<
OP
,
Tuple
,
First
,
Second
>::
_
(
tup
,
lhs
,
rhs
);
}
template
<
class
Tuple
,
operator_id
OP
,
typename
First
,
typename
Second
>
auto
ge_resolve
(
Tuple
const
&
tup
,
guard_expr
<
OP
,
First
,
Second
>
const
&
ge
)
auto
ge_resolve
(
const
Tuple
&
tup
,
const
guard_expr
<
OP
,
First
,
Second
>&
ge
)
->
typename
ge_result
<
OP
,
First
,
Second
,
Tuple
>::
type
{
return
ge_eval
<
OP
>
(
tup
,
ge
.
m_args
.
first
,
ge
.
m_args
.
second
);
}
template
<
operator_id
OP
,
typename
First
,
typename
Second
,
typename
...
Args
>
auto
ge_invoke_step2
(
guard_expr
<
OP
,
First
,
Second
>
const
&
ge
,
detail
::
tdata
<
Args
...
>
const
&
tup
)
auto
ge_invoke_step2
(
const
guard_expr
<
OP
,
First
,
Second
>
&
ge
,
const
detail
::
tdata
<
Args
...
>
&
tup
)
->
typename
ge_result
<
OP
,
First
,
Second
,
detail
::
tdata
<
Args
...
>>::
type
{
return
ge_eval
<
OP
>
(
tup
,
ge
.
m_args
.
first
,
ge
.
m_args
.
second
);
}
template
<
operator_id
OP
,
typename
First
,
typename
Second
,
typename
...
Args
>
auto
ge_invoke
(
guard_expr
<
OP
,
First
,
Second
>
const
&
ge
,
Args
const
&
...
args
)
auto
ge_invoke
(
const
guard_expr
<
OP
,
First
,
Second
>
&
ge
,
const
Args
&
...
args
)
->
typename
ge_result
<
OP
,
First
,
Second
,
detail
::
tdata
<
std
::
reference_wrapper
<
const
Args
>
...
>>::
type
{
...
...
@@ -740,8 +742,8 @@ auto ge_invoke(guard_expr<OP, First, Second> const& ge,
template
<
class
GuardExpr
>
struct
ge_invoke_helper
{
GuardExpr
const
&
ge
;
ge_invoke_helper
(
GuardExpr
const
&
arg
)
:
ge
(
arg
)
{
}
const
GuardExpr
&
ge
;
ge_invoke_helper
(
const
GuardExpr
&
arg
)
:
ge
(
arg
)
{
}
template
<
typename
...
Args
>
bool
operator
()(
Args
&&
...
args
)
const
{
...
...
@@ -756,8 +758,8 @@ typename ge_result<
typename
util
::
tl_filter_not
<
TupleTypes
,
is_anything
>::
type
>::
type
>::
type
ge_invoke_any
(
guard_expr
<
OP
,
First
,
Second
>
const
&
ge
,
any_tuple
const
&
tup
)
ge_invoke_any
(
const
guard_expr
<
OP
,
First
,
Second
>
&
ge
,
const
any_tuple
&
tup
)
{
typedef
typename
ge_result
<
OP
,
First
,
Second
,
...
...
@@ -781,7 +783,7 @@ ge_invoke_any(guard_expr<OP, First, Second> const& ge,
template
<
operator_id
OP
,
typename
First
,
typename
Second
>
template
<
typename
...
Args
>
bool
guard_expr
<
OP
,
First
,
Second
>::
operator
()(
Args
const
&
...
args
)
const
bool
guard_expr
<
OP
,
First
,
Second
>::
operator
()(
const
Args
&
...
args
)
const
{
static_assert
(
std
::
is_same
<
decltype
(
ge_invoke
(
*
this
,
args
...)),
bool
>::
value
,
"guard expression does not return a boolean"
);
...
...
cppa/intrusive/forward_iterator.hpp
View file @
54f080df
...
...
@@ -46,7 +46,7 @@ class forward_iterator
typedef
T
value_type
;
typedef
value_type
&
reference
;
typedef
value_type
const
&
const_reference
;
typedef
const
value_type
&
const_reference
;
typedef
value_type
*
pointer
;
typedef
value_type
const
*
const_pointer
;
typedef
ptrdiff_t
difference_type
;
...
...
@@ -54,8 +54,8 @@ class forward_iterator
inline
forward_iterator
(
pointer
ptr
=
nullptr
)
:
m_ptr
(
ptr
)
{
}
forward_iterator
(
forward_iterator
const
&
)
=
default
;
forward_iterator
&
operator
=
(
forward_iterator
const
&
)
=
default
;
forward_iterator
(
const
forward_iterator
&
)
=
default
;
forward_iterator
&
operator
=
(
const
forward_iterator
&
)
=
default
;
inline
forward_iterator
&
operator
++
()
{
...
...
@@ -100,8 +100,8 @@ class forward_iterator
* @relates forward_iterator
*/
template
<
class
T
>
inline
bool
operator
==
(
forward_iterator
<
T
>
const
&
lhs
,
forward_iterator
<
T
>
const
&
rhs
)
inline
bool
operator
==
(
const
forward_iterator
<
T
>
&
lhs
,
const
forward_iterator
<
T
>
&
rhs
)
{
return
lhs
.
ptr
()
==
rhs
.
ptr
();
}
...
...
@@ -110,7 +110,7 @@ inline bool operator==(forward_iterator<T> const& lhs,
* @relates forward_iterator
*/
template
<
class
T
>
inline
bool
operator
==
(
forward_iterator
<
T
>
const
&
lhs
,
T
const
*
rhs
)
inline
bool
operator
==
(
const
forward_iterator
<
T
>
&
lhs
,
T
const
*
rhs
)
{
return
lhs
.
ptr
()
==
rhs
;
}
...
...
@@ -119,7 +119,7 @@ inline bool operator==(forward_iterator<T> const& lhs, T const* rhs)
* @relates forward_iterator
*/
template
<
class
T
>
inline
bool
operator
==
(
T
const
*
lhs
,
forward_iterator
<
T
>
const
&
rhs
)
inline
bool
operator
==
(
T
const
*
lhs
,
const
forward_iterator
<
T
>
&
rhs
)
{
return
lhs
==
rhs
.
ptr
();
}
...
...
@@ -128,7 +128,7 @@ inline bool operator==(T const* lhs, forward_iterator<T> const& rhs)
* @relates forward_iterator
*/
template
<
class
T
>
inline
bool
operator
==
(
forward_iterator
<
T
>
const
&
lhs
,
decltype
(
nullptr
))
inline
bool
operator
==
(
const
forward_iterator
<
T
>
&
lhs
,
decltype
(
nullptr
))
{
return
lhs
.
ptr
()
==
nullptr
;
}
...
...
@@ -137,7 +137,7 @@ inline bool operator==(forward_iterator<T> const& lhs, decltype(nullptr))
* @relates forward_iterator
*/
template
<
class
T
>
inline
bool
operator
==
(
decltype
(
nullptr
),
forward_iterator
<
T
>
const
&
rhs
)
inline
bool
operator
==
(
decltype
(
nullptr
),
const
forward_iterator
<
T
>
&
rhs
)
{
return
rhs
.
ptr
()
==
nullptr
;
}
...
...
@@ -146,8 +146,8 @@ inline bool operator==(decltype(nullptr), forward_iterator<T> const& rhs)
* @relates forward_iterator
*/
template
<
class
T
>
inline
bool
operator
!=
(
forward_iterator
<
T
>
const
&
lhs
,
forward_iterator
<
T
>
const
&
rhs
)
inline
bool
operator
!=
(
const
forward_iterator
<
T
>
&
lhs
,
const
forward_iterator
<
T
>
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
...
...
@@ -156,7 +156,7 @@ inline bool operator!=(forward_iterator<T> const& lhs,
* @relates forward_iterator
*/
template
<
class
T
>
inline
bool
operator
!=
(
forward_iterator
<
T
>
const
&
lhs
,
T
const
*
rhs
)
inline
bool
operator
!=
(
const
forward_iterator
<
T
>
&
lhs
,
T
const
*
rhs
)
{
return
!
(
lhs
==
rhs
);
}
...
...
@@ -165,7 +165,7 @@ inline bool operator!=(forward_iterator<T> const& lhs, T const* rhs)
* @relates forward_iterator
*/
template
<
class
T
>
inline
bool
operator
!=
(
T
const
*
lhs
,
forward_iterator
<
T
>
const
&
rhs
)
inline
bool
operator
!=
(
T
const
*
lhs
,
const
forward_iterator
<
T
>
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
...
...
@@ -174,7 +174,7 @@ inline bool operator!=(T const* lhs, forward_iterator<T> const& rhs)
* @relates forward_iterator
*/
template
<
class
T
>
inline
bool
operator
!=
(
forward_iterator
<
T
>
const
&
lhs
,
decltype
(
nullptr
))
inline
bool
operator
!=
(
const
forward_iterator
<
T
>
&
lhs
,
decltype
(
nullptr
))
{
return
!
(
lhs
==
nullptr
);
}
...
...
@@ -183,7 +183,7 @@ inline bool operator!=(forward_iterator<T> const& lhs, decltype(nullptr))
* @relates forward_iterator
*/
template
<
class
T
>
inline
bool
operator
!=
(
decltype
(
nullptr
),
forward_iterator
<
T
>
const
&
rhs
)
inline
bool
operator
!=
(
decltype
(
nullptr
),
const
forward_iterator
<
T
>
&
rhs
)
{
return
!
(
nullptr
==
rhs
);
}
...
...
cppa/intrusive/single_reader_queue.hpp
View file @
54f080df
...
...
@@ -77,7 +77,7 @@ class single_reader_queue
* @warning call only from the reader (owner)
*/
template
<
typename
TimePoint
>
pointer
try_pop
(
TimePoint
cons
t
&
abs_time
)
pointer
try_pop
(
const
TimePoin
t
&
abs_time
)
{
return
(
timed_wait_for_data
(
abs_time
))
?
take_head
()
:
nullptr
;
}
...
...
@@ -165,7 +165,7 @@ class single_reader_queue
detail
::
condition_variable
m_cv
;
template
<
typename
TimePoint
>
bool
timed_wait_for_data
(
TimePoint
cons
t
&
timeout
)
bool
timed_wait_for_data
(
const
TimePoin
t
&
timeout
)
{
if
(
empty
())
{
...
...
cppa/intrusive/singly_linked_list.hpp
View file @
54f080df
...
...
@@ -48,8 +48,8 @@ template<class T>
class
singly_linked_list
{
singly_linked_list
(
singly_linked_list
con
st
&
)
=
delete
;
singly_linked_list
&
operator
=
(
singly_linked_list
con
st
&
)
=
delete
;
singly_linked_list
(
const
singly_linked_li
st
&
)
=
delete
;
singly_linked_list
&
operator
=
(
const
singly_linked_li
st
&
)
=
delete
;
public:
...
...
@@ -57,7 +57,7 @@ class singly_linked_list
typedef
size_t
size_type
;
typedef
ptrdiff_t
difference_type
;
typedef
value_type
&
reference
;
typedef
value_type
const
&
const_reference
;
typedef
const
value_type
&
const_reference
;
typedef
value_type
*
pointer
;
typedef
value_type
const
*
const_pointer
;
...
...
@@ -87,7 +87,7 @@ class singly_linked_list
/**
* @brief Creates a list from given [first, last] range.
*/
static
singly_linked_list
from
(
std
::
pair
<
pointer
,
pointer
>
const
&
p
)
static
singly_linked_list
from
(
const
std
::
pair
<
pointer
,
pointer
>
&
p
)
{
singly_linked_list
result
;
result
.
m_head
.
next
=
p
.
first
;
...
...
@@ -381,9 +381,9 @@ class singly_linked_list
/**
* @brief Removes all elements that are equal to @p value.
*/
void
remove
(
value_type
const
&
value
)
void
remove
(
const
value_type
&
value
)
{
remove_if
([
&
](
value_type
const
&
other
)
{
return
value
==
other
;
});
remove_if
([
&
](
const
value_type
&
other
)
{
return
value
==
other
;
});
}
private:
...
...
cppa/intrusive_ptr.hpp
View file @
54f080df
...
...
@@ -43,9 +43,10 @@ namespace cppa {
template
<
class
From
,
class
To
>
struct
convertible
{
constexpr
convertible
()
{
}
To
convert
()
const
{
return
static_cast
<
From
const
*>
(
this
)
->
do_convert
();
return
static_cast
<
const
From
*>
(
this
)
->
do_convert
();
}
};
...
...
@@ -54,7 +55,7 @@ struct convertible
* @relates ref_counted
*/
template
<
typename
T
>
class
intrusive_ptr
:
util
::
comparable
<
intrusive_ptr
<
T
>
,
T
const
*>
,
class
intrusive_ptr
:
util
::
comparable
<
intrusive_ptr
<
T
>
,
const
T
*>
,
util
::
comparable
<
intrusive_ptr
<
T
>>
{
...
...
@@ -72,19 +73,19 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, T const*>,
intrusive_ptr
(
T
*
raw_ptr
)
{
set_ptr
(
raw_ptr
);
}
intrusive_ptr
(
intrusive_ptr
const
&
other
)
{
set_ptr
(
other
.
m_ptr
);
}
intrusive_ptr
(
const
intrusive_ptr
&
other
)
{
set_ptr
(
other
.
m_ptr
);
}
intrusive_ptr
(
intrusive_ptr
&&
other
)
:
m_ptr
(
other
.
take
())
{
}
// enables "actor_ptr s = self"
template
<
typename
From
>
intrusive_ptr
(
con
vertible
<
From
,
T
*>
const
&
from
)
intrusive_ptr
(
con
st
convertible
<
From
,
T
*>
&
from
)
{
set_ptr
(
from
.
convert
());
}
template
<
typename
Y
>
intrusive_ptr
(
intrusive_ptr
<
Y
>
const
&
other
)
intrusive_ptr
(
const
intrusive_ptr
<
Y
>
&
other
)
{
static_assert
(
std
::
is_convertible
<
Y
*
,
T
*>::
value
,
"Y* is not assignable to T*"
);
...
...
@@ -108,7 +109,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, T const*>,
inline
T
*
get
()
{
return
m_ptr
;
}
inline
T
const
*
get
()
const
{
return
m_ptr
;
}
inline
const
T
*
get
()
const
{
return
m_ptr
;
}
T
*
take
()
{
...
...
@@ -134,7 +135,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, T const*>,
return
*
this
;
}
intrusive_ptr
&
operator
=
(
intrusive_ptr
const
&
other
)
intrusive_ptr
&
operator
=
(
const
intrusive_ptr
&
other
)
{
intrusive_ptr
tmp
(
other
);
swap
(
tmp
);
...
...
@@ -149,7 +150,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, T const*>,
}
template
<
typename
Y
>
intrusive_ptr
&
operator
=
(
intrusive_ptr
<
Y
>
const
&
other
)
intrusive_ptr
&
operator
=
(
const
intrusive_ptr
<
Y
>
&
other
)
{
static_assert
(
std
::
is_convertible
<
Y
*
,
T
*>::
value
,
"Y* is not assignable to T*"
);
...
...
@@ -179,18 +180,18 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, T const*>,
inline
T
*
operator
->
()
{
return
m_ptr
;
}
inline
T
const
&
operator
*
()
const
{
return
*
m_ptr
;
}
inline
const
T
&
operator
*
()
const
{
return
*
m_ptr
;
}
inline
T
const
*
operator
->
()
const
{
return
m_ptr
;
}
inline
const
T
*
operator
->
()
const
{
return
m_ptr
;
}
inline
explicit
operator
bool
()
const
{
return
m_ptr
!=
nullptr
;
}
inline
ptrdiff_t
compare
(
T
const
*
ptr
)
const
inline
ptrdiff_t
compare
(
const
T
*
ptr
)
const
{
return
static_cast
<
ptrdiff_t
>
(
get
()
-
ptr
);
}
inline
ptrdiff_t
compare
(
intrusive_ptr
const
&
other
)
const
inline
ptrdiff_t
compare
(
const
intrusive_ptr
&
other
)
const
{
return
compare
(
other
.
get
());
}
...
...
@@ -210,25 +211,25 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, T const*>,
};
template
<
typename
X
>
inline
bool
operator
==
(
intrusive_ptr
<
X
>
const
&
lhs
,
decltype
(
nullptr
))
inline
bool
operator
==
(
const
intrusive_ptr
<
X
>
&
lhs
,
decltype
(
nullptr
))
{
return
lhs
.
get
()
==
nullptr
;
}
template
<
typename
X
>
inline
bool
operator
==
(
decltype
(
nullptr
),
intrusive_ptr
<
X
>
const
&
rhs
)
inline
bool
operator
==
(
decltype
(
nullptr
),
const
intrusive_ptr
<
X
>
&
rhs
)
{
return
rhs
.
get
()
==
nullptr
;
}
template
<
typename
X
,
typename
Y
>
bool
operator
==
(
intrusive_ptr
<
X
>
const
&
lhs
,
intrusive_ptr
<
Y
>
const
&
rhs
)
bool
operator
==
(
const
intrusive_ptr
<
X
>&
lhs
,
const
intrusive_ptr
<
Y
>
&
rhs
)
{
return
lhs
.
get
()
==
rhs
.
get
();
}
template
<
typename
X
,
typename
Y
>
inline
bool
operator
!=
(
intrusive_ptr
<
X
>
const
&
lhs
,
intrusive_ptr
<
Y
>
const
&
rhs
)
inline
bool
operator
!=
(
const
intrusive_ptr
<
X
>&
lhs
,
const
intrusive_ptr
<
Y
>
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
...
...
cppa/match.hpp
View file @
54f080df
...
...
@@ -38,8 +38,8 @@ namespace cppa { namespace detail {
struct
match_helper
{
match_helper
(
match_helper
const
&
)
=
delete
;
match_helper
&
operator
=
(
match_helper
const
&
)
=
delete
;
match_helper
(
const
match_helper
&
)
=
delete
;
match_helper
&
operator
=
(
const
match_helper
&
)
=
delete
;
any_tuple
tup
;
match_helper
(
any_tuple
t
)
:
tup
(
std
::
move
(
t
))
{
}
match_helper
(
match_helper
&&
)
=
default
;
...
...
@@ -62,8 +62,8 @@ struct match_helper
template
<
typename
Iterator
>
struct
match_each_helper
{
match_each_helper
(
match_each_helper
const
&
)
=
delete
;
match_each_helper
&
operator
=
(
match_each_helper
const
&
)
=
delete
;
match_each_helper
(
const
match_each_helper
&
)
=
delete
;
match_each_helper
&
operator
=
(
const
match_each_helper
&
)
=
delete
;
Iterator
i
;
Iterator
e
;
match_each_helper
(
Iterator
first
,
Iterator
last
)
:
i
(
first
),
e
(
last
)
{
}
...
...
@@ -87,8 +87,8 @@ struct match_each_helper
template
<
class
Container
>
struct
copying_match_each_helper
{
copying_match_each_helper
(
co
pying_match_each_helper
const
&
)
=
delete
;
copying_match_each_helper
&
operator
=
(
co
pying_match_each_helper
const
&
)
=
delete
;
copying_match_each_helper
(
co
nst
copying_match_each_helper
&
)
=
delete
;
copying_match_each_helper
&
operator
=
(
co
nst
copying_match_each_helper
&
)
=
delete
;
Container
vec
;
copying_match_each_helper
(
Container
tmp
)
:
vec
(
std
::
move
(
tmp
))
{
}
copying_match_each_helper
(
copying_match_each_helper
&&
)
=
default
;
...
...
@@ -111,8 +111,8 @@ struct copying_match_each_helper
template
<
typename
Iterator
,
typename
Projection
>
struct
pmatch_each_helper
{
pmatch_each_helper
(
pmatch_each_helper
const
&
)
=
delete
;
pmatch_each_helper
&
operator
=
(
pmatch_each_helper
const
&
)
=
delete
;
pmatch_each_helper
(
const
pmatch_each_helper
&
)
=
delete
;
pmatch_each_helper
&
operator
=
(
const
pmatch_each_helper
&
)
=
delete
;
Iterator
i
;
Iterator
e
;
Projection
p
;
...
...
cppa/match_expr.hpp
View file @
54f080df
...
...
@@ -57,8 +57,8 @@ struct invoke_policy_impl
typedef
FilteredPattern
filtered_pattern
;
template
<
class
Tuple
>
static
bool
can_invoke
(
std
::
type_info
const
&
type_token
,
Tuple
const
&
tup
)
static
bool
can_invoke
(
const
std
::
type_info
&
type_token
,
const
Tuple
&
tup
)
{
typedef
typename
match_impl_from_type_list
<
Tuple
,
Pattern
>::
type
mimpl
;
return
type_token
==
typeid
(
filtered_pattern
)
||
mimpl
::
_
(
tup
);
...
...
@@ -66,7 +66,7 @@ struct invoke_policy_impl
template
<
class
Target
,
typename
PtrType
,
class
Tuple
>
static
bool
invoke
(
Target
&
target
,
std
::
type_info
const
&
type_token
,
const
std
::
type_info
&
type_token
,
detail
::
tuple_impl_info
,
PtrType
*
,
Tuple
&
tup
)
...
...
@@ -91,7 +91,7 @@ struct invoke_policy_impl
// ... we restore it here again
typedef
typename
util
::
if_else
<
std
::
is_const
<
Tuple
>
,
ttup_type
const
&
,
const
ttup_type
&
,
util
::
wrapped
<
ttup_type
&>
>::
type
ttup_ref
;
...
...
@@ -127,7 +127,7 @@ struct invoke_policy_impl<wildcard_position::nil,
template
<
class
Target
,
typename
PtrType
,
class
Tuple
>
static
bool
invoke
(
Target
&
target
,
std
::
type_info
const
&
,
const
std
::
type_info
&
,
detail
::
tuple_impl_info
,
PtrType
*
,
Tuple
&
tup
,
...
...
@@ -152,7 +152,7 @@ struct invoke_policy_impl<wildcard_position::nil,
template
<
class
Target
,
typename
PtrType
,
typename
Tuple
>
static
bool
invoke
(
Target
&
target
,
std
::
type_info
const
&
arg_types
,
const
std
::
type_info
&
arg_types
,
detail
::
tuple_impl_info
timpl
,
PtrType
*
native_arg
,
Tuple
&
tup
,
...
...
@@ -206,7 +206,7 @@ struct invoke_policy_impl<wildcard_position::nil,
// ... we restore it here again
typedef
typename
util
::
if_else
<
std
::
is_const
<
PtrType
>
,
ttup_type
const
&
,
const
ttup_type
&
,
util
::
wrapped
<
ttup_type
&>
>::
type
ttup_ref
;
...
...
@@ -215,7 +215,7 @@ struct invoke_policy_impl<wildcard_position::nil,
}
template
<
class
Tuple
>
static
bool
can_invoke
(
std
::
type_info
const
&
arg_types
,
Tuple
const
&
)
static
bool
can_invoke
(
const
std
::
type_info
&
arg_types
,
const
Tuple
&
)
{
return
arg_types
==
typeid
(
filtered_pattern
);
}
...
...
@@ -227,15 +227,15 @@ struct invoke_policy_impl<wildcard_position::leading,
util
::
type_list
<>
>
{
template
<
class
Tuple
>
static
inline
bool
can_invoke
(
std
::
type_info
const
&
,
Tuple
const
&
)
static
inline
bool
can_invoke
(
const
std
::
type_info
&
,
const
Tuple
&
)
{
return
true
;
}
template
<
class
Target
,
typename
PtrType
,
typename
Tuple
>
static
bool
invoke
(
Target
&
target
,
std
::
type_info
const
&
,
const
std
::
type_info
&
,
detail
::
tuple_impl_info
,
PtrType
*
,
Tuple
&
)
...
...
@@ -252,8 +252,8 @@ struct invoke_policy_impl<wildcard_position::trailing,
typedef
util
::
type_list
<
Ts
...
>
filtered_pattern
;
template
<
class
Tuple
>
static
bool
can_invoke
(
std
::
type_info
const
&
arg_types
,
Tuple
const
&
tup
)
static
bool
can_invoke
(
const
std
::
type_info
&
arg_types
,
const
Tuple
&
tup
)
{
if
(
arg_types
==
typeid
(
filtered_pattern
))
{
...
...
@@ -277,7 +277,7 @@ struct invoke_policy_impl<wildcard_position::trailing,
template
<
class
Target
,
typename
PtrType
,
class
Tuple
>
static
bool
invoke
(
Target
&
target
,
std
::
type_info
const
&
arg_types
,
const
std
::
type_info
&
arg_types
,
detail
::
tuple_impl_info
,
PtrType
*
,
Tuple
&
tup
)
...
...
@@ -290,7 +290,7 @@ struct invoke_policy_impl<wildcard_position::trailing,
// ensure const-correctness
typedef
typename
util
::
if_else
<
std
::
is_const
<
Tuple
>
,
ttup_type
const
&
,
const
ttup_type
&
,
util
::
wrapped
<
ttup_type
&>
>::
type
ttup_ref
;
...
...
@@ -307,8 +307,8 @@ struct invoke_policy_impl<wildcard_position::leading,
typedef
util
::
type_list
<
Ts
...
>
filtered_pattern
;
template
<
class
Tuple
>
static
bool
can_invoke
(
std
::
type_info
const
&
arg_types
,
Tuple
const
&
tup
)
static
bool
can_invoke
(
const
std
::
type_info
&
arg_types
,
const
Tuple
&
tup
)
{
if
(
arg_types
==
typeid
(
filtered_pattern
))
{
...
...
@@ -334,7 +334,7 @@ struct invoke_policy_impl<wildcard_position::leading,
template
<
class
Target
,
typename
PtrType
,
class
Tuple
>
static
bool
invoke
(
Target
&
target
,
std
::
type_info
const
&
arg_types
,
const
std
::
type_info
&
arg_types
,
detail
::
tuple_impl_info
,
PtrType
*
,
Tuple
&
tup
)
...
...
@@ -351,7 +351,7 @@ struct invoke_policy_impl<wildcard_position::leading,
// ensure const-correctness
typedef
typename
util
::
if_else
<
std
::
is_const
<
Tuple
>
,
ttup_type
const
&
,
const
ttup_type
&
,
util
::
wrapped
<
ttup_type
&>
>::
type
ttup_ref
;
...
...
@@ -518,13 +518,13 @@ struct pjf_same_pattern
template
<
typename
Data
>
struct
invoke_helper3
{
Data
const
&
data
;
invoke_helper3
(
Data
const
&
mdata
)
:
data
(
mdata
)
{
}
const
Data
&
data
;
invoke_helper3
(
const
Data
&
mdata
)
:
data
(
mdata
)
{
}
template
<
size_t
Pos
,
typename
T
,
typename
...
Args
>
inline
bool
operator
()(
util
::
type_pair
<
std
::
integral_constant
<
size_t
,
Pos
>
,
T
>
,
Args
&&
...
args
)
const
{
auto
const
&
target
=
get
<
Pos
>
(
data
);
const
auto
&
target
=
get
<
Pos
>
(
data
);
return
target
.
first
(
target
.
second
,
std
::
forward
<
Args
>
(
args
)...);
//return (get<Pos>(data))(args...);
}
...
...
@@ -535,8 +535,8 @@ struct invoke_helper2
{
typedef
Pattern
pattern_type
;
typedef
typename
util
::
tl_filter_not_type
<
pattern_type
,
anything
>::
type
arg_types
;
Data
const
&
data
;
invoke_helper2
(
Data
const
&
mdata
)
:
data
(
mdata
)
{
}
const
Data
&
data
;
invoke_helper2
(
const
Data
&
mdata
)
:
data
(
mdata
)
{
}
template
<
typename
...
Args
>
bool
invoke
(
Args
&&
...
args
)
const
{
...
...
@@ -558,9 +558,9 @@ struct invoke_helper2
template
<
typename
Data
>
struct
invoke_helper
{
Data
const
&
data
;
const
Data
&
data
;
std
::
uint64_t
bitfield
;
invoke_helper
(
Data
const
&
mdata
,
std
::
uint64_t
bits
)
:
data
(
mdata
),
bitfield
(
bits
)
{
}
invoke_helper
(
const
Data
&
mdata
,
std
::
uint64_t
bits
)
:
data
(
mdata
),
bitfield
(
bits
)
{
}
// token: type_list<type_pair<integral_constant<size_t, X>,
// std::pair<projection, tpartial_function>>,
// ...>
...
...
@@ -618,7 +618,7 @@ struct mexpr_fwd_
};
template
<
typename
T
>
struct
mexpr_fwd_
<
false
,
T
const
&
,
T
>
struct
mexpr_fwd_
<
false
,
const
T
&
,
T
>
{
typedef
std
::
reference_wrapper
<
const
T
>
type
;
};
...
...
@@ -680,12 +680,12 @@ class match_expr
init
();
}
match_expr
(
match_expr
const
&
other
)
:
m_cases
(
other
.
m_cases
)
match_expr
(
const
match_expr
&
other
)
:
m_cases
(
other
.
m_cases
)
{
init
();
}
bool
invoke
(
any_tuple
const
&
tup
)
bool
invoke
(
const
any_tuple
&
tup
)
{
return
_invoke
(
tup
);
}
...
...
@@ -712,7 +712,7 @@ class match_expr
return
tmp
!=
0
;
}
bool
operator
()(
any_tuple
const
&
tup
)
bool
operator
()(
const
any_tuple
&
tup
)
{
return
_invoke
(
tup
);
}
...
...
@@ -743,7 +743,7 @@ class match_expr
typedef
typename
util
::
if_else_c
<
has_manipulator
,
tuple_type
&
,
util
::
wrapped
<
tuple_type
const
&>
const
util
::
wrapped
<
tuple_type
&>
>::
type
ref_type
;
...
...
@@ -767,7 +767,7 @@ class match_expr
template
<
class
...
OtherCases
>
match_expr
<
Cases
...,
OtherCases
...
>
or_else
(
match_expr
<
OtherCases
...
>
const
&
other
)
const
or_else
(
const
match_expr
<
OtherCases
...
>
&
other
)
const
{
detail
::
tdata
<
ge_reference_wrapper
<
Cases
>
...,
ge_reference_wrapper
<
OtherCases
>
...
>
all_cases
;
...
...
@@ -775,7 +775,7 @@ class match_expr
return
{
all_cases
};
}
inline
detail
::
tdata
<
Cases
...
>
const
&
cases
()
const
inline
const
detail
::
tdata
<
Cases
...
>
&
cases
()
const
{
return
m_cases
;
}
...
...
@@ -784,16 +784,16 @@ class match_expr
{
match_expr
pfun
;
template
<
typename
Arg
>
pfun_impl
(
Arg
const
&
from
)
:
pfun
(
from
)
{
}
pfun_impl
(
const
Arg
&
from
)
:
pfun
(
from
)
{
}
bool
invoke
(
any_tuple
&
tup
)
{
return
pfun
.
invoke
(
tup
);
}
bool
invoke
(
any_tuple
const
&
tup
)
bool
invoke
(
const
any_tuple
&
tup
)
{
return
pfun
.
invoke
(
tup
);
}
bool
defined_at
(
any_tuple
const
&
tup
)
bool
defined_at
(
const
any_tuple
&
tup
)
{
return
pfun
.
can_invoke
(
tup
);
}
...
...
@@ -849,7 +849,7 @@ class match_expr
template
<
class
Tuple
>
std
::
uint64_t
get_cache_entry
(
std
::
type_info
const
*
type_token
,
Tuple
const
&
value
)
const
Tuple
&
value
)
{
CPPA_REQUIRE
(
type_token
!=
nullptr
);
if
(
value
.
impl_type
()
==
detail
::
dynamically_typed
)
...
...
@@ -916,7 +916,7 @@ class match_expr
&&
has_manipulator
==
false
>::
type
*
=
0
)
{
return
_invoke
(
static_cast
<
AnyTuple
const
&>
(
tup
));
return
_invoke
(
static_cast
<
const
AnyTuple
&>
(
tup
));
}
template
<
typename
AnyTuple
>
...
...
@@ -926,7 +926,7 @@ class match_expr
&&
has_manipulator
==
false
>::
type
*
=
0
)
{
auto
const
&
cvals
=
*
(
tup
.
cvals
());
const
auto
&
cvals
=
*
(
tup
.
cvals
());
return
_do_invoke
(
cvals
,
cvals
.
native_data
());
}
...
...
@@ -953,8 +953,8 @@ struct match_expr_from_type_list<util::type_list<Args...> >
};
template
<
typename
...
Lhs
,
typename
...
Rhs
>
inline
match_expr
<
Lhs
...,
Rhs
...
>
operator
,(
match_expr
<
Lhs
...
>
const
&
lhs
,
match_expr
<
Rhs
...
>
const
&
rhs
)
inline
match_expr
<
Lhs
...,
Rhs
...
>
operator
,(
const
match_expr
<
Lhs
...
>
&
lhs
,
const
match_expr
<
Rhs
...
>
&
rhs
)
{
return
lhs
.
or_else
(
rhs
);
}
...
...
@@ -966,7 +966,7 @@ typename match_expr_from_type_list<
typename
Args
::
cases_list
...
>::
type
>::
type
mexpr_concat
(
Arg0
const
&
arg0
,
Args
const
&
...
args
)
mexpr_concat
(
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
typename
detail
::
tdata_from_type_list
<
typename
util
::
tl_map
<
...
...
@@ -983,7 +983,7 @@ mexpr_concat(Arg0 const& arg0, Args const&... args)
}
template
<
typename
Arg0
,
typename
...
Args
>
partial_function
mexpr_concat_convert
(
Arg0
const
&
arg0
,
Args
const
&
...
args
)
partial_function
mexpr_concat_convert
(
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
typename
detail
::
tdata_from_type_list
<
typename
util
::
tl_map
<
...
...
cppa/object.hpp
View file @
54f080df
...
...
@@ -44,11 +44,11 @@ namespace cppa {
// forward declarations
class
object
;
bool
operator
==
(
object
const
&
lhs
,
object
cons
t
&
rhs
);
bool
operator
==
(
const
object
&
lhs
,
const
objec
t
&
rhs
);
class
uniform_type_info
;
uniform_type_info
const
*
uniform_typeid
(
std
::
type_info
const
&
);
bool
operator
==
(
uniform_type_info
const
&
lhs
,
std
::
type_info
const
&
rhs
);
uniform_type_info
const
*
uniform_typeid
(
const
std
::
type_info
&
);
bool
operator
==
(
const
uniform_type_info
&
lhs
,
const
std
::
type_info
&
rhs
);
/**
* @brief Grants mutable access to the stored value of @p obj.
...
...
@@ -68,7 +68,7 @@ T& get_ref(object& obj);
* @throws std::invalid_argument if <tt>obj.type() != typeid(T)</tt>
*/
template
<
typename
T
>
T
const
&
get
(
object
cons
t
&
obj
);
const
T
&
get
(
const
objec
t
&
obj
);
/**
* @brief An abstraction class that stores an instance of
...
...
@@ -77,7 +77,7 @@ T const& get(object const& obj);
class
object
{
friend
bool
operator
==
(
object
const
&
lhs
,
object
cons
t
&
rhs
);
friend
bool
operator
==
(
const
object
&
lhs
,
const
objec
t
&
rhs
);
public:
...
...
@@ -106,7 +106,7 @@ class object
* @brief Creates a (deep) copy of @p other.
* @post {*this == other}
*/
object
(
object
cons
t
&
other
);
object
(
const
objec
t
&
other
);
/**
* @brief Moves the content from @p other to this.
...
...
@@ -118,7 +118,7 @@ class object
* @brief Creates a (deep) copy of @p other and assigns it to @p this.
* @return @p *this
*/
object
&
operator
=
(
object
cons
t
&
other
);
object
&
operator
=
(
const
objec
t
&
other
);
/**
* @brief Gets the RTTI of this object.
...
...
@@ -130,7 +130,7 @@ class object
/**
* @brief Gets the stored value.
* @returns A const pointer to the currently stored value.
* @see get(
object cons
t&)
* @see get(
const objec
t&)
*/
void
const
*
value
()
const
;
...
...
@@ -169,7 +169,7 @@ object object::from(T&& what)
return
{
new
value_type
(
std
::
forward
<
T
>
(
what
)),
rtti
};
}
inline
bool
operator
!=
(
object
const
&
lhs
,
object
cons
t
&
rhs
)
inline
bool
operator
!=
(
const
object
&
lhs
,
const
objec
t
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
...
...
@@ -187,7 +187,7 @@ T& get_ref(object& obj)
}
template
<
typename
T
>
T
const
&
get
(
object
cons
t
&
obj
)
const
T
&
get
(
const
objec
t
&
obj
)
{
static_assert
(
!
std
::
is_pointer
<
T
>::
value
&&
!
std
::
is_reference
<
T
>::
value
,
"T is a reference or a pointer type."
);
...
...
cppa/on.hpp
View file @
54f080df
...
...
@@ -104,7 +104,7 @@ class behavior_rvalue_builder
public:
constexpr
behavior_rvalue_builder
(
util
::
duration
const
&
d
)
:
m_timeout
(
d
)
constexpr
behavior_rvalue_builder
(
const
util
::
duration
&
d
)
:
m_timeout
(
d
)
{
}
...
...
@@ -158,7 +158,7 @@ struct rvalue_builder
rvalue_builder
()
=
default
;
template
<
typename
...
Args
>
rvalue_builder
(
rvalue_builder_args_ctor
,
Args
const
&
...
args
)
rvalue_builder
(
rvalue_builder_args_ctor
,
const
Args
&
...
args
)
:
m_guard
(
args
...)
,
m_funs
(
args
...)
{
...
...
@@ -288,7 +288,7 @@ constexpr anything any_vals;
* {@link cppa::any_vals any_vals} and {@link cppa::arg_match arg_match}.
*/
template
<
typename
Arg0
,
typename
...
Args
>
___
on
(
Arg0
const
&
arg0
,
Args
const
&
...
args
);
___
on
(
const
Arg0
&
arg0
,
const
Args
&
...
args
);
/**
* @brief Left-hand side of a partial function expression that matches types.
...
...
@@ -340,7 +340,7 @@ detail::rvalue_builder<
>::
type
,
util
::
type_list
<
typename
detail
::
pattern_type
<
Arg0
>::
type
,
typename
detail
::
pattern_type
<
Args
>::
type
...
>
>
on
(
Arg0
const
&
arg0
,
Args
const
&
...
args
)
on
(
const
Arg0
&
arg0
,
const
Args
&
...
args
)
{
return
{
detail
::
rvalue_builder_args_ctor
{},
arg0
,
args
...};
}
...
...
@@ -381,7 +381,7 @@ decltype(on(A0, A1, A2, A3, val<Ts>()...)) on()
template
<
class
Rep
,
class
Period
>
constexpr
detail
::
behavior_rvalue_builder
after
(
std
::
chrono
::
duration
<
Rep
,
Period
>
const
&
d
)
after
(
const
std
::
chrono
::
duration
<
Rep
,
Period
>
&
d
)
{
return
{
util
::
duration
(
d
)
};
}
...
...
cppa/option.hpp
View file @
54f080df
...
...
@@ -63,7 +63,7 @@ class option
*/
option
(
T
value
)
:
m_valid
(
false
)
{
cr
(
std
::
move
(
value
));
}
option
(
option
const
&
other
)
:
m_valid
(
false
)
option
(
const
option
&
other
)
:
m_valid
(
false
)
{
if
(
other
.
m_valid
)
cr
(
other
.
m_value
);
}
...
...
@@ -75,7 +75,7 @@ class option
~
option
()
{
destroy
();
}
option
&
operator
=
(
option
const
&
other
)
option
&
operator
=
(
const
option
&
other
)
{
if
(
m_valid
)
{
...
...
@@ -103,7 +103,7 @@ class option
return
*
this
;
}
option
&
operator
=
(
T
const
&
value
)
option
&
operator
=
(
const
T
&
value
)
{
if
(
m_valid
)
m_value
=
value
;
else
cr
(
value
);
...
...
@@ -147,7 +147,7 @@ class option
/**
* @brief Returns the value.
*/
inline
T
const
&
operator
*
()
const
inline
const
T
&
operator
*
()
const
{
CPPA_REQUIRE
(
valid
());
return
m_value
;
...
...
@@ -165,7 +165,7 @@ class option
/**
* @brief Returns the value.
*/
inline
T
const
&
get
()
const
inline
const
T
&
get
()
const
{
CPPA_REQUIRE
(
valid
());
return
m_value
;
...
...
@@ -208,7 +208,7 @@ class option
/** @relates option */
template
<
typename
T
,
typename
U
>
bool
operator
==
(
option
<
T
>
const
&
lhs
,
option
<
U
>
const
&
rhs
)
bool
operator
==
(
const
option
<
T
>&
lhs
,
const
option
<
U
>
&
rhs
)
{
if
((
lhs
)
&&
(
rhs
))
return
*
lhs
==
*
rhs
;
return
false
;
...
...
@@ -216,7 +216,7 @@ bool operator==(option<T> const& lhs, option<U> const& rhs)
/** @relates option */
template
<
typename
T
,
typename
U
>
bool
operator
==
(
option
<
T
>
const
&
lhs
,
U
const
&
rhs
)
bool
operator
==
(
const
option
<
T
>&
lhs
,
const
U
&
rhs
)
{
if
(
lhs
)
return
*
lhs
==
rhs
;
return
false
;
...
...
@@ -224,28 +224,28 @@ bool operator==(option<T> const& lhs, U const& rhs)
/** @relates option */
template
<
typename
T
,
typename
U
>
bool
operator
==
(
T
const
&
lhs
,
option
<
U
>
const
&
rhs
)
bool
operator
==
(
const
T
&
lhs
,
const
option
<
U
>
&
rhs
)
{
return
rhs
==
lhs
;
}
/** @relates option */
template
<
typename
T
,
typename
U
>
bool
operator
!=
(
option
<
T
>
const
&
lhs
,
option
<
U
>
const
&
rhs
)
bool
operator
!=
(
const
option
<
T
>&
lhs
,
const
option
<
U
>
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
/** @relates option */
template
<
typename
T
,
typename
U
>
bool
operator
!=
(
option
<
T
>
const
&
lhs
,
U
const
&
rhs
)
bool
operator
!=
(
const
option
<
T
>&
lhs
,
const
U
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
/** @relates option */
template
<
typename
T
,
typename
U
>
bool
operator
!=
(
T
const
&
lhs
,
option
<
U
>
const
&
rhs
)
bool
operator
!=
(
const
T
&
lhs
,
const
option
<
U
>
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
...
...
cppa/partial_function.hpp
View file @
54f080df
...
...
@@ -50,8 +50,8 @@ class behavior;
class
partial_function
{
partial_function
(
partial_function
const
&
)
=
delete
;
partial_function
&
operator
=
(
partial_function
const
&
)
=
delete
;
partial_function
(
const
partial_function
&
)
=
delete
;
partial_function
&
operator
=
(
const
partial_function
&
)
=
delete
;
public:
...
...
@@ -59,8 +59,8 @@ class partial_function
{
virtual
~
impl
();
virtual
bool
invoke
(
any_tuple
&
)
=
0
;
virtual
bool
invoke
(
any_tuple
const
&
)
=
0
;
virtual
bool
defined_at
(
any_tuple
const
&
)
=
0
;
virtual
bool
invoke
(
const
any_tuple
&
)
=
0
;
virtual
bool
defined_at
(
const
any_tuple
&
)
=
0
;
};
typedef
std
::
unique_ptr
<
impl
>
impl_ptr
;
...
...
@@ -71,7 +71,7 @@ class partial_function
partial_function
(
impl_ptr
&&
ptr
);
inline
bool
defined_at
(
any_tuple
const
&
value
)
inline
bool
defined_at
(
const
any_tuple
&
value
)
{
return
((
m_impl
)
&&
m_impl
->
defined_at
(
value
));
}
...
...
@@ -81,7 +81,7 @@ class partial_function
return
((
m_impl
)
&&
m_impl
->
invoke
(
value
));
}
inline
bool
operator
()(
any_tuple
const
&
value
)
inline
bool
operator
()(
const
any_tuple
&
value
)
{
return
((
m_impl
)
&&
m_impl
->
invoke
(
value
));
}
...
...
cppa/pattern.hpp
View file @
54f080df
...
...
@@ -87,32 +87,32 @@ struct value_matcher
const
bool
is_dummy
;
inline
value_matcher
(
bool
dummy_impl
=
false
)
:
is_dummy
(
dummy_impl
)
{
}
virtual
~
value_matcher
();
virtual
bool
operator
()(
any_tuple
const
&
)
const
=
0
;
virtual
bool
operator
()(
const
any_tuple
&
)
const
=
0
;
};
struct
dummy_matcher
:
value_matcher
{
inline
dummy_matcher
()
:
value_matcher
(
true
)
{
}
bool
operator
()(
any_tuple
const
&
)
const
;
bool
operator
()(
const
any_tuple
&
)
const
;
};
struct
cmp_helper
{
size_t
i
;
any_tuple
const
&
tup
;
cmp_helper
(
any_tuple
const
&
tp
,
size_t
pos
=
0
)
:
i
(
pos
),
tup
(
tp
)
{
}
const
any_tuple
&
tup
;
cmp_helper
(
const
any_tuple
&
tp
,
size_t
pos
=
0
)
:
i
(
pos
),
tup
(
tp
)
{
}
template
<
typename
T
>
inline
bool
operator
()(
T
const
&
what
)
inline
bool
operator
()(
const
T
&
what
)
{
return
what
==
tup
.
get_as
<
T
>
(
i
++
);
}
template
<
typename
T
>
inline
bool
operator
()(
std
::
unique_ptr
<
util
::
guard
<
T
>
>
const
&
g
)
inline
bool
operator
()(
std
::
unique_ptr
<
util
::
guard
<
T
>
const
>
&
g
)
{
return
(
*
g
)(
tup
.
get_as
<
T
>
(
i
++
));
}
template
<
typename
T
>
inline
bool
operator
()(
util
::
wrapped
<
T
>
const
&
)
inline
bool
operator
()(
const
util
::
wrapped
<
T
>
&
)
{
++
i
;
return
true
;
...
...
@@ -135,7 +135,7 @@ class value_matcher_impl<wildcard_position::nil,
template
<
typename
...
Args
>
value_matcher_impl
(
Args
&&
...
args
)
:
m_values
(
std
::
forward
<
Args
>
(
args
)...)
{
}
bool
operator
()(
any_tuple
const
&
tup
)
const
bool
operator
()(
const
any_tuple
&
tup
)
const
{
cmp_helper
h
{
tup
};
return
util
::
static_foreach
<
0
,
sizeof
...(
Vs
)
>::
eval
(
m_values
,
h
);
...
...
@@ -177,7 +177,7 @@ class value_matcher_impl<wildcard_position::leading,
template
<
typename
...
Args
>
value_matcher_impl
(
Args
&&
...
args
)
:
m_values
(
std
::
forward
<
Args
>
(
args
)...)
{
}
bool
operator
()(
any_tuple
const
&
tup
)
const
bool
operator
()(
const
any_tuple
&
tup
)
const
{
cmp_helper
h
{
tup
,
tup
.
size
()
-
sizeof
...(
Ts
)};
return
util
::
static_foreach
<
0
,
sizeof
...(
Vs
)
>::
eval
(
m_values
,
h
);
...
...
@@ -198,7 +198,7 @@ class value_matcher_impl<wildcard_position::in_between,
template
<
typename
...
Args
>
value_matcher_impl
(
Args
&&
...
args
)
:
m_values
(
std
::
forward
<
Args
>
(
args
)...)
{
}
bool
operator
()(
any_tuple
const
&
tup
)
const
bool
operator
()(
const
any_tuple
&
tup
)
const
{
static
constexpr
size_t
wcpos
=
static_cast
<
size_t
>
(
util
::
tl_find
<
util
::
type_list
<
Ts
...
>
,
anything
>::
value
);
...
...
@@ -225,7 +225,7 @@ class value_matcher_impl<wildcard_position::multiple,
template
<
typename
...
Args
>
value_matcher_impl
(
Args
&&
...)
{
}
bool
operator
()(
any_tuple
const
&
)
const
bool
operator
()(
const
any_tuple
&
)
const
{
throw
std
::
runtime_error
(
"not implemented yet, sorry"
);
}
...
...
@@ -238,8 +238,8 @@ class pattern
static_assert
(
sizeof
...(
Types
)
>
0
,
"empty pattern"
);
pattern
(
pattern
const
&
)
=
delete
;
pattern
&
operator
=
(
pattern
const
&
)
=
delete
;
pattern
(
const
pattern
&
)
=
delete
;
pattern
&
operator
=
(
const
pattern
&
)
=
delete
;
public:
...
...
@@ -286,7 +286,7 @@ class pattern
inline
bool
has_values
()
const
{
return
m_vm
->
is_dummy
==
false
;
}
// @warning does NOT check types
bool
_matches_values
(
any_tuple
const
&
tup
)
const
bool
_matches_values
(
const
any_tuple
&
tup
)
const
{
return
(
*
m_vm
)(
tup
);
}
...
...
@@ -302,13 +302,13 @@ class pattern
}
template
<
typename
...
Args
>
pattern
(
util
::
wrapped
<
head_type
>
const
&
arg0
,
Args
&&
...
args
)
pattern
(
const
util
::
wrapped
<
head_type
>
&
arg0
,
Args
&&
...
args
)
:
m_vm
(
get_value_matcher
(
arg0
,
std
::
forward
<
Args
>
(
args
)...))
{
}
template
<
typename
...
Args
>
pattern
(
detail
::
tdata
<
Args
...
>
const
&
data
)
pattern
(
const
detail
::
tdata
<
Args
...
>
&
data
)
{
m_vm
.
reset
(
new
value_matcher_impl
<
wildcard_pos
,
types
,
util
::
type_list
<
Args
...
>
>
{
data
});
}
...
...
@@ -354,7 +354,7 @@ class pattern
init_helper
(
tvp_array
&
ptrs
,
detail
::
types_array
<
Types
...
>&
tarr
)
:
i
(
0
),
m_ptrs
(
ptrs
),
m_arr
(
tarr
)
{
}
template
<
typename
T
>
inline
void
operator
()(
option
<
T
>
const
&
what
)
inline
void
operator
()(
const
option
<
T
>
&
what
)
{
m_ptrs
[
i
].
first
=
m_arr
[
i
];
m_ptrs
[
i
].
second
=
(
what
)
?
&
(
*
what
)
:
nullptr
;
...
...
cppa/primitive_variant.hpp
View file @
54f080df
...
...
@@ -62,7 +62,7 @@ namespace cppa {
class
primitive_variant
;
template
<
typename
T
>
T
const
&
get
(
primitive_variant
cons
t
&
pv
);
const
T
&
get
(
const
primitive_varian
t
&
pv
);
template
<
typename
T
>
T
&
get_ref
(
primitive_variant
&
pv
);
...
...
@@ -74,11 +74,11 @@ T& get_ref(primitive_variant& pv);
class
primitive_variant
{
friend
bool
operator
==
(
primitive_variant
cons
t
&
lhs
,
primitive_variant
cons
t
&
rhs
);
friend
bool
operator
==
(
const
primitive_varian
t
&
lhs
,
const
primitive_varian
t
&
rhs
);
template
<
typename
T
>
friend
T
const
&
get
(
primitive_variant
cons
t
&
pv
);
friend
const
T
&
get
(
const
primitive_varian
t
&
pv
);
template
<
typename
T
>
friend
T
&
get_ref
(
primitive_variant
&
pv
);
...
...
@@ -213,7 +213,7 @@ class primitive_variant
* @brief Creates a copy from @p other.
* @param other A primitive variant.
*/
primitive_variant
(
primitive_variant
cons
t
&
other
);
primitive_variant
(
const
primitive_varian
t
&
other
);
/**
* @brief Creates a new variant and move the value from @p other to it.
...
...
@@ -251,7 +251,7 @@ class primitive_variant
* @param other A primitive variant.
* @returns <tt>*this</tt>.
*/
primitive_variant
&
operator
=
(
primitive_variant
cons
t
&
other
);
primitive_variant
&
operator
=
(
const
primitive_varian
t
&
other
);
/**
* @brief Moves the content of @p other to @p this.
...
...
@@ -272,7 +272,7 @@ class primitive_variant
* otherwise typeid(T) is returned, where T is the C++ type
* of @p this.
*/
std
::
type_info
const
&
type
()
const
;
const
std
::
type_info
&
type
()
const
;
~
primitive_variant
();
...
...
@@ -287,7 +287,7 @@ class primitive_variant
* @throws std::logic_error if @p pv is not of type @p T.
*/
template
<
typename
T
>
T
const
&
get
(
primitive_variant
cons
t
&
pv
)
const
T
&
get
(
const
primitive_varian
t
&
pv
)
{
static
const
primitive_type
ptype
=
detail
::
type_to_ptype
<
T
>::
ptype
;
return
pv
.
get_as
<
ptype
>
();
...
...
@@ -319,7 +319,7 @@ T& get_ref(primitive_variant& pv)
* @returns A const reference to the value of @p pv of type @p T.
*/
template
<
primitive_type
PT
>
T
const
&
get_ref
(
primitive_variant
cons
t
&
pv
);
const
T
&
get_ref
(
const
primitive_varian
t
&
pv
);
/**
* @ingroup TypeSystem
...
...
@@ -336,7 +336,7 @@ T& get_ref(primitive_variant& pv);
template
<
primitive_type
PT
>
inline
const
typename
detail
::
ptype_to_type
<
PT
>::
type
&
get
(
primitive_variant
cons
t
&
pv
)
get
(
const
primitive_varian
t
&
pv
)
{
static_assert
(
PT
!=
pt_null
,
"PT == pt_null"
);
return
get
<
typename
detail
::
ptype_to_type
<
PT
>::
type
>
(
pv
);
...
...
@@ -352,17 +352,17 @@ get_ref(primitive_variant& pv)
#endif
bool
operator
==
(
primitive_variant
const
&
lhs
,
primitive_variant
cons
t
&
rhs
);
bool
operator
==
(
const
primitive_variant
&
lhs
,
const
primitive_varian
t
&
rhs
);
inline
bool
operator
!=
(
primitive_variant
const
&
lhs
,
primitive_variant
cons
t
&
rhs
)
bool
operator
!=
(
const
primitive_variant
&
lhs
,
const
primitive_varian
t
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
template
<
typename
T
>
typename
std
::
enable_if
<
util
::
is_primitive
<
T
>::
value
,
bool
>::
type
operator
==
(
T
const
&
lhs
,
primitive_variant
cons
t
&
rhs
)
operator
==
(
const
T
&
lhs
,
const
primitive_varian
t
&
rhs
)
{
static
constexpr
primitive_type
ptype
=
detail
::
type_to_ptype
<
T
>::
ptype
;
static_assert
(
ptype
!=
pt_null
,
"T is an incompatible type"
);
...
...
@@ -371,21 +371,21 @@ operator==(T const& lhs, primitive_variant const& rhs)
template
<
typename
T
>
typename
std
::
enable_if
<
util
::
is_primitive
<
T
>::
value
,
bool
>::
type
operator
==
(
primitive_variant
const
&
lhs
,
T
const
&
rhs
)
operator
==
(
const
primitive_variant
&
lhs
,
const
T
&
rhs
)
{
return
(
rhs
==
lhs
);
}
template
<
typename
T
>
typename
std
::
enable_if
<
util
::
is_primitive
<
T
>::
value
,
bool
>::
type
operator
!=
(
primitive_variant
const
&
lhs
,
T
const
&
rhs
)
operator
!=
(
const
primitive_variant
&
lhs
,
const
T
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
template
<
typename
T
>
typename
std
::
enable_if
<
util
::
is_primitive
<
T
>::
value
,
bool
>::
type
operator
!=
(
T
const
&
lhs
,
primitive_variant
cons
t
&
rhs
)
operator
!=
(
const
T
&
lhs
,
const
primitive_varian
t
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
...
...
cppa/process_information.hpp
View file @
54f080df
...
...
@@ -65,21 +65,21 @@ class process_information : public ref_counted,
/**
* @brief Copy constructor.
*/
process_information
(
process_information
const
&
);
process_information
(
const
process_information
&
);
/**
* @brief Creates @c this from @p process_id and @p hash.
* @param process_id System-wide unique process identifier.
* @param hash Unique node id as hexadecimal string representation.
*/
process_information
(
std
::
uint32_t
process_id
,
std
::
string
const
&
hash
);
process_information
(
std
::
uint32_t
process_id
,
const
std
::
string
&
hash
);
/**
* @brief Creates @c this from @p process_id and @p hash.
* @param process_id System-wide unique process identifier.
* @param hash Unique node id.
*/
process_information
(
std
::
uint32_t
process_id
,
node_id_type
const
&
node_id
);
process_information
(
std
::
uint32_t
process_id
,
const
node_id_type
&
node_id
);
/**
* @brief Identifies the running process.
...
...
@@ -92,16 +92,16 @@ class process_information : public ref_counted,
* @returns A hash build from the MAC address of the first network device
* and the UUID of the root partition (mounted in "/" or "C:").
*/
inline
node_id_type
const
&
node_id
()
const
{
return
m_node_id
;
}
inline
const
node_id_type
&
node_id
()
const
{
return
m_node_id
;
}
/**
* @brief Returns the proccess_information for the running process.
* @returns A pointer to the singleton of this process.
*/
static
intrusive_ptr
<
process_information
>
const
&
get
();
static
const
intrusive_ptr
<
process_information
>
&
get
();
// "inherited" from comparable<process_information>
int
compare
(
process_information
const
&
other
)
const
;
int
compare
(
const
process_information
&
other
)
const
;
private:
...
...
@@ -110,19 +110,19 @@ class process_information : public ref_counted,
};
void
node_id_from_string
(
std
::
string
const
&
hash
,
void
node_id_from_string
(
const
std
::
string
&
hash
,
process_information
::
node_id_type
&
node_id
);
bool
equal
(
std
::
string
const
&
hash
,
process_information
::
node_id_type
const
&
node_id
);
bool
equal
(
const
std
::
string
&
hash
,
const
process_information
::
node_id_type
&
node_id
);
inline
bool
equal
(
process_information
::
node_id_type
const
&
node_id
,
std
::
string
const
&
hash
)
inline
bool
equal
(
const
process_information
::
node_id_type
&
node_id
,
const
std
::
string
&
hash
)
{
return
equal
(
hash
,
node_id
);
}
std
::
string
to_string
(
process_information
const
&
what
);
std
::
string
to_string
(
const
process_information
&
what
);
/**
* @brief Converts a {@link process_information::node_id_type node_id}
...
...
@@ -130,7 +130,7 @@ std::string to_string(process_information const& what);
* @param node_id A unique node identifier.
* @returns A hexadecimal representation of @p node_id.
*/
std
::
string
to_string
(
process_information
::
node_id_type
const
&
node_id
);
std
::
string
to_string
(
const
process_information
::
node_id_type
&
node_id
);
/**
* @brief A smart pointer type that manages instances of
...
...
cppa/receive.hpp
View file @
54f080df
...
...
@@ -93,7 +93,7 @@ auto receive_while(Statement&& stmt);
* @returns A functor implementing the loop.
*/
template
<
typename
T
>
auto
receive_for
(
T
&
begin
,
T
const
&
end
);
auto
receive_for
(
T
&
begin
,
const
T
&
end
);
/**
* @brief Receives messages until @p stmt returns true.
...
...
@@ -142,7 +142,7 @@ void receive_loop(Arg0&& arg0, Args&&... args)
}
template
<
typename
T
>
detail
::
receive_for_helper
<
T
>
receive_for
(
T
&
begin
,
T
const
&
end
)
detail
::
receive_for_helper
<
T
>
receive_for
(
T
&
begin
,
const
T
&
end
)
{
return
{
begin
,
end
};
}
...
...
cppa/scheduler.hpp
View file @
54f080df
...
...
@@ -116,8 +116,8 @@ class scheduler
virtual
attachable
*
register_hidden_context
();
template
<
typename
Duration
,
typename
...
Data
>
void
future_send
(
actor_ptr
const
&
to
,
Duration
const
&
rel_time
,
Data
const
&
...
data
)
void
future_send
(
const
actor_ptr
&
to
,
const
Duration
&
rel_time
,
const
Data
&
...
data
)
{
static_assert
(
sizeof
...(
Data
)
>
0
,
"no message to send"
);
any_tuple
data_tup
=
make_cow_tuple
(
data
...);
...
...
cppa/self.hpp
View file @
54f080df
...
...
@@ -60,8 +60,8 @@ class self_type : public convertible<self_type, actor*>
static
actor
*
convert_impl
();
self_type
(
self_type
const
&
)
=
delete
;
self_type
&
operator
=
(
self_type
const
&
)
=
delete
;
self_type
(
const
self_type
&
)
=
delete
;
self_type
&
operator
=
(
const
self_type
&
)
=
delete
;
public:
...
...
cppa/serializer.hpp
View file @
54f080df
...
...
@@ -49,8 +49,8 @@ class primitive_variant;
class
serializer
{
serializer
(
serializer
const
&
)
=
delete
;
serializer
&
operator
=
(
serializer
const
&
)
=
delete
;
serializer
(
const
serializer
&
)
=
delete
;
serializer
&
operator
=
(
const
serializer
&
)
=
delete
;
public:
...
...
@@ -63,7 +63,7 @@ class serializer
* named @p type_name.
* @param type_name The platform-independent @p libcppa type name.
*/
virtual
void
begin_object
(
std
::
string
const
&
type_name
)
=
0
;
virtual
void
begin_object
(
const
std
::
string
&
type_name
)
=
0
;
/**
* @brief Ends serialization of an object.
...
...
@@ -84,7 +84,7 @@ class serializer
* @brief Writes a single value to the data sink.
* @param value A primitive data value.
*/
virtual
void
write_value
(
primitive_variant
cons
t
&
value
)
=
0
;
virtual
void
write_value
(
const
primitive_varian
t
&
value
)
=
0
;
/**
* @brief Writes @p num values as a tuple to the data sink.
...
...
@@ -96,7 +96,7 @@ class serializer
};
template
<
typename
T
>
serializer
&
operator
<<
(
serializer
&
s
,
T
const
&
what
)
serializer
&
operator
<<
(
serializer
&
s
,
const
T
&
what
)
{
auto
mtype
=
uniform_typeid
<
T
>
();
if
(
mtype
==
nullptr
)
...
...
cppa/to_string.hpp
View file @
54f080df
...
...
@@ -48,7 +48,7 @@ std::string to_string_impl(void const* what, uniform_type_info const* utype);
* @returns A string representation of @p what.
*/
template
<
typename
T
>
std
::
string
to_string
(
T
const
&
what
)
std
::
string
to_string
(
const
T
&
what
)
{
auto
utype
=
uniform_typeid
<
T
>
();
if
(
utype
==
nullptr
)
...
...
cppa/tpartial_function.hpp
View file @
54f080df
...
...
@@ -76,9 +76,9 @@ class tpartial_function
{
}
tpartial_function
(
tpartial_function
const
&
)
=
default
;
tpartial_function
(
const
tpartial_function
&
)
=
default
;
//bool defined_at(
typename util::rm_ref<Args>::type const
&... args) const
//bool defined_at(
const typename util::rm_ref<Args>::type
&... args) const
bool
defined_at
(
Args
...
args
)
const
{
return
m_guard
(
args
...);
...
...
@@ -126,7 +126,7 @@ struct get_tpartial_function<Expr, Guard,
typename
ctrait
::
arg_types
,
sizeof
...(
Args
)
>::
type
,
util
::
type_list
<
Args
const
&
...
>
,
util
::
type_list
<
const
Args
&
...
>
,
util
::
left_or_right
>::
type
,
typename
ctrait
::
result_type
,
...
...
cppa/tuple_cast.hpp
View file @
54f080df
...
...
@@ -46,7 +46,7 @@ namespace cppa {
* of @p tup on success.
*/
template
<
typename
...
T
>
auto
moving_tuple_cast
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
p
)
auto
moving_tuple_cast
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
p
)
->
option
<
typename
cow_tuple_from_type_list
<
typename
pattern
<
T
...
>::
filtered_types
...
...
@@ -79,7 +79,7 @@ auto moving_tuple_cast(any_tuple& tup)
}
template
<
typename
...
T
>
auto
moving_tuple_cast
(
any_tuple
&
tup
,
util
::
type_list
<
T
...
>
const
&
)
auto
moving_tuple_cast
(
any_tuple
&
tup
,
const
util
::
type_list
<
T
...
>
&
)
->
decltype
(
moving_tuple_cast
<
T
...
>
(
tup
))
{
return
moving_tuple_cast
<
T
...
>
(
tup
);
...
...
@@ -89,7 +89,7 @@ auto moving_tuple_cast(any_tuple& tup, util::type_list<T...> const&)
* @brief Tries to cast @p tup to {@link tuple tuple<T...>}.
*/
template
<
typename
...
T
>
auto
tuple_cast
(
any_tuple
tup
,
pattern
<
T
...
>
const
&
p
)
auto
tuple_cast
(
any_tuple
tup
,
const
pattern
<
T
...
>
&
p
)
->
option
<
typename
cow_tuple_from_type_list
<
typename
pattern
<
T
...
>::
filtered_types
...
...
@@ -113,7 +113,7 @@ auto tuple_cast(any_tuple tup)
}
template
<
typename
...
T
>
auto
tuple_cast
(
any_tuple
tup
,
util
::
type_list
<
T
...
>
const
&
)
auto
tuple_cast
(
any_tuple
tup
,
const
util
::
type_list
<
T
...
>
&
)
->
decltype
(
tuple_cast
<
T
...
>
(
tup
))
{
return
moving_tuple_cast
<
T
...
>
(
tup
);
...
...
@@ -123,7 +123,7 @@ auto tuple_cast(any_tuple tup, util::type_list<T...> const&)
// (moving) cast using a pattern; does not perform type checking
template
<
typename
...
T
>
auto
unsafe_tuple_cast
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
p
)
auto
unsafe_tuple_cast
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
p
)
->
option
<
typename
cow_tuple_from_type_list
<
typename
pattern
<
T
...
>::
filtered_types
...
...
@@ -137,7 +137,7 @@ auto unsafe_tuple_cast(any_tuple& tup, pattern<T...> const& p)
}
template
<
typename
...
T
>
auto
unsafe_tuple_cast
(
any_tuple
&
tup
,
util
::
type_list
<
T
...
>
const
&
)
auto
unsafe_tuple_cast
(
any_tuple
&
tup
,
const
util
::
type_list
<
T
...
>
&
)
->
decltype
(
tuple_cast
<
T
...
>
(
tup
))
{
return
tuple_cast
<
T
...
>
(
tup
);
...
...
@@ -145,7 +145,7 @@ auto unsafe_tuple_cast(any_tuple& tup, util::type_list<T...> const&)
// cast using a pattern; does neither perform type checking nor checks values
template
<
typename
...
T
>
auto
forced_tuple_cast
(
any_tuple
&
tup
,
pattern
<
T
...
>
const
&
p
)
auto
forced_tuple_cast
(
any_tuple
&
tup
,
const
pattern
<
T
...
>
&
p
)
->
typename
cow_tuple_from_type_list
<
typename
pattern
<
T
...
>::
filtered_types
>::
type
...
...
cppa/type_value_pair.hpp
View file @
54f080df
...
...
@@ -49,18 +49,18 @@ class type_value_pair_const_iterator
typedef
type_value_pair
const
value_type
;
typedef
std
::
ptrdiff_t
difference_type
;
typedef
type_value_pair
const
*
pointer
;
typedef
type_value_pair
const
&
reference
;
typedef
const
type_value_pair
&
reference
;
typedef
std
::
bidirectional_iterator_tag
iterator_category
;
constexpr
type_value_pair_const_iterator
()
:
iter
(
nullptr
)
{
}
type_value_pair_const_iterator
(
type_value_pair
const
*
i
)
:
iter
(
i
)
{
}
type_value_pair_const_iterator
(
type_value_pair_const_iterator
const
&
)
type_value_pair_const_iterator
(
const
type_value_pair_const_iterator
&
)
=
default
;
type_value_pair_const_iterator
&
operator
=
(
type_value_pair_const_iterator
const
&
)
=
default
;
operator
=
(
const
type_value_pair_const_iterator
&
)
=
default
;
inline
uniform_type_info
const
*
type
()
const
{
return
iter
->
first
;
}
...
...
@@ -114,8 +114,8 @@ class type_value_pair_const_iterator
/**
* @relates type_value_pair_const_iterator
*/
inline
bool
operator
==
(
type_value_pair_const_iterator
const
&
lhs
,
type_value_pair_const_iterator
const
&
rhs
)
inline
bool
operator
==
(
const
type_value_pair_const_iterator
&
lhs
,
const
type_value_pair_const_iterator
&
rhs
)
{
return
lhs
.
base
()
==
rhs
.
base
();
}
...
...
@@ -123,8 +123,8 @@ inline bool operator==(type_value_pair_const_iterator const& lhs,
/**
* @relates type_value_pair_const_iterator
*/
inline
bool
operator
!=
(
type_value_pair_const_iterator
const
&
lhs
,
type_value_pair_const_iterator
const
&
rhs
)
inline
bool
operator
!=
(
const
type_value_pair_const_iterator
&
lhs
,
const
type_value_pair_const_iterator
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
...
...
cppa/uniform_type_info.hpp
View file @
54f080df
...
...
@@ -52,7 +52,7 @@ class serializer;
class
deserializer
;
class
uniform_type_info
;
uniform_type_info
const
*
uniform_typeid
(
std
::
type_info
const
&
);
uniform_type_info
const
*
uniform_typeid
(
const
std
::
type_info
&
);
/**
* @defgroup TypeSystem libcppa's platform-independent type system.
...
...
@@ -150,16 +150,16 @@ class uniform_type_info
friend
class
object
;
friend
bool
operator
==
(
uniform_type_info
const
&
lhs
,
uniform_type_info
const
&
rhs
);
friend
bool
operator
==
(
const
uniform_type_info
&
lhs
,
const
uniform_type_info
&
rhs
);
// disable copy and move constructors
uniform_type_info
(
uniform_type_info
&&
)
=
delete
;
uniform_type_info
(
uniform_type_info
const
&
)
=
delete
;
uniform_type_info
(
const
uniform_type_info
&
)
=
delete
;
// disable assignment operators
uniform_type_info
&
operator
=
(
uniform_type_info
&&
)
=
delete
;
uniform_type_info
&
operator
=
(
uniform_type_info
const
&
)
=
delete
;
uniform_type_info
&
operator
=
(
const
uniform_type_info
&
)
=
delete
;
public:
...
...
@@ -171,7 +171,7 @@ class uniform_type_info
* @returns The instance associated to @p uniform_name.
* @throws std::runtime_error if no type named @p uniform_name was found.
*/
static
uniform_type_info
*
from
(
std
::
string
const
&
uniform_name
);
static
uniform_type_info
*
from
(
const
std
::
string
&
uniform_name
);
/**
* @brief Get instance by std::type_info.
...
...
@@ -179,7 +179,7 @@ class uniform_type_info
* @returns An instance describing the same type as @p tinfo.
* @throws std::runtime_error if @p tinfo is not an announced type.
*/
static
uniform_type_info
const
*
from
(
std
::
type_info
const
&
tinfo
);
static
uniform_type_info
const
*
from
(
const
std
::
type_info
&
tinfo
);
/**
* @brief Get all instances.
...
...
@@ -191,7 +191,7 @@ class uniform_type_info
* @brief Get the internal @p libcppa name for this type.
* @returns A string describing the @p libcppa internal type name.
*/
inline
std
::
string
const
&
name
()
const
{
return
m_name
;
}
inline
const
std
::
string
&
name
()
const
{
return
m_name
;
}
/**
* @brief Creates an object of this type.
...
...
@@ -208,7 +208,7 @@ class uniform_type_info
* type than @p tinfo.
* @returns @p true if @p tinfo describes the same type as @p this.
*/
virtual
bool
equals
(
std
::
type_info
const
&
tinfo
)
const
=
0
;
virtual
bool
equals
(
const
std
::
type_info
&
tinfo
)
const
=
0
;
/**
* @brief Compares two instances of this type.
...
...
@@ -237,7 +237,7 @@ class uniform_type_info
protected:
uniform_type_info
(
std
::
string
const
&
uniform_name
);
uniform_type_info
(
const
std
::
string
&
uniform_name
);
/**
* @brief Casts @p instance to the native type and deletes it.
...
...
@@ -275,8 +275,8 @@ inline uniform_type_info const* uniform_typeid()
/**
* @relates uniform_type_info
*/
inline
bool
operator
==
(
uniform_type_info
const
&
lhs
,
uniform_type_info
const
&
rhs
)
inline
bool
operator
==
(
const
uniform_type_info
&
lhs
,
const
uniform_type_info
&
rhs
)
{
// uniform_type_info instances are singletons,
// thus, equal == identical
...
...
@@ -286,8 +286,8 @@ inline bool operator==(uniform_type_info const& lhs,
/**
* @relates uniform_type_info
*/
inline
bool
operator
!=
(
uniform_type_info
const
&
lhs
,
uniform_type_info
const
&
rhs
)
inline
bool
operator
!=
(
const
uniform_type_info
&
lhs
,
const
uniform_type_info
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
...
...
@@ -295,7 +295,7 @@ inline bool operator!=(uniform_type_info const& lhs,
/**
* @relates uniform_type_info
*/
inline
bool
operator
==
(
uniform_type_info
const
&
lhs
,
std
::
type_info
const
&
rhs
)
inline
bool
operator
==
(
const
uniform_type_info
&
lhs
,
const
std
::
type_info
&
rhs
)
{
return
lhs
.
equals
(
rhs
);
}
...
...
@@ -303,7 +303,7 @@ inline bool operator==(uniform_type_info const& lhs, std::type_info const& rhs)
/**
* @relates uniform_type_info
*/
inline
bool
operator
!=
(
uniform_type_info
const
&
lhs
,
std
::
type_info
const
&
rhs
)
inline
bool
operator
!=
(
const
uniform_type_info
&
lhs
,
const
std
::
type_info
&
rhs
)
{
return
!
(
lhs
.
equals
(
rhs
));
}
...
...
@@ -311,7 +311,7 @@ inline bool operator!=(uniform_type_info const& lhs, std::type_info const& rhs)
/**
* @relates uniform_type_info
*/
inline
bool
operator
==
(
std
::
type_info
const
&
lhs
,
uniform_type_info
const
&
rhs
)
inline
bool
operator
==
(
const
std
::
type_info
&
lhs
,
const
uniform_type_info
&
rhs
)
{
return
rhs
.
equals
(
lhs
);
}
...
...
@@ -319,7 +319,7 @@ inline bool operator==(std::type_info const& lhs, uniform_type_info const& rhs)
/**
* @relates uniform_type_info
*/
inline
bool
operator
!=
(
std
::
type_info
const
&
lhs
,
uniform_type_info
const
&
rhs
)
inline
bool
operator
!=
(
const
std
::
type_info
&
lhs
,
const
uniform_type_info
&
rhs
)
{
return
!
(
rhs
.
equals
(
lhs
));
}
...
...
cppa/util/abstract_uniform_type_info.hpp
View file @
54f080df
...
...
@@ -44,7 +44,7 @@ template<typename T>
class
abstract_uniform_type_info
:
public
uniform_type_info
{
inline
static
T
const
&
deref
(
void
const
*
ptr
)
inline
static
const
T
&
deref
(
void
const
*
ptr
)
{
return
*
reinterpret_cast
<
T
const
*>
(
ptr
);
}
...
...
@@ -56,7 +56,7 @@ class abstract_uniform_type_info : public uniform_type_info
protected:
abstract_uniform_type_info
(
std
::
string
const
&
uname
abstract_uniform_type_info
(
const
std
::
string
&
uname
=
detail
::
to_uniform_name
(
typeid
(
T
)))
:
uniform_type_info
(
uname
)
{
...
...
@@ -79,7 +79,7 @@ class abstract_uniform_type_info : public uniform_type_info
public:
bool
equals
(
std
::
type_info
const
&
tinfo
)
const
bool
equals
(
const
std
::
type_info
&
tinfo
)
const
{
return
typeid
(
T
)
==
tinfo
;
}
...
...
cppa/util/apply_args.hpp
View file @
54f080df
...
...
@@ -39,7 +39,7 @@ template<typename Result, size_t NumFunctorArgs, size_t NumArgs>
struct
apply_args
{
template
<
class
Fun
,
typename
Arg0
,
typename
...
Args
>
static
Result
_
(
Fun
const
&
fun
,
Arg0
&&
,
Args
&&
...
args
)
static
Result
_
(
const
Fun
&
fun
,
Arg0
&&
,
Args
&&
...
args
)
{
return
apply_args
<
Result
,
NumFunctorArgs
,
sizeof
...(
Args
)
>
::
_
(
fun
,
std
::
forward
<
Args
>
(
args
)...);
...
...
@@ -50,7 +50,7 @@ template<typename Result, size_t X>
struct
apply_args
<
Result
,
X
,
X
>
{
template
<
class
Fun
,
typename
...
Args
>
static
Result
_
(
Fun
const
&
fun
,
Args
&&
...
args
)
static
Result
_
(
const
Fun
&
fun
,
Args
&&
...
args
)
{
return
fun
(
std
::
forward
<
Args
>
(
args
)...);
}
...
...
cppa/util/apply_tuple.hpp
View file @
54f080df
...
...
@@ -43,7 +43,7 @@ template<typename Result, bool IsManipulator, size_t... Range>
struct
apply_tuple_impl
{
template
<
typename
F
,
class
Tuple
>
static
inline
Result
apply
(
F
&
f
,
Tuple
const
&
args
)
static
inline
Result
apply
(
F
&
f
,
const
Tuple
&
args
)
{
return
f
(
get
<
Range
>
(
args
)...);
}
...
...
@@ -75,7 +75,7 @@ template<typename Result, bool IsManipulator>
struct
apply_tuple_util
<
Result
,
IsManipulator
,
1
,
0
>
{
template
<
typename
F
,
class
Unused
>
static
Result
apply
(
F
&
f
,
Unused
const
&
)
static
Result
apply
(
F
&
f
,
const
Unused
&
)
{
return
f
();
}
...
...
@@ -97,7 +97,7 @@ typename get_result_type<F>::type apply_tuple(F&& fun, Tuple<T...>& tup)
}
template
<
typename
F
,
template
<
typename
...
>
class
Tuple
,
typename
...
T
>
typename
get_result_type
<
F
>::
type
apply_tuple
(
F
&&
fun
,
Tuple
<
T
...
>
const
&
tup
)
typename
get_result_type
<
F
>::
type
apply_tuple
(
F
&&
fun
,
const
Tuple
<
T
...
>
&
tup
)
{
typedef
typename
get_result_type
<
F
>::
type
result_type
;
typedef
typename
get_arg_types
<
F
>::
types
fun_args
;
...
...
@@ -113,7 +113,7 @@ typename get_result_type<F>::type apply_tuple(F&& fun, Tuple<T...> const& tup)
template
<
typename
Result
,
size_t
From
,
size_t
To
,
typename
F
,
template
<
typename
...
>
class
Tuple
,
typename
...
T
>
Result
unchecked_apply_tuple_in_range
(
F
&&
fun
,
Tuple
<
T
...
>
const
&
tup
)
Result
unchecked_apply_tuple_in_range
(
F
&&
fun
,
const
Tuple
<
T
...
>
&
tup
)
{
return
apply_tuple_util
<
Result
,
false
,
From
,
To
>
::
apply
(
std
::
forward
<
F
>
(
fun
),
tup
);
...
...
@@ -131,7 +131,7 @@ Result unchecked_apply_tuple_in_range(F&& fun, Tuple<T...>& tup)
// 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
)
Result
unchecked_apply_tuple
(
F
&&
fun
,
const
Tuple
<
T
...
>
&
tup
)
{
return
apply_tuple_util
<
Result
,
false
,
0
,
sizeof
...(
T
)
-
1
>
::
apply
(
std
::
forward
<
F
>
(
fun
),
tup
);
...
...
cppa/util/comparable.hpp
View file @
54f080df
...
...
@@ -46,62 +46,62 @@ template<class Subclass, class T = Subclass>
class
comparable
{
friend
bool
operator
==
(
Subclass
const
&
lhs
,
T
const
&
rhs
)
friend
bool
operator
==
(
const
Subclass
&
lhs
,
const
T
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
==
0
;
}
friend
bool
operator
==
(
T
const
&
lhs
,
Subclass
const
&
rhs
)
friend
bool
operator
==
(
const
T
&
lhs
,
const
Subclass
&
rhs
)
{
return
rhs
.
compare
(
lhs
)
==
0
;
}
friend
bool
operator
!=
(
Subclass
const
&
lhs
,
T
const
&
rhs
)
friend
bool
operator
!=
(
const
Subclass
&
lhs
,
const
T
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
!=
0
;
}
friend
bool
operator
!=
(
T
const
&
lhs
,
Subclass
const
&
rhs
)
friend
bool
operator
!=
(
const
T
&
lhs
,
const
Subclass
&
rhs
)
{
return
rhs
.
compare
(
lhs
)
!=
0
;
}
friend
bool
operator
<
(
Subclass
const
&
lhs
,
T
const
&
rhs
)
friend
bool
operator
<
(
const
Subclass
&
lhs
,
const
T
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
<
0
;
}
friend
bool
operator
>
(
Subclass
const
&
lhs
,
T
const
&
rhs
)
friend
bool
operator
>
(
const
Subclass
&
lhs
,
const
T
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
>
0
;
}
friend
bool
operator
<
(
T
const
&
lhs
,
Subclass
const
&
rhs
)
friend
bool
operator
<
(
const
T
&
lhs
,
const
Subclass
&
rhs
)
{
return
rhs
>
lhs
;
}
friend
bool
operator
>
(
T
const
&
lhs
,
Subclass
const
&
rhs
)
friend
bool
operator
>
(
const
T
&
lhs
,
const
Subclass
&
rhs
)
{
return
rhs
<
lhs
;
}
friend
bool
operator
<=
(
Subclass
const
&
lhs
,
T
const
&
rhs
)
friend
bool
operator
<=
(
const
Subclass
&
lhs
,
const
T
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
<=
0
;
}
friend
bool
operator
>=
(
Subclass
const
&
lhs
,
T
const
&
rhs
)
friend
bool
operator
>=
(
const
Subclass
&
lhs
,
const
T
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
>=
0
;
}
friend
bool
operator
<=
(
T
const
&
lhs
,
Subclass
const
&
rhs
)
friend
bool
operator
<=
(
const
T
&
lhs
,
const
Subclass
&
rhs
)
{
return
rhs
>=
lhs
;
}
friend
bool
operator
>=
(
T
const
&
lhs
,
Subclass
const
&
rhs
)
friend
bool
operator
>=
(
const
T
&
lhs
,
const
Subclass
&
rhs
)
{
return
rhs
<=
lhs
;
}
...
...
@@ -112,32 +112,32 @@ template<class Subclass>
class
comparable
<
Subclass
,
Subclass
>
{
friend
bool
operator
==
(
Subclass
const
&
lhs
,
Subclass
const
&
rhs
)
friend
bool
operator
==
(
const
Subclass
&
lhs
,
const
Subclass
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
==
0
;
}
friend
bool
operator
!=
(
Subclass
const
&
lhs
,
Subclass
const
&
rhs
)
friend
bool
operator
!=
(
const
Subclass
&
lhs
,
const
Subclass
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
!=
0
;
}
friend
bool
operator
<
(
Subclass
const
&
lhs
,
Subclass
const
&
rhs
)
friend
bool
operator
<
(
const
Subclass
&
lhs
,
const
Subclass
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
<
0
;
}
friend
bool
operator
<=
(
Subclass
const
&
lhs
,
Subclass
const
&
rhs
)
friend
bool
operator
<=
(
const
Subclass
&
lhs
,
const
Subclass
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
<=
0
;
}
friend
bool
operator
>
(
Subclass
const
&
lhs
,
Subclass
const
&
rhs
)
friend
bool
operator
>
(
const
Subclass
&
lhs
,
const
Subclass
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
>
0
;
}
friend
bool
operator
>=
(
Subclass
const
&
lhs
,
Subclass
const
&
rhs
)
friend
bool
operator
>=
(
const
Subclass
&
lhs
,
const
Subclass
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
>=
0
;
}
...
...
cppa/util/compare_tuples.hpp
View file @
54f080df
...
...
@@ -40,7 +40,7 @@ namespace cppa { namespace detail {
template
<
size_t
N
,
template
<
typename
...
>
class
Tuple
,
typename
...
Types
>
const
typename
util
::
at
<
N
,
Types
...
>::
type
&
do_get
(
Tuple
<
Types
...
>
const
&
t
)
do_get
(
const
Tuple
<
Types
...
>
&
t
)
{
return
::
cppa
::
get
<
N
,
Types
...
>
(
t
);
}
...
...
@@ -48,7 +48,7 @@ do_get(Tuple<Types...> const& t)
template
<
size_t
N
,
typename
LhsTuple
,
typename
RhsTuple
>
struct
cmp_helper
{
inline
static
bool
cmp
(
LhsTuple
const
&
lhs
,
RhsTuple
const
&
rhs
)
inline
static
bool
cmp
(
const
LhsTuple
&
lhs
,
const
RhsTuple
&
rhs
)
{
return
do_get
<
N
>
(
lhs
)
==
do_get
<
N
>
(
rhs
)
&&
cmp_helper
<
N
-
1
,
LhsTuple
,
RhsTuple
>::
cmp
(
lhs
,
rhs
);
...
...
@@ -58,7 +58,7 @@ struct cmp_helper
template
<
typename
LhsTuple
,
typename
RhsTuple
>
struct
cmp_helper
<
0
,
LhsTuple
,
RhsTuple
>
{
inline
static
bool
cmp
(
LhsTuple
const
&
lhs
,
RhsTuple
const
&
rhs
)
inline
static
bool
cmp
(
const
LhsTuple
&
lhs
,
const
RhsTuple
&
rhs
)
{
return
do_get
<
0
>
(
lhs
)
==
do_get
<
0
>
(
rhs
);
}
...
...
@@ -70,8 +70,8 @@ namespace cppa { namespace util {
template
<
template
<
typename
...
>
class
LhsTuple
,
typename
...
LhsTypes
,
template
<
typename
...
>
class
RhsTuple
,
typename
...
RhsTypes
>
bool
compare_tuples
(
LhsTuple
<
LhsTypes
...
>
const
&
lhs
,
RhsTuple
<
RhsTypes
...
>
const
&
rhs
)
bool
compare_tuples
(
const
LhsTuple
<
LhsTypes
...
>
&
lhs
,
const
RhsTuple
<
RhsTypes
...
>
&
rhs
)
{
static_assert
(
sizeof
...(
LhsTypes
)
==
sizeof
...(
RhsTypes
),
"could not compare tuples of different size"
);
...
...
@@ -90,8 +90,8 @@ bool compare_tuples(LhsTuple<LhsTypes...> const& lhs,
template
<
template
<
typename
...
>
class
LhsTuple
,
typename
...
LhsTypes
,
template
<
typename
...
>
class
RhsTuple
,
typename
...
RhsTypes
>
bool
compare_first_elements
(
LhsTuple
<
LhsTypes
...
>
const
&
lhs
,
RhsTuple
<
RhsTypes
...
>
const
&
rhs
)
bool
compare_first_elements
(
const
LhsTuple
<
LhsTypes
...
>
&
lhs
,
const
RhsTuple
<
RhsTypes
...
>
&
rhs
)
{
typedef
typename
tl_zip
<
util
::
type_list
<
LhsTypes
...
>
,
...
...
cppa/util/deduce_ref_type.hpp
View file @
54f080df
...
...
@@ -51,9 +51,9 @@ struct deduce_ref_type<T0&, T1>
};
template
<
typename
T0
,
typename
T1
>
struct
deduce_ref_type
<
T0
const
&
,
T1
>
struct
deduce_ref_type
<
const
T0
&
,
T1
>
{
typedef
typename
util
::
rm_ref
<
T1
>::
type
const
&
type
;
typedef
const
typename
util
::
rm_ref
<
T1
>::
type
&
type
;
};
}
}
// namespace cppa::util
...
...
cppa/util/duration.hpp
View file @
54f080df
...
...
@@ -104,12 +104,12 @@ class duration
/**
* @relates duration
*/
bool
operator
==
(
duration
const
&
lhs
,
duration
const
&
rhs
);
bool
operator
==
(
const
duration
&
lhs
,
const
duration
&
rhs
);
/**
* @relates duration
*/
inline
bool
operator
!=
(
duration
const
&
lhs
,
duration
const
&
rhs
)
inline
bool
operator
!=
(
const
duration
&
lhs
,
const
duration
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
...
...
@@ -122,7 +122,7 @@ inline bool operator!=(duration const& lhs, duration const& rhs)
template
<
class
Clock
,
class
Duration
>
std
::
chrono
::
time_point
<
Clock
,
Duration
>&
operator
+=
(
std
::
chrono
::
time_point
<
Clock
,
Duration
>&
lhs
,
c
ppa
::
util
::
duration
const
&
rhs
)
c
onst
cppa
::
util
::
duration
&
rhs
)
{
switch
(
rhs
.
unit
)
{
...
...
cppa/util/fixed_vector.hpp
View file @
54f080df
...
...
@@ -65,7 +65,7 @@ class fixed_vector
typedef
size_t
size_type
;
typedef
ptrdiff_t
difference_type
;
typedef
value_type
&
reference
;
typedef
value_type
const
&
const_reference
;
typedef
const
value_type
&
const_reference
;
typedef
value_type
*
pointer
;
typedef
value_type
const
*
const_pointer
;
...
...
@@ -76,12 +76,12 @@ class fixed_vector
constexpr
fixed_vector
()
:
m_size
(
0
)
{
}
fixed_vector
(
fixed_vector
const
&
other
)
:
m_size
(
other
.
m_size
)
fixed_vector
(
const
fixed_vector
&
other
)
:
m_size
(
other
.
m_size
)
{
std
::
copy
(
other
.
begin
(),
other
.
end
(),
begin
());
}
fixed_vector
&
operator
=
(
fixed_vector
const
&
other
)
fixed_vector
&
operator
=
(
const
fixed_vector
&
other
)
{
resize
(
other
.
size
());
std
::
copy
(
other
.
begin
(),
other
.
end
(),
begin
());
...
...
cppa/util/guard.hpp
View file @
54f080df
...
...
@@ -39,7 +39,7 @@ struct guard
virtual
~
guard
()
{
}
virtual
bool
operator
()(
T
const
&
)
const
=
0
;
virtual
bool
operator
()(
const
T
&
)
const
=
0
;
};
...
...
cppa/util/is_mutable_ref.hpp
View file @
54f080df
...
...
@@ -43,7 +43,7 @@ struct is_mutable_ref
};
template
<
typename
T
>
struct
is_mutable_ref
<
T
const
&>
struct
is_mutable_ref
<
const
T
&>
{
static
constexpr
bool
value
=
false
;
};
...
...
cppa/util/left_or_right.hpp
View file @
54f080df
...
...
@@ -57,7 +57,7 @@ struct left_or_right<util::void_type&, Right>
};
template
<
typename
Right
>
struct
left_or_right
<
util
::
void_type
const
&
,
Right
>
struct
left_or_right
<
const
util
::
void_type
&
,
Right
>
{
typedef
Right
type
;
};
...
...
cppa/util/producer_consumer_list.hpp
View file @
54f080df
...
...
@@ -24,7 +24,7 @@ class producer_consumer_list
typedef
size_t
size_type
;
typedef
ptrdiff_t
difference_type
;
typedef
value_type
&
reference
;
typedef
value_type
const
&
const_reference
;
typedef
const
value_type
&
const_reference
;
typedef
value_type
*
pointer
;
typedef
value_type
const
*
const_pointer
;
...
...
cppa/util/ripemd_160.hpp
View file @
54f080df
...
...
@@ -76,7 +76,7 @@ namespace cppa { namespace util {
/**
* @brief Creates a hash from @p data using the RIPEMD-160 algorithm.
*/
void
ripemd_160
(
std
::
array
<
std
::
uint8_t
,
20
>&
storage
,
std
::
string
const
&
data
);
void
ripemd_160
(
std
::
array
<
std
::
uint8_t
,
20
>&
storage
,
const
std
::
string
&
data
);
}
}
// namespace cppa::util
...
...
cppa/util/rm_ref.hpp
View file @
54f080df
...
...
@@ -41,7 +41,7 @@ template<typename T>
struct
rm_ref
{
typedef
T
type
;
};
template
<
typename
T
>
struct
rm_ref
<
T
const
&>
{
typedef
T
type
;
};
struct
rm_ref
<
const
T
&>
{
typedef
T
type
;
};
template
<
typename
T
>
struct
rm_ref
<
T
&>
{
typedef
T
type
;
};
...
...
cppa/util/static_foreach.hpp
View file @
54f080df
...
...
@@ -39,7 +39,7 @@ template<bool BeginLessEnd, size_t Begin, size_t End>
struct
static_foreach_impl
{
template
<
typename
Container
,
typename
Fun
,
typename
...
Args
>
static
inline
void
_
(
Container
const
&
c
,
Fun
&
f
,
Args
&&
...
args
)
static
inline
void
_
(
const
Container
&
c
,
Fun
&
f
,
Args
&&
...
args
)
{
f
(
get
<
Begin
>
(
c
),
std
::
forward
<
Args
>
(
args
)...);
static_foreach_impl
<
(
Begin
+
1
<
End
),
Begin
+
1
,
End
>
...
...
@@ -58,19 +58,19 @@ struct static_foreach_impl
_ref
(
c
,
f
,
std
::
forward
<
Args
>
(
args
)...);
}
template
<
typename
Container
,
typename
Fun
,
typename
...
Args
>
static
inline
void
_auto
(
Container
const
&
c
,
Fun
&
f
,
Args
&&
...
args
)
static
inline
void
_auto
(
const
Container
&
c
,
Fun
&
f
,
Args
&&
...
args
)
{
_
(
c
,
f
,
std
::
forward
<
Args
>
(
args
)...);
}
template
<
typename
Container
,
typename
Fun
,
typename
...
Args
>
static
inline
bool
eval
(
Container
const
&
c
,
Fun
&
f
,
Args
&&
...
args
)
static
inline
bool
eval
(
const
Container
&
c
,
Fun
&
f
,
Args
&&
...
args
)
{
return
f
(
get
<
Begin
>
(
c
),
std
::
forward
<
Args
>
(
args
)...)
&&
static_foreach_impl
<
(
Begin
+
1
<
End
),
Begin
+
1
,
End
>
::
eval
(
c
,
f
,
std
::
forward
<
Args
>
(
args
)...);
}
template
<
typename
Container
,
typename
Fun
,
typename
...
Args
>
static
inline
bool
eval_or
(
Container
const
&
c
,
Fun
&
f
,
Args
&&
...
args
)
static
inline
bool
eval_or
(
const
Container
&
c
,
Fun
&
f
,
Args
&&
...
args
)
{
return
f
(
get
<
Begin
>
(
c
),
std
::
forward
<
Args
>
(
args
)...)
||
static_foreach_impl
<
(
Begin
+
1
<
End
),
Begin
+
1
,
End
>
...
...
cppa/util/type_list.hpp
View file @
54f080df
...
...
@@ -43,7 +43,7 @@ namespace cppa {
// forward declarations
class
uniform_type_info
;
uniform_type_info
const
*
uniform_typeid
(
std
::
type_info
const
&
);
uniform_type_info
const
*
uniform_typeid
(
const
std
::
type_info
&
);
}
// namespace cppa
...
...
@@ -194,12 +194,12 @@ template<class ListA, class ListB,
template
<
typename
,
typename
>
class
Fun
=
to_type_pair
>
struct
tl_zip_impl
;
template
<
typename
...
LhsElements
,
typename
...
RhsElements
,
template
<
typename
...
LhsElements
,
typename
...
RhsElements
,
template
<
typename
,
typename
>
class
Fun
>
struct
tl_zip_impl
<
type_list
<
LhsElements
...
>
,
type_list
<
RhsElements
...
>
,
Fun
>
{
static_assert
(
sizeof
...(
LhsElements
)
==
sizeof
...(
RhsElements
),
static_assert
(
sizeof
...(
LhsElements
)
==
sizeof
...(
RhsElements
),
"Lists have different size"
);
typedef
type_list
<
typename
Fun
<
LhsElements
,
RhsElements
>::
type
...
>
type
;
};
...
...
cppa/util/void_type.hpp
View file @
54f080df
...
...
@@ -42,15 +42,15 @@ struct void_type
typedef
type_list
<>
tail
;
constexpr
void_type
()
{
}
constexpr
void_type
(
void_type
const
&
)
{
}
void_type
&
operator
=
(
void_type
const
&
)
=
default
;
constexpr
void_type
(
const
void_type
&
)
{
}
void_type
&
operator
=
(
const
void_type
&
)
=
default
;
// anything could be used to initialize a void...
template
<
typename
Arg0
,
typename
...
Args
>
void_type
(
Arg0
&&
,
Args
&&
...)
{
}
};
inline
bool
operator
==
(
void_type
const
&
,
void_type
const
&
)
{
return
true
;
}
inline
bool
operator
==
(
const
void_type
&
,
const
void_type
&
)
{
return
true
;
}
}
}
// namespace cppa::util
...
...
examples/announce_example_4.cpp
View file @
54f080df
...
...
@@ -118,7 +118,7 @@ int main(int, char**)
int
i
=
0
;
receive_for
(
i
,
2
)
(
on
<
bar
>
()
>>
[](
bar
const
&
val
)
on
<
bar
>
()
>>
[](
const
bar
&
val
)
{
cout
<<
"bar(foo("
<<
val
.
f
.
a
()
<<
","
...
...
@@ -126,7 +126,7 @@ int main(int, char**)
<<
val
.
i
<<
")"
<<
endl
;
},
on
<
baz
>
()
>>
[](
baz
const
&
val
)
on
<
baz
>
()
>>
[](
const
baz
&
val
)
{
// prints: baz ( foo ( 1, 2 ), bar ( foo ( 3, 4 ), 5 ) )
cout
<<
to_string
(
val
)
<<
endl
;
...
...
examples/dining_philosophers.cpp
View file @
54f080df
...
...
@@ -18,7 +18,7 @@ struct chopstick : fsm_actor<chopstick>
behavior
&
init_state
;
// a reference to available
behavior
available
;
behavior
taken_by
(
actor_ptr
const
&
philos
)
behavior
taken_by
(
const
actor_ptr
&
philos
)
{
// create a behavior new on-the-fly
return
...
...
@@ -97,7 +97,7 @@ struct philosopher : fsm_actor<philosopher>
behavior
init_state
;
// wait for second chopstick
behavior
waiting_for
(
actor_ptr
const
&
what
)
behavior
waiting_for
(
const
actor_ptr
&
what
)
{
return
(
...
...
@@ -126,7 +126,7 @@ struct philosopher : fsm_actor<philosopher>
);
}
philosopher
(
std
::
string
const
&
n
,
actor_ptr
const
&
l
,
actor_ptr
const
&
r
)
philosopher
(
const
std
::
string
&
n
,
const
actor_ptr
&
l
,
const
actor_ptr
&
r
)
:
name
(
n
),
left
(
l
),
right
(
r
)
{
// a philosopher that receives {eat} stops thinking and becomes hungry
...
...
src/abstract_scheduled_actor.cpp
0 → 100644
View file @
54f080df
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, 2012 *
* Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#include "cppa/cppa.hpp"
#include "cppa/config.hpp"
#include "cppa/to_string.hpp"
#include "cppa/exception.hpp"
#include "cppa/scheduler.hpp"
#include "cppa/detail/types_array.hpp"
#include "cppa/detail/yield_interface.hpp"
#include "cppa/detail/abstract_scheduled_actor.hpp"
namespace
cppa
{
namespace
detail
{
namespace
{
void
dummy_enqueue
(
void
*
,
abstract_scheduled_actor
*
)
{
}
types_array
<
atom_value
,
std
::
uint32_t
>
t_atom_ui32_types
;
}
abstract_scheduled_actor
::
abstract_scheduled_actor
(
scheduler
*
sched
)
:
next
(
nullptr
)
,
m_state
(
ready
)
,
m_scheduler
(
sched
)
,
m_has_pending_timeout_request
(
false
)
,
m_active_timeout_id
(
0
)
{
CPPA_REQUIRE
(
sched
!=
nullptr
);
}
abstract_scheduled_actor
::
abstract_scheduled_actor
(
int
state
)
:
next
(
nullptr
)
,
m_state
(
state
)
,
m_scheduler
(
nullptr
)
,
m_has_pending_timeout_request
(
false
)
,
m_active_timeout_id
(
0
)
{
}
abstract_scheduled_actor
::
resume_callback
::~
resume_callback
()
{
}
void
abstract_scheduled_actor
::
quit
(
std
::
uint32_t
reason
)
{
cleanup
(
reason
);
throw
actor_exited
(
reason
);
}
void
abstract_scheduled_actor
::
enqueue_node
(
queue_node
*
node
)
{
if
(
m_mailbox
.
_push_back
(
node
))
{
for
(;;)
{
int
state
=
m_state
.
load
();
switch
(
state
)
{
case
blocked
:
{
if
(
m_state
.
compare_exchange_weak
(
state
,
ready
))
{
CPPA_REQUIRE
(
m_scheduler
!=
nullptr
);
m_scheduler
->
enqueue
(
this
);
return
;
}
break
;
}
case
about_to_block
:
{
if
(
m_state
.
compare_exchange_weak
(
state
,
ready
))
{
return
;
}
break
;
}
default:
return
;
}
}
}
}
void
abstract_scheduled_actor
::
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
)
{
enqueue_node
(
fetch_node
(
sender
,
std
::
move
(
msg
)));
//enqueue_node(new queue_node(sender, std::move(msg)));
}
void
abstract_scheduled_actor
::
enqueue
(
actor
*
sender
,
const
any_tuple
&
msg
)
{
enqueue_node
(
fetch_node
(
sender
,
msg
));
//enqueue_node(new queue_node(sender, msg));
}
int
abstract_scheduled_actor
::
compare_exchange_state
(
int
expected
,
int
new_value
)
{
int
e
=
expected
;
do
{
if
(
m_state
.
compare_exchange_weak
(
e
,
new_value
))
{
return
new_value
;
}
}
while
(
e
==
expected
);
return
e
;
}
void
abstract_scheduled_actor
::
request_timeout
(
const
util
::
duration
&
d
)
{
if
(
d
.
valid
())
{
future_send
(
this
,
d
,
atom
(
":Timeout"
),
++
m_active_timeout_id
);
m_has_pending_timeout_request
=
true
;
}
}
auto
abstract_scheduled_actor
::
filter_msg
(
const
any_tuple
&
msg
)
->
filter_result
{
if
(
msg
.
size
()
==
2
&&
msg
.
type_at
(
0
)
==
t_atom_ui32_types
[
0
]
&&
msg
.
type_at
(
1
)
==
t_atom_ui32_types
[
1
])
{
auto
v0
=
*
reinterpret_cast
<
const
atom_value
*>
(
msg
.
at
(
0
));
auto
v1
=
*
reinterpret_cast
<
const
std
::
uint32_t
*>
(
msg
.
at
(
1
));
if
(
v0
==
atom
(
":Exit"
))
{
if
(
m_trap_exit
==
false
)
{
if
(
v1
!=
exit_reason
::
normal
)
{
quit
(
v1
);
}
return
normal_exit_signal
;
}
}
else
if
(
v0
==
atom
(
":Timeout"
))
{
return
(
v1
==
m_active_timeout_id
)
?
timeout_message
:
expired_timeout_message
;
}
}
return
ordinary_message
;
}
auto
abstract_scheduled_actor
::
dq
(
queue_node
&
node
,
partial_function
&
fun
)
->
dq_result
{
CPPA_REQUIRE
(
node
.
msg
.
cvals
().
get
()
!=
nullptr
);
if
(
node
.
marked
)
return
dq_indeterminate
;
switch
(
filter_msg
(
node
.
msg
))
{
case
normal_exit_signal
:
case
expired_timeout_message
:
{
// skip message
return
dq_indeterminate
;
}
case
timeout_message
:
{
// m_active_timeout_id is already invalid
m_has_pending_timeout_request
=
false
;
return
dq_timeout_occured
;
}
default:
break
;
}
std
::
swap
(
m_last_dequeued
,
node
.
msg
);
std
::
swap
(
m_last_sender
,
node
.
sender
);
//m_last_dequeued = node.msg;
//m_last_sender = node.sender;
// make sure no timeout is handled incorrectly in a nested receive
++
m_active_timeout_id
;
// lifetime scope of qguard
{
// make sure nested receives do not process this node again
queue_node_guard
qguard
{
&
node
};
// try to invoke given function
if
(
fun
(
m_last_dequeued
))
{
// client erases node later (keep it marked until it's removed)
qguard
.
release
();
// this members are only valid during invocation
m_last_dequeued
.
reset
();
m_last_sender
.
reset
();
// we definitely don't have a pending timeout now
m_has_pending_timeout_request
=
false
;
return
dq_done
;
}
}
// no match, restore members
--
m_active_timeout_id
;
std
::
swap
(
m_last_dequeued
,
node
.
msg
);
std
::
swap
(
m_last_sender
,
node
.
sender
);
return
dq_indeterminate
;
}
// dummy
void
scheduled_actor_dummy
::
resume
(
util
::
fiber
*
,
resume_callback
*
)
{
}
void
scheduled_actor_dummy
::
quit
(
std
::
uint32_t
)
{
}
void
scheduled_actor_dummy
::
dequeue
(
behavior
&
)
{
}
void
scheduled_actor_dummy
::
dequeue
(
partial_function
&
)
{
}
void
scheduled_actor_dummy
::
link_to
(
intrusive_ptr
<
actor
>&
)
{
}
void
scheduled_actor_dummy
::
unlink_from
(
intrusive_ptr
<
actor
>&
)
{
}
bool
scheduled_actor_dummy
::
establish_backlink
(
intrusive_ptr
<
actor
>&
)
{
return
false
;
}
bool
scheduled_actor_dummy
::
remove_backlink
(
intrusive_ptr
<
actor
>&
)
{
return
false
;
}
void
scheduled_actor_dummy
::
detach
(
const
attachable
::
token
&
)
{
}
bool
scheduled_actor_dummy
::
attach
(
attachable
*
)
{
return
false
;
}
}
}
// namespace cppa::detail
src/abstract_tuple.cpp
View file @
54f080df
...
...
@@ -39,7 +39,7 @@ bool abstract_tuple::equals(const abstract_tuple &other) const
&&
std
::
equal
(
begin
(),
end
(),
other
.
begin
(),
detail
::
full_eq
));
}
abstract_tuple
::
abstract_tuple
(
abstract_tuple
const
&
other
)
abstract_tuple
::
abstract_tuple
(
const
abstract_tuple
&
other
)
:
ref_counted
()
,
m_impl_type
(
other
.
m_impl_type
)
{
...
...
src/actor_registry.cpp
View file @
54f080df
...
...
@@ -62,7 +62,7 @@ actor_ptr actor_registry::get(actor_id key) const
return
nullptr
;
}
void
actor_registry
::
put
(
actor_id
key
,
actor_ptr
const
&
value
)
void
actor_registry
::
put
(
actor_id
key
,
const
actor_ptr
&
value
)
{
bool
add_attachable
=
false
;
if
(
value
!=
nullptr
)
...
...
@@ -89,7 +89,7 @@ void actor_registry::put(actor_id key, actor_ptr const& value)
{
m_singleton
->
erase
(
m_id
);
}
bool
matches
(
token
const
&
)
bool
matches
(
const
token
&
)
{
return
false
;
}
...
...
src/any_tuple.cpp
View file @
54f080df
...
...
@@ -56,7 +56,7 @@ any_tuple::any_tuple(any_tuple&& other) : m_vals(s_empty_tuple())
m_vals
.
swap
(
other
.
m_vals
);
}
any_tuple
::
any_tuple
(
co
w_ptr
<
detail
::
abstract_tuple
>
const
&
vals
)
:
m_vals
(
vals
)
any_tuple
::
any_tuple
(
co
nst
cow_ptr
<
detail
::
abstract_tuple
>
&
vals
)
:
m_vals
(
vals
)
{
}
...
...
@@ -91,7 +91,7 @@ const uniform_type_info* any_tuple::type_at(size_t p) const
return
m_vals
->
type_at
(
p
);
}
bool
any_tuple
::
equals
(
any_tuple
const
&
other
)
const
bool
any_tuple
::
equals
(
const
any_tuple
&
other
)
const
{
return
m_vals
->
equals
(
*
other
.
vals
());
}
...
...
src/atom.cpp
View file @
54f080df
...
...
@@ -32,7 +32,7 @@
namespace
cppa
{
std
::
string
to_string
(
atom_value
const
&
what
)
std
::
string
to_string
(
const
atom_value
&
what
)
{
auto
x
=
static_cast
<
std
::
uint64_t
>
(
what
);
std
::
string
result
;
...
...
src/group.cpp
View file @
54f080df
...
...
@@ -38,8 +38,8 @@
namespace
cppa
{
intrusive_ptr
<
group
>
group
::
get
(
std
::
string
const
&
arg0
,
std
::
string
const
&
arg1
)
intrusive_ptr
<
group
>
group
::
get
(
const
std
::
string
&
arg0
,
const
std
::
string
&
arg1
)
{
return
detail
::
singleton_manager
::
get_group_manager
()
->
get
(
arg0
,
arg1
);
}
...
...
@@ -54,8 +54,8 @@ void group::add_module(group::module* ptr)
detail
::
singleton_manager
::
get_group_manager
()
->
add_module
(
ptr
);
}
group
::
unsubscriber
::
unsubscriber
(
c
hannel_ptr
const
&
s
,
intrusive_ptr
<
group
>
const
&
g
)
group
::
unsubscriber
::
unsubscriber
(
c
onst
channel_ptr
&
s
,
const
intrusive_ptr
<
group
>
&
g
)
:
m_self
(
s
),
m_group
(
g
)
{
}
...
...
@@ -70,7 +70,7 @@ void group::unsubscriber::actor_exited(std::uint32_t)
// unsubscription is done in destructor
}
bool
group
::
unsubscriber
::
matches
(
attachable
::
token
const
&
what
)
bool
group
::
unsubscriber
::
matches
(
const
attachable
::
token
&
what
)
{
if
(
what
.
subtype
==
typeid
(
group
::
unsubscriber
))
{
...
...
@@ -79,7 +79,7 @@ bool group::unsubscriber::matches(attachable::token const& what)
return
false
;
}
group
::
module
::
module
(
std
::
string
const
&
name
)
:
m_name
(
name
)
group
::
module
::
module
(
const
std
::
string
&
name
)
:
m_name
(
name
)
{
}
...
...
@@ -87,7 +87,7 @@ group::module::module(std::string&& name) : m_name(std::move(name))
{
}
std
::
string
const
&
group
::
module
::
name
()
const
std
::
string
&
group
::
module
::
name
()
{
return
m_name
;
}
...
...
@@ -97,17 +97,17 @@ group::group(std::string&& id, std::string&& mod_name)
{
}
group
::
group
(
std
::
string
const
&
id
,
std
::
string
const
&
mod_name
)
group
::
group
(
const
std
::
string
&
id
,
const
std
::
string
&
mod_name
)
:
m_identifier
(
id
),
m_module_name
(
mod_name
)
{
}
std
::
string
const
&
group
::
identifier
()
const
const
std
::
string
&
group
::
identifier
()
const
{
return
m_identifier
;
}
std
::
string
const
&
group
::
module_name
()
const
const
std
::
string
&
group
::
module_name
()
const
{
return
m_module_name
;
}
...
...
src/group_manager.cpp
View file @
54f080df
...
...
@@ -99,7 +99,7 @@ class local_group : public group_impl
friend
class
local_group_module
;
local_group
(
std
::
string
const
&
gname
)
:
group_impl
(
gname
,
"local"
)
{
}
local_group
(
const
std
::
string
&
gname
)
:
group_impl
(
gname
,
"local"
)
{
}
};
...
...
src/invokable.cpp
View file @
54f080df
...
...
@@ -40,8 +40,8 @@ bool invokable::invoke(any_tuple&) const { return false; }
bool
invokable
::
unsafe_invoke
(
any_tuple
&
)
const
{
return
false
;
}
bool
invokable
::
types_match
(
any_tuple
const
&
)
const
{
return
false
;
}
bool
invokable
::
types_match
(
const
any_tuple
&
)
const
{
return
false
;
}
bool
invokable
::
could_invoke
(
any_tuple
const
&
)
const
{
return
false
;
}
bool
invokable
::
could_invoke
(
const
any_tuple
&
)
const
{
return
false
;
}
}
}
// namespace cppa::detail
src/object.cpp
View file @
54f080df
...
...
@@ -72,7 +72,7 @@ object::~object()
if
(
m_value
!=
&
s_void
)
m_type
->
delete_instance
(
m_value
);
}
object
::
object
(
object
cons
t
&
other
)
object
::
object
(
const
objec
t
&
other
)
{
m_type
=
other
.
m_type
;
m_value
=
(
other
.
m_value
==
&
s_void
)
?
other
.
m_value
...
...
@@ -91,14 +91,14 @@ object& object::operator=(object&& other)
return
*
this
;
}
object
&
object
::
operator
=
(
object
cons
t
&
other
)
object
&
object
::
operator
=
(
const
objec
t
&
other
)
{
object
tmp
(
other
);
swap
(
tmp
);
return
*
this
;
}
bool
operator
==
(
object
const
&
lhs
,
object
cons
t
&
rhs
)
bool
operator
==
(
const
object
&
lhs
,
const
objec
t
&
rhs
)
{
if
(
lhs
.
type
()
==
rhs
.
type
())
{
...
...
src/object_array.cpp
View file @
54f080df
...
...
@@ -36,7 +36,7 @@ object_array::object_array() : super(tuple_impl_info::dynamically_typed)
{
}
void
object_array
::
push_back
(
object
cons
t
&
what
)
void
object_array
::
push_back
(
const
objec
t
&
what
)
{
m_elements
.
push_back
(
what
);
}
...
...
src/pattern.cpp
View file @
54f080df
...
...
@@ -34,7 +34,7 @@ namespace cppa {
value_matcher
::~
value_matcher
()
{
}
bool
dummy_matcher
::
operator
()(
any_tuple
const
&
)
const
bool
dummy_matcher
::
operator
()(
const
any_tuple
&
)
const
{
return
true
;
}
...
...
src/process_information.cpp
View file @
54f080df
...
...
@@ -151,8 +151,8 @@ void node_id_from_string(const std::string& hash,
}
}
bool
equal
(
std
::
string
const
&
hash
,
process_information
::
node_id_type
const
&
node_id
)
bool
equal
(
const
std
::
string
&
hash
,
const
process_information
::
node_id_type
&
node_id
)
{
if
(
hash
.
size
()
!=
(
node_id
.
size
()
*
2
))
{
...
...
@@ -180,23 +180,23 @@ bool equal(std::string const& hash,
return
true
;
}
process_information
::
process_information
(
process_information
const
&
other
)
process_information
::
process_information
(
const
process_information
&
other
)
:
super
(),
m_process_id
(
other
.
process_id
()),
m_node_id
(
other
.
node_id
())
{
}
process_information
::
process_information
(
std
::
uint32_t
a
,
std
::
string
const
&
b
)
process_information
::
process_information
(
std
::
uint32_t
a
,
const
std
::
string
&
b
)
:
m_process_id
(
a
)
{
node_id_from_string
(
b
,
m_node_id
);
}
process_information
::
process_information
(
std
::
uint32_t
a
,
node_id_type
const
&
b
)
process_information
::
process_information
(
std
::
uint32_t
a
,
const
node_id_type
&
b
)
:
m_process_id
(
a
),
m_node_id
(
b
)
{
}
std
::
string
to_string
(
process_information
::
node_id_type
const
&
node_id
)
std
::
string
to_string
(
const
process_information
::
node_id_type
&
node_id
)
{
std
::
ostringstream
oss
;
oss
<<
std
::
hex
;
...
...
@@ -209,12 +209,12 @@ std::string to_string(process_information::node_id_type const& node_id)
return
oss
.
str
();
}
intrusive_ptr
<
process_information
>
const
&
process_information
::
get
()
const
intrusive_ptr
<
process_information
>
&
process_information
::
get
()
{
return
s_pinfo
;
}
int
process_information
::
compare
(
process_information
const
&
other
)
const
int
process_information
::
compare
(
const
process_information
&
other
)
const
{
int
tmp
=
strncmp
(
reinterpret_cast
<
char
const
*>
(
node_id
().
data
()),
reinterpret_cast
<
char
const
*>
(
other
.
node_id
().
data
()),
...
...
@@ -228,7 +228,7 @@ int process_information::compare(process_information const& other) const
return
tmp
;
}
std
::
string
to_string
(
process_information
const
&
what
)
std
::
string
to_string
(
const
process_information
&
what
)
{
std
::
ostringstream
oss
;
oss
<<
what
.
process_id
()
<<
"@"
<<
to_string
(
what
.
node_id
());
...
...
src/ripemd_160.cpp
View file @
54f080df
...
...
@@ -400,7 +400,7 @@ void MDfinish(dword *MDbuf, const byte *strptr, dword lswlen, dword mswlen)
namespace
cppa
{
namespace
util
{
void
ripemd_160
(
std
::
array
<
std
::
uint8_t
,
20
>&
storage
,
std
::
string
const
&
data
)
void
ripemd_160
(
std
::
array
<
std
::
uint8_t
,
20
>&
storage
,
const
std
::
string
&
data
)
{
dword
MDbuf
[
5
];
// contains (A, B, C, D(, E))
dword
X
[
16
];
// current 16-word chunk
...
...
src/uniform_type_info.cpp
View file @
54f080df
...
...
@@ -180,7 +180,7 @@ class actor_ptr_tinfo : public util::abstract_uniform_type_info<actor_ptr>
public:
static
void
s_serialize
(
actor_ptr
const
&
ptr
,
static
void
s_serialize
(
const
actor_ptr
&
ptr
,
serializer
*
sink
,
const
std
::
string
name
)
{
...
...
@@ -277,7 +277,7 @@ class group_ptr_tinfo : public util::abstract_uniform_type_info<group_ptr>
public:
static
void
s_serialize
(
group_ptr
const
&
ptr
,
static
void
s_serialize
(
const
group_ptr
&
ptr
,
serializer
*
sink
,
const
std
::
string
&
name
)
{
...
...
@@ -346,7 +346,7 @@ class channel_ptr_tinfo : public util::abstract_uniform_type_info<channel_ptr>
public:
static
void
s_serialize
(
c
hannel_ptr
const
&
ptr
,
static
void
s_serialize
(
c
onst
channel_ptr
&
ptr
,
serializer
*
sink
,
const
std
::
string
&
channel_type_name
,
const
std
::
string
&
actor_ptr_type_name
,
...
...
@@ -686,15 +686,15 @@ class int_tinfo : public detail::default_uniform_type_info_impl<T>
public:
bool
equals
(
std
::
type_info
const
&
tinfo
)
const
bool
equals
(
const
std
::
type_info
&
tinfo
)
const
{
// TODO: string comparsion sucks & is slow; find a nicer solution
auto
map_iter
=
uti_map
().
int_names
().
find
(
sizeof
(
T
));
string_set
cons
t
&
st
=
is_signed
<
T
>::
value
?
map_iter
->
second
.
first
const
string_se
t
&
st
=
is_signed
<
T
>::
value
?
map_iter
->
second
.
first
:
map_iter
->
second
.
second
;
auto
x
=
raw_name
(
tinfo
);
return
std
::
any_of
(
st
.
begin
(),
st
.
end
(),
[
&
](
std
::
string
const
&
y
)
{
return
x
==
y
;
});
[
&
](
const
std
::
string
&
y
)
{
return
x
==
y
;
});
}
};
...
...
@@ -711,10 +711,10 @@ class uniform_type_info_map_helper
static
void
insert
(
this_ptr
d
,
uniform_type_info
*
uti
,
std
::
set
<
std
::
string
>
const
&
tnames
)
const
std
::
set
<
std
::
string
>
&
tnames
)
{
CPPA_REQUIRE
(
tnames
.
empty
()
==
false
);
for
(
std
::
string
const
&
tname
:
tnames
)
for
(
const
std
::
string
&
tname
:
tnames
)
{
d
->
m_by_rname
.
insert
(
std
::
make_pair
(
tname
,
uti
));
}
...
...
@@ -723,7 +723,7 @@ class uniform_type_info_map_helper
template
<
typename
T
>
static
inline
void
insert
(
this_ptr
d
,
std
::
set
<
std
::
string
>
const
&
tnames
,
const
std
::
set
<
std
::
string
>
&
tnames
,
typename
enable_if
<
is_integral
<
T
>::
value
>::
type
*
=
0
)
{
insert
(
d
,
new
int_tinfo
<
T
>
,
tnames
);
...
...
@@ -731,7 +731,7 @@ class uniform_type_info_map_helper
template
<
typename
T
>
static
inline
void
insert
(
this_ptr
d
,
std
::
set
<
std
::
string
>
const
&
tnames
,
const
std
::
set
<
std
::
string
>
&
tnames
,
typename
enable_if
<!
is_integral
<
T
>::
value
>::
type
*
=
0
)
{
insert
(
d
,
new
default_uniform_type_info_impl
<
T
>
(),
tnames
);
...
...
unit_testing/main.cpp
View file @
54f080df
...
...
@@ -66,7 +66,7 @@ using std::endl;
using
namespace
cppa
;
std
::
vector
<
std
::
string
>
split
(
std
::
string
const
&
str
,
char
delim
)
std
::
vector
<
std
::
string
>
split
(
const
std
::
string
&
str
,
char
delim
)
{
std
::
vector
<
std
::
string
>
result
;
std
::
stringstream
strs
{
str
};
...
...
@@ -99,7 +99,7 @@ std::vector<string_pair> get_kv_pairs(int argc, char** argv, int begin = 1)
cerr
<<
"
\"
"
<<
argv
[
i
]
<<
"
\"
is not a key-value pair"
<<
endl
;
}
else
if
(
std
::
any_of
(
result
.
begin
(),
result
.
end
(),
[
&
](
string_pair
const
&
p
)
{
return
p
.
first
==
vec
[
0
];
}))
[
&
](
const
string_pair
&
p
)
{
return
p
.
first
==
vec
[
0
];
}))
{
cerr
<<
"key
\"
"
<<
vec
[
0
]
<<
"
\"
is already defined"
<<
endl
;
}
...
...
@@ -124,7 +124,7 @@ int main(int argc, char** argv)
/*
match_each(argv + 1, argv + argc)
(
on_arg_match >> [](
std::string const
& str)
on_arg_match >> [](
const std::string
& str)
{
cout << "matched \"" << str << "\"" << endl;
}
...
...
@@ -132,12 +132,12 @@ int main(int argc, char** argv)
match_each(argv + 1, argv + argc, [](char const* cstr) { return split(cstr, '='); })
(
on_arg_match >> [](
std::string const& key, std::string const
& value)
on_arg_match >> [](
const std::string& key, const std::string
& value)
{
cout << "key = \"" << key << "\", value = \"" << value << "\""
<< endl;
},
others() >> [](
any_tuple const
& oops)
others() >> [](
const any_tuple
& oops)
{
cout << "not a key value pair: " << to_string(oops) << endl;
}
...
...
@@ -197,7 +197,7 @@ int main(int argc, char** argv)
await_all_others_done
();
exit
(
0
);
},
on
(
"scheduler"
,
val
<
std
::
string
>
)
>>
[](
std
::
string
const
&
sched
)
on
(
"scheduler"
,
val
<
std
::
string
>
)
>>
[](
const
std
::
string
&
sched
)
{
if
(
sched
==
"thread_pool_scheduler"
)
{
...
...
unit_testing/test.hpp
View file @
54f080df
...
...
@@ -9,7 +9,7 @@
#include <type_traits>
template
<
typename
T1
,
typename
T2
>
inline
bool
cppa_check_value_fun_eq
(
T1
const
&
value1
,
T2
const
&
value2
,
inline
bool
cppa_check_value_fun_eq
(
const
T1
&
value1
,
const
T2
&
value2
,
typename
std
::
enable_if
<
!
std
::
is_integral
<
T1
>::
value
||
!
std
::
is_integral
<
T2
>::
value
...
...
@@ -29,7 +29,7 @@ inline bool cppa_check_value_fun_eq(T1 value1, T2 value2,
}
template
<
typename
T1
,
typename
T2
>
inline
bool
cppa_check_value_fun
(
T1
const
&
value1
,
T2
const
&
value2
,
inline
bool
cppa_check_value_fun
(
const
T1
&
value1
,
const
T2
&
value2
,
char
const
*
file_name
,
int
line_number
,
size_t
&
error_count
)
...
...
@@ -47,7 +47,7 @@ inline bool cppa_check_value_fun(T1 const& value1, T2 const& value2,
}
template
<
typename
T1
,
typename
T2
>
inline
void
cppa_check_value_verbose_fun
(
T1
const
&
value1
,
T2
const
&
value2
,
inline
void
cppa_check_value_verbose_fun
(
const
T1
&
value1
,
const
T2
&
value2
,
char
const
*
file_name
,
int
line_number
,
size_t
&
error_count
)
...
...
@@ -116,7 +116,7 @@ typedef std::pair<std::string, std::string> string_pair;
size_t
test__yield_interface
();
size_t
test__remote_actor
(
char
const
*
app_path
,
bool
is_client
,
std
::
vector
<
string_pair
>
const
&
args
);
const
std
::
vector
<
string_pair
>
&
args
);
size_t
test__ripemd_160
();
size_t
test__uniform_type
();
size_t
test__type_list
();
...
...
@@ -132,7 +132,7 @@ size_t test__primitive_variant();
size_t
test__fixed_vector
();
size_t
test__intrusive_containers
();
std
::
vector
<
std
::
string
>
split
(
std
::
string
const
&
str
,
char
delim
);
std
::
vector
<
std
::
string
>
split
(
const
std
::
string
&
str
,
char
delim
);
using
std
::
cout
;
using
std
::
endl
;
...
...
unit_testing/test__atom.cpp
View file @
54f080df
...
...
@@ -17,7 +17,7 @@ namespace {
constexpr
auto
s_foo
=
atom
(
"FooBar"
);
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
atom_value
const
&
a
)
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
atom_value
&
a
)
{
return
(
out
<<
to_string
(
a
));
}
...
...
unit_testing/test__intrusive_containers.cpp
View file @
54f080df
...
...
@@ -47,17 +47,17 @@ struct iint
~
iint
()
{
--
s_iint_instances
;
}
};
inline
bool
operator
==
(
iint
const
&
lhs
,
iint
cons
t
&
rhs
)
inline
bool
operator
==
(
const
iint
&
lhs
,
const
iin
t
&
rhs
)
{
return
lhs
.
value
==
rhs
.
value
;
}
inline
bool
operator
==
(
iint
cons
t
&
lhs
,
int
rhs
)
inline
bool
operator
==
(
const
iin
t
&
lhs
,
int
rhs
)
{
return
lhs
.
value
==
rhs
;
}
inline
bool
operator
==
(
int
lhs
,
iint
cons
t
&
rhs
)
inline
bool
operator
==
(
int
lhs
,
const
iin
t
&
rhs
)
{
return
lhs
==
rhs
.
value
;
}
...
...
@@ -104,7 +104,7 @@ size_t test__intrusive_containers()
// five elements + two dummies
CPPA_CHECK_EQUAL
(
s_iint_instances
,
7
);
ilist2
.
remove_if
([](
iint
cons
t
&
val
)
{
return
(
val
.
value
%
2
)
!=
0
;
});
ilist2
.
remove_if
([](
const
iin
t
&
val
)
{
return
(
val
.
value
%
2
)
!=
0
;
});
// two elements + two dummies
CPPA_CHECK_EQUAL
(
s_iint_instances
,
4
);
...
...
unit_testing/test__match.cpp
View file @
54f080df
...
...
@@ -242,7 +242,7 @@ size_t test__match()
std
::
vector
<
int
>
expr21_vec_a
{
1
,
2
,
3
};
std
::
vector
<
int
>
expr21_vec_b
{
1
,
0
,
2
};
auto
vec_sorted
=
[](
std
::
vector
<
int
>
const
&
vec
)
auto
vec_sorted
=
[](
const
std
::
vector
<
int
>
&
vec
)
{
return
std
::
is_sorted
(
vec
.
begin
(),
vec
.
end
());
};
...
...
@@ -276,7 +276,7 @@ size_t test__match()
{
sum
+=
s
;
},
on
<
string
>
().
when
(
_x1
.
starts_with
(
"-"
))
>>
[
&
](
string
const
&
str
)
on
<
string
>
().
when
(
_x1
.
starts_with
(
"-"
))
>>
[
&
](
const
string
&
str
)
{
match_each
(
str
.
begin
()
+
1
,
str
.
end
())
(
...
...
@@ -368,25 +368,25 @@ size_t test__match()
using std::placeholders::_1;
match_each(vec2.begin(), vec2.end(), std::bind(split, _1, '='))
(
on("a", val<string>) >> [&](
string const
& value)
on("a", val<string>) >> [&](
const string
& value)
{
CPPA_CHECK_EQUAL("0", value);
CPPA_CHECK_EQUAL(0, pmatches);
++pmatches;
},
on("b", val<string>) >> [&](
string const
& value)
on("b", val<string>) >> [&](
const string
& value)
{
CPPA_CHECK_EQUAL("1", value);
CPPA_CHECK_EQUAL(1, pmatches);
++pmatches;
},
on("c", val<string>) >> [&](
string const
& value)
on("c", val<string>) >> [&](
const string
& value)
{
CPPA_CHECK_EQUAL("2", value);
CPPA_CHECK_EQUAL(2, pmatches);
++pmatches;
}
others() >> [](
any_tuple const
& value)
others() >> [](
const any_tuple
& value)
{
cout << to_string(value) << endl;
}
...
...
unit_testing/test__pattern.cpp
View file @
54f080df
...
...
@@ -28,7 +28,7 @@ using std::string;
using
namespace
cppa
;
template
<
typename
Arr
>
string
plot
(
Arr
const
&
arr
)
string
plot
(
const
Arr
&
arr
)
{
std
::
ostringstream
oss
;
oss
<<
"{ "
;
...
...
@@ -47,7 +47,7 @@ static detail::types_array<int,anything,float> arr1;
static
detail
::
types_array
<
int
,
anything
,
foobar
>
arr2
;
template
<
typename
T
>
void
match_test
(
T
const
&
value
)
void
match_test
(
const
T
&
value
)
{
match
(
value
)
(
...
...
@@ -55,7 +55,7 @@ void match_test(T const& value)
{
cout
<<
"("
<<
a
<<
", "
<<
b
<<
", "
<<
c
<<
")"
<<
endl
;
},
on_arg_match
>>
[
&
](
string
const
&
str
)
on_arg_match
>>
[
&
](
const
string
&
str
)
{
cout
<<
str
<<
endl
;
}
...
...
unit_testing/test__primitive_variant.cpp
View file @
54f080df
...
...
@@ -11,14 +11,14 @@ struct streamer
std
::
ostream
&
o
;
streamer
(
std
::
ostream
&
mo
)
:
o
(
mo
)
{
}
template
<
typename
T
>
void
operator
()(
T
const
&
value
)
void
operator
()(
const
T
&
value
)
{
o
<<
value
;
}
};
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
o
,
c
ppa
::
primitive_variant
cons
t
&
pv
)
c
onst
cppa
::
primitive_varian
t
&
pv
)
{
streamer
s
{
o
};
pv
.
apply
(
s
);
...
...
unit_testing/test__remote_actor.cpp
View file @
54f080df
...
...
@@ -16,10 +16,10 @@ using namespace cppa;
namespace
{
void
client_part
(
std
::
vector
<
string_pair
>
const
&
args
)
void
client_part
(
const
std
::
vector
<
string_pair
>
&
args
)
{
auto
i
=
std
::
find_if
(
args
.
begin
(),
args
.
end
(),
[](
string_pair
const
&
p
)
{
return
p
.
first
==
"port"
;
});
[](
const
string_pair
&
p
)
{
return
p
.
first
==
"port"
;
});
if
(
i
==
args
.
end
())
{
throw
std
::
runtime_error
(
"no port specified"
);
...
...
@@ -34,7 +34,7 @@ void client_part(std::vector<string_pair> const& args)
}
// namespace <anonymous>
size_t
test__remote_actor
(
char
const
*
app_path
,
bool
is_client
,
std
::
vector
<
string_pair
>
const
&
args
)
const
std
::
vector
<
string_pair
>
&
args
)
{
if
(
is_client
)
{
...
...
unit_testing/test__tuple.cpp
View file @
54f080df
...
...
@@ -50,7 +50,7 @@ std::string int2str(int i)
return
std
::
to_string
(
i
);
}
option
<
int
>
str2int
(
std
::
string
const
&
str
)
option
<
int
>
str2int
(
const
std
::
string
&
str
)
{
char
*
endptr
=
nullptr
;
int
result
=
static_cast
<
int
>
(
strtol
(
str
.
c_str
(),
&
endptr
,
10
));
...
...
@@ -141,7 +141,7 @@ size_t test__tuple()
CPPA_CHECK_EQUAL
(
"f02"
,
invoked
);
invoked
=
""
;
auto
f03
=
on
(
42
,
val
<
int
>
)
>>
[
&
](
int
cons
t
&
a
,
int
&
)
{
invoked
=
"f03"
;
CPPA_CHECK_EQUAL
(
42
,
a
);
};
auto
f03
=
on
(
42
,
val
<
int
>
)
>>
[
&
](
const
in
t
&
a
,
int
&
)
{
invoked
=
"f03"
;
CPPA_CHECK_EQUAL
(
42
,
a
);
};
CPPA_CHECK_NOT_INVOKED
(
f03
,
(
0
,
0
));
CPPA_CHECK_INVOKED
(
f03
,
(
42
,
42
));
...
...
@@ -219,8 +219,8 @@ size_t test__tuple()
CPPA_CHECK
(
f10
(
"a"
,
"b"
,
"c"
));
std
::
string
foobar
=
"foobar"
;
CPPA_CHECK
(
f10
(
foobar
,
"b"
,
"c"
));
CPPA_CHECK
(
f10
(
"a"
,
static_cast
<
std
::
string
const
&>
(
foobar
),
"b"
,
"c"
));
//CPPA_CHECK(f10(
static_cast<std::string const
&>(foobar), "b", "c"));
CPPA_CHECK
(
f10
(
"a"
,
static_cast
<
const
std
::
string
&>
(
foobar
),
"b"
,
"c"
));
//CPPA_CHECK(f10(
const static_cast<std::string
&>(foobar), "b", "c"));
int
f11_fun
=
0
;
auto
f11
=
...
...
@@ -265,7 +265,7 @@ size_t test__tuple()
int
f13_fun
=
0
;
auto
f13
=
(
on
<
int
,
anything
,
std
::
string
,
anything
,
int
>
().
when
(
_x1
<
_x3
&&
_x2
.
starts_with
(
"-"
))
>>
[
&
](
int
a
,
std
::
string
const
&
str
,
int
b
)
on
<
int
,
anything
,
std
::
string
,
anything
,
int
>
().
when
(
_x1
<
_x3
&&
_x2
.
starts_with
(
"-"
))
>>
[
&
](
int
a
,
const
std
::
string
&
str
,
int
b
)
{
CPPA_CHECK_EQUAL
(
"-h"
,
str
);
CPPA_CHECK_EQUAL
(
1
,
a
);
...
...
@@ -273,7 +273,7 @@ size_t test__tuple()
f13_fun
=
1
;
invoked
=
"f13"
;
},
on
<
anything
,
std
::
string
,
anything
,
int
,
anything
,
float
,
anything
>
()
>>
[
&
](
std
::
string
const
&
str
,
int
a
,
float
b
)
on
<
anything
,
std
::
string
,
anything
,
int
,
anything
,
float
,
anything
>
()
>>
[
&
](
const
std
::
string
&
str
,
int
a
,
float
b
)
{
CPPA_CHECK_EQUAL
(
"h"
,
str
);
CPPA_CHECK_EQUAL
(
12
,
a
);
...
...
@@ -537,7 +537,7 @@ size_t test__tuple()
{
auto
&
v0
=
*
v0opt
;
CPPA_CHECK
((
std
::
is_same
<
decltype
(
v0
),
cow_tuple
<
std
::
string
>&>::
value
));
CPPA_CHECK
((
std
::
is_same
<
decltype
(
get
<
0
>
(
v0
)),
std
::
string
const
&>::
value
));
CPPA_CHECK
((
std
::
is_same
<
decltype
(
get
<
0
>
(
v0
)),
const
std
::
string
&>::
value
));
CPPA_CHECK_EQUAL
(
v0
.
size
(),
1
);
CPPA_CHECK_EQUAL
(
get
<
0
>
(
v0
),
"1"
);
CPPA_CHECK_EQUAL
(
get
<
0
>
(
t0
),
get
<
0
>
(
v0
));
...
...
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