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
42db08af
Commit
42db08af
authored
Jan 01, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coding style
parent
71416e36
Changes
93
Hide whitespace changes
Inline
Side-by-side
Showing
93 changed files
with
553 additions
and
696 deletions
+553
-696
cppa/abstract_actor.hpp
cppa/abstract_actor.hpp
+5
-5
cppa/abstract_event_based_actor.hpp
cppa/abstract_event_based_actor.hpp
+2
-2
cppa/actor.hpp
cppa/actor.hpp
+7
-7
cppa/actor_proxy.hpp
cppa/actor_proxy.hpp
+4
-4
cppa/announce.hpp
cppa/announce.hpp
+5
-5
cppa/any_tuple.hpp
cppa/any_tuple.hpp
+15
-15
cppa/anything.hpp
cppa/anything.hpp
+2
-2
cppa/atom.hpp
cppa/atom.hpp
+1
-1
cppa/attachable.hpp
cppa/attachable.hpp
+6
-6
cppa/binary_deserializer.hpp
cppa/binary_deserializer.hpp
+6
-6
cppa/binary_serializer.hpp
cppa/binary_serializer.hpp
+4
-4
cppa/channel.hpp
cppa/channel.hpp
+1
-1
cppa/cow_ptr.hpp
cppa/cow_ptr.hpp
+9
-9
cppa/cppa.hpp
cppa/cppa.hpp
+22
-77
cppa/deserializer.hpp
cppa/deserializer.hpp
+4
-4
cppa/detail/abstract_scheduled_actor.hpp
cppa/detail/abstract_scheduled_actor.hpp
+4
-4
cppa/detail/abstract_tuple.hpp
cppa/detail/abstract_tuple.hpp
+3
-3
cppa/detail/actor_proxy_cache.hpp
cppa/detail/actor_proxy_cache.hpp
+3
-3
cppa/detail/addressed_message.hpp
cppa/detail/addressed_message.hpp
+12
-12
cppa/detail/atom_val.hpp
cppa/detail/atom_val.hpp
+1
-1
cppa/detail/channel.hpp
cppa/detail/channel.hpp
+1
-1
cppa/detail/converted_thread_context.hpp
cppa/detail/converted_thread_context.hpp
+2
-2
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
+17
-17
cppa/detail/demangle.hpp
cppa/detail/demangle.hpp
+1
-1
cppa/detail/empty_tuple.hpp
cppa/detail/empty_tuple.hpp
+3
-3
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
+3
-3
cppa/detail/intermediate.hpp
cppa/detail/intermediate.hpp
+3
-3
cppa/detail/invokable.hpp
cppa/detail/invokable.hpp
+18
-18
cppa/detail/list_member.hpp
cppa/detail/list_member.hpp
+5
-5
cppa/detail/mailman.hpp
cppa/detail/mailman.hpp
+8
-8
cppa/detail/map_member.hpp
cppa/detail/map_member.hpp
+7
-7
cppa/detail/native_socket.hpp
cppa/detail/native_socket.hpp
+2
-2
cppa/detail/object_array.hpp
cppa/detail/object_array.hpp
+5
-5
cppa/detail/object_impl.hpp
cppa/detail/object_impl.hpp
+4
-4
cppa/detail/pair_member.hpp
cppa/detail/pair_member.hpp
+2
-2
cppa/detail/pattern_details.hpp
cppa/detail/pattern_details.hpp
+20
-20
cppa/detail/post_office.hpp
cppa/detail/post_office.hpp
+3
-3
cppa/detail/post_office_msg.hpp
cppa/detail/post_office_msg.hpp
+8
-8
cppa/detail/primitive_member.hpp
cppa/detail/primitive_member.hpp
+2
-2
cppa/detail/receive_loop_helper.hpp
cppa/detail/receive_loop_helper.hpp
+0
-28
cppa/detail/ref_counted_impl.hpp
cppa/detail/ref_counted_impl.hpp
+2
-2
cppa/detail/serialize_tuple.hpp
cppa/detail/serialize_tuple.hpp
+2
-2
cppa/detail/tdata.hpp
cppa/detail/tdata.hpp
+11
-11
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_vals.hpp
cppa/detail/tuple_vals.hpp
+8
-8
cppa/detail/uniform_type_info_map.hpp
cppa/detail/uniform_type_info_map.hpp
+4
-4
cppa/exception.hpp
cppa/exception.hpp
+3
-3
cppa/from_string.hpp
cppa/from_string.hpp
+2
-2
cppa/get.hpp
cppa/get.hpp
+6
-6
cppa/get_view.hpp
cppa/get_view.hpp
+1
-1
cppa/group.hpp
cppa/group.hpp
+12
-12
cppa/intrusive_ptr.hpp
cppa/intrusive_ptr.hpp
+13
-13
cppa/invoke.hpp
cppa/invoke.hpp
+5
-5
cppa/invoke_rules.hpp
cppa/invoke_rules.hpp
+7
-35
cppa/object.hpp
cppa/object.hpp
+15
-15
cppa/on.hpp
cppa/on.hpp
+13
-14
cppa/pattern.hpp
cppa/pattern.hpp
+7
-12
cppa/primitive_type.hpp
cppa/primitive_type.hpp
+2
-2
cppa/primitive_variant.hpp
cppa/primitive_variant.hpp
+16
-16
cppa/process_information.hpp
cppa/process_information.hpp
+13
-13
cppa/scheduler.hpp
cppa/scheduler.hpp
+2
-2
cppa/self.hpp
cppa/self.hpp
+2
-2
cppa/serializer.hpp
cppa/serializer.hpp
+6
-6
cppa/to_string.hpp
cppa/to_string.hpp
+2
-2
cppa/tuple.hpp
cppa/tuple.hpp
+12
-12
cppa/tuple_view.hpp
cppa/tuple_view.hpp
+20
-20
cppa/uniform_type_info.hpp
cppa/uniform_type_info.hpp
+22
-22
cppa/util/abstract_uniform_type_info.hpp
cppa/util/abstract_uniform_type_info.hpp
+6
-6
cppa/util/any_tuple_iterator.hpp
cppa/util/any_tuple_iterator.hpp
+9
-9
cppa/util/comparable.hpp
cppa/util/comparable.hpp
+18
-18
cppa/util/compare_tuples.hpp
cppa/util/compare_tuples.hpp
+7
-7
cppa/util/duration.hpp
cppa/util/duration.hpp
+3
-3
cppa/util/either.hpp
cppa/util/either.hpp
+15
-15
cppa/util/fixed_vector.hpp
cppa/util/fixed_vector.hpp
+4
-4
cppa/util/has_copy_member_fun.hpp
cppa/util/has_copy_member_fun.hpp
+2
-2
cppa/util/is_comparable.hpp
cppa/util/is_comparable.hpp
+2
-2
cppa/util/is_copyable.hpp
cppa/util/is_copyable.hpp
+2
-2
cppa/util/is_iterable.hpp
cppa/util/is_iterable.hpp
+2
-2
cppa/util/remove_const_reference.hpp
cppa/util/remove_const_reference.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/single_reader_queue.hpp
cppa/util/single_reader_queue.hpp
+2
-2
cppa/util/type_list.hpp
cppa/util/type_list.hpp
+6
-4
cppa/util/void_type.hpp
cppa/util/void_type.hpp
+1
-1
src/cppa.cpp
src/cppa.cpp
+8
-7
src/invoke_rules.cpp
src/invoke_rules.cpp
+0
-28
unit_testing/ping_pong.cpp
unit_testing/ping_pong.cpp
+3
-3
unit_testing/test__pattern.cpp
unit_testing/test__pattern.cpp
+1
-1
unit_testing/test__spawn.cpp
unit_testing/test__spawn.cpp
+0
-1
No files found.
cppa/abstract_actor.hpp
View file @
42db08af
...
@@ -51,7 +51,7 @@ class abstract_actor : public Base
...
@@ -51,7 +51,7 @@ class abstract_actor : public Base
}
}
queue_node
(
actor
*
from
,
const
any_tuple
&
content
)
queue_node
(
actor
*
from
,
any_tuple
const
&
content
)
:
next
(
nullptr
),
sender
(
from
),
msg
(
content
)
:
next
(
nullptr
),
sender
(
from
),
msg
(
content
)
{
{
...
@@ -69,7 +69,7 @@ class abstract_actor : public Base
...
@@ -69,7 +69,7 @@ class abstract_actor : public Base
}
}
template
<
class
List
,
typename
Element
>
template
<
class
List
,
typename
Element
>
bool
unique_insert
(
List
&
lst
,
const
Elemen
t
&
e
)
bool
unique_insert
(
List
&
lst
,
Element
cons
t
&
e
)
{
{
auto
end
=
lst
.
end
();
auto
end
=
lst
.
end
();
auto
i
=
std
::
find
(
lst
.
begin
(),
end
,
e
);
auto
i
=
std
::
find
(
lst
.
begin
(),
end
,
e
);
...
@@ -82,7 +82,7 @@ class abstract_actor : public Base
...
@@ -82,7 +82,7 @@ class abstract_actor : public Base
}
}
template
<
class
List
,
typename
Iterator
,
typename
Element
>
template
<
class
List
,
typename
Iterator
,
typename
Element
>
int
erase_all
(
List
&
lst
,
Iterator
begin
,
Iterator
end
,
const
Elemen
t
&
e
)
int
erase_all
(
List
&
lst
,
Iterator
begin
,
Iterator
end
,
Element
cons
t
&
e
)
{
{
auto
i
=
std
::
find
(
begin
,
end
,
e
);
auto
i
=
std
::
find
(
begin
,
end
,
e
);
if
(
i
!=
end
)
if
(
i
!=
end
)
...
@@ -93,7 +93,7 @@ class abstract_actor : public Base
...
@@ -93,7 +93,7 @@ class abstract_actor : public Base
}
}
template
<
class
List
,
typename
Element
>
template
<
class
List
,
typename
Element
>
int
erase_all
(
List
&
lst
,
const
Elemen
t
&
e
)
int
erase_all
(
List
&
lst
,
Element
cons
t
&
e
)
{
{
return
erase_all
(
lst
,
lst
.
begin
(),
lst
.
end
(),
e
);
return
erase_all
(
lst
,
lst
.
begin
(),
lst
.
end
(),
e
);
}
}
...
@@ -191,7 +191,7 @@ class abstract_actor : public Base
...
@@ -191,7 +191,7 @@ class abstract_actor : public Base
}
}
}
}
void
detach
(
const
attachable
::
token
&
what
)
/*override*/
void
detach
(
attachable
::
token
const
&
what
)
/*override*/
{
{
attachable_ptr
uptr
;
attachable_ptr
uptr
;
// lifetime scope of guard
// lifetime scope of guard
...
...
cppa/abstract_event_based_actor.hpp
View file @
42db08af
...
@@ -63,8 +63,8 @@ class abstract_event_based_actor : public detail::abstract_scheduled_actor
...
@@ -63,8 +63,8 @@ class abstract_event_based_actor : public detail::abstract_scheduled_actor
{
{
stack_element
()
=
delete
;
stack_element
()
=
delete
;
stack_element
(
const
stack_elemen
t
&
)
=
delete
;
stack_element
(
stack_element
cons
t
&
)
=
delete
;
stack_element
&
operator
=
(
const
stack_elemen
t
&
)
=
delete
;
stack_element
&
operator
=
(
stack_element
cons
t
&
)
=
delete
;
util
::
either
<
invoke_rules
*
,
timed_invoke_rules
*>
m_ptr
;
util
::
either
<
invoke_rules
*
,
timed_invoke_rules
*>
m_ptr
;
bool
m_ownership
;
bool
m_ownership
;
...
...
cppa/actor.hpp
View file @
42db08af
...
@@ -32,10 +32,10 @@ class actor : public channel
...
@@ -32,10 +32,10 @@ class actor : public channel
protected:
protected:
actor
(
const
process_information_ptr
&
parent
=
process_information
::
get
());
actor
(
process_information_ptr
const
&
parent
=
process_information
::
get
());
actor
(
std
::
uint32_t
aid
,
actor
(
std
::
uint32_t
aid
,
const
process_information_ptr
&
parent
=
process_information
::
get
());
process_information_ptr
const
&
parent
=
process_information
::
get
());
public:
public:
...
@@ -67,7 +67,7 @@ class actor : public channel
...
@@ -67,7 +67,7 @@ class actor : public channel
/**
/**
* @brief Detaches the first attached object that matches @p what.
* @brief Detaches the first attached object that matches @p what.
*/
*/
virtual
void
detach
(
const
attachable
::
token
&
what
)
=
0
;
virtual
void
detach
(
attachable
::
token
const
&
what
)
=
0
;
template
<
typename
T
>
template
<
typename
T
>
bool
attach
(
std
::
unique_ptr
<
T
>&&
ptr
,
bool
attach
(
std
::
unique_ptr
<
T
>&&
ptr
,
...
@@ -87,7 +87,7 @@ class actor : public channel
...
@@ -87,7 +87,7 @@ class actor : public channel
* @note Groups are leaved automatically if the Actor finishes
* @note Groups are leaved automatically if the Actor finishes
* execution.
* execution.
*/
*/
void
leave
(
const
group_ptr
&
what
);
void
leave
(
group_ptr
const
&
what
);
/**
/**
* @brief Links this actor to @p other.
* @brief Links this actor to @p other.
...
@@ -148,7 +148,7 @@ class actor : public channel
...
@@ -148,7 +148,7 @@ class actor : public channel
* @brief Gets the {@link process_information} of the parent process.
* @brief Gets the {@link process_information} of the parent process.
* @returns The {@link process_information} of the parent process.
* @returns The {@link process_information} of the parent process.
*/
*/
inline
const
process_information
&
parent_process
()
const
;
inline
process_information
const
&
parent_process
()
const
;
/**
/**
* @brief Gets the {@link process_information} pointer
* @brief Gets the {@link process_information} pointer
...
@@ -185,7 +185,7 @@ typedef intrusive_ptr<actor> actor_ptr;
...
@@ -185,7 +185,7 @@ typedef intrusive_ptr<actor> actor_ptr;
* inline and template member function implementations *
* inline and template member function implementations *
******************************************************************************/
******************************************************************************/
inline
const
process_information
&
actor
::
parent_process
()
const
inline
process_information
const
&
actor
::
parent_process
()
const
{
{
return
*
m_parent_process
;
return
*
m_parent_process
;
}
}
...
@@ -230,7 +230,7 @@ class functor_attachable : public attachable
...
@@ -230,7 +230,7 @@ class functor_attachable : public attachable
m_functor
(
reason
);
m_functor
(
reason
);
}
}
bool
matches
(
const
attachable
::
token
&
)
bool
matches
(
attachable
::
token
const
&
)
{
{
return
false
;
return
false
;
}
}
...
...
cppa/actor_proxy.hpp
View file @
42db08af
...
@@ -14,16 +14,16 @@ class actor_proxy : public abstract_actor<actor>
...
@@ -14,16 +14,16 @@ class actor_proxy : public abstract_actor<actor>
typedef
abstract_actor
<
actor
>
super
;
typedef
abstract_actor
<
actor
>
super
;
void
forward_message
(
const
process_information_ptr
&
,
void
forward_message
(
process_information_ptr
const
&
,
actor
*
,
const
any_tuple
&
);
actor
*
,
any_tuple
const
&
);
public:
public:
actor_proxy
(
std
::
uint32_t
mid
,
const
process_information_ptr
&
parent
);
actor_proxy
(
std
::
uint32_t
mid
,
process_information_ptr
const
&
parent
);
void
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
);
void
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
);
void
enqueue
(
actor
*
sender
,
const
any_tuple
&
msg
);
void
enqueue
(
actor
*
sender
,
any_tuple
const
&
msg
);
void
link_to
(
intrusive_ptr
<
actor
>&
other
);
void
link_to
(
intrusive_ptr
<
actor
>&
other
);
...
...
cppa/announce.hpp
View file @
42db08af
...
@@ -68,7 +68,7 @@ namespace cppa {
...
@@ -68,7 +68,7 @@ namespace cppa {
* instance (mapped to @p plain_type); otherwise @c false
* instance (mapped to @p plain_type); otherwise @c false
* is returned and @p uniform_type was deleted.
* is returned and @p uniform_type was deleted.
*/
*/
bool
announce
(
const
std
::
type_info
&
tinfo
,
uniform_type_info
*
utype
);
bool
announce
(
std
::
type_info
const
&
tinfo
,
uniform_type_info
*
utype
);
// deals with member pointer
// deals with member pointer
/**
/**
...
@@ -80,7 +80,7 @@ bool announce(const std::type_info& tinfo, uniform_type_info* utype);
...
@@ -80,7 +80,7 @@ bool announce(const std::type_info& tinfo, uniform_type_info* utype);
*/
*/
template
<
class
C
,
class
Parent
,
typename
...
Args
>
template
<
class
C
,
class
Parent
,
typename
...
Args
>
std
::
pair
<
C
Parent
::*
,
util
::
abstract_uniform_type_info
<
C
>*>
std
::
pair
<
C
Parent
::*
,
util
::
abstract_uniform_type_info
<
C
>*>
compound_member
(
C
Parent
::*
c_ptr
,
const
Args
&
...
args
)
compound_member
(
C
Parent
::*
c_ptr
,
Args
const
&
...
args
)
{
{
return
{
c_ptr
,
new
detail
::
default_uniform_type_info_impl
<
C
>
(
args
...)
};
return
{
c_ptr
,
new
detail
::
default_uniform_type_info_impl
<
C
>
(
args
...)
};
}
}
...
@@ -88,7 +88,7 @@ compound_member(C Parent::*c_ptr, const Args&... args)
...
@@ -88,7 +88,7 @@ compound_member(C Parent::*c_ptr, const Args&... args)
// deals with getter returning a mutable reference
// deals with getter returning a mutable reference
template
<
class
C
,
class
Parent
,
typename
...
Args
>
template
<
class
C
,
class
Parent
,
typename
...
Args
>
std
::
pair
<
C
&
(
Parent
::*
)(),
util
::
abstract_uniform_type_info
<
C
>*>
std
::
pair
<
C
&
(
Parent
::*
)(),
util
::
abstract_uniform_type_info
<
C
>*>
compound_member
(
C
&
(
Parent
::*
c_ptr
)(),
const
Args
&
...
args
)
compound_member
(
C
&
(
Parent
::*
c_ptr
)(),
Args
const
&
...
args
)
{
{
return
{
c_ptr
,
new
detail
::
default_uniform_type_info_impl
<
C
>
(
args
...)
};
return
{
c_ptr
,
new
detail
::
default_uniform_type_info_impl
<
C
>
(
args
...)
};
}
}
...
@@ -99,7 +99,7 @@ template<class Parent, typename GRes,
...
@@ -99,7 +99,7 @@ template<class Parent, typename GRes,
std
::
pair
<
std
::
pair
<
GRes
(
Parent
::*
)()
const
,
SRes
(
Parent
::*
)(
SArg
)
>
,
std
::
pair
<
std
::
pair
<
GRes
(
Parent
::*
)()
const
,
SRes
(
Parent
::*
)(
SArg
)
>
,
util
::
abstract_uniform_type_info
<
typename
util
::
rm_ref
<
GRes
>::
type
>*>
util
::
abstract_uniform_type_info
<
typename
util
::
rm_ref
<
GRes
>::
type
>*>
compound_member
(
const
std
::
pair
<
GRes
(
Parent
::*
)()
const
,
SRes
(
Parent
::*
)(
SArg
)
>&
gspair
,
compound_member
(
const
std
::
pair
<
GRes
(
Parent
::*
)()
const
,
SRes
(
Parent
::*
)(
SArg
)
>&
gspair
,
const
Args
&
...
args
)
Args
const
&
...
args
)
{
{
return
{
gspair
,
new
detail
::
default_uniform_type_info_impl
<
typename
util
::
rm_ref
<
GRes
>::
type
>
(
args
...)
};
return
{
gspair
,
new
detail
::
default_uniform_type_info_impl
<
typename
util
::
rm_ref
<
GRes
>::
type
>
(
args
...)
};
}
}
...
@@ -112,7 +112,7 @@ compound_member(const std::pair<GRes (Parent::*)() const, SRes (Parent::*)(SArg)
...
@@ -112,7 +112,7 @@ compound_member(const std::pair<GRes (Parent::*)() const, SRes (Parent::*)(SArg)
* otherwise @c false.
* otherwise @c false.
*/
*/
template
<
typename
T
,
typename
...
Args
>
template
<
typename
T
,
typename
...
Args
>
inline
bool
announce
(
const
Args
&
...
args
)
inline
bool
announce
(
Args
const
&
...
args
)
{
{
return
announce
(
typeid
(
T
),
return
announce
(
typeid
(
T
),
new
detail
::
default_uniform_type_info_impl
<
T
>
(
args
...));
new
detail
::
default_uniform_type_info_impl
<
T
>
(
args
...));
...
...
cppa/any_tuple.hpp
View file @
42db08af
...
@@ -23,7 +23,7 @@ class any_tuple
...
@@ -23,7 +23,7 @@ class any_tuple
cow_ptr
<
detail
::
abstract_tuple
>
m_vals
;
cow_ptr
<
detail
::
abstract_tuple
>
m_vals
;
explicit
any_tuple
(
co
nst
cow_ptr
<
detail
::
abstract_tuple
>
&
vals
);
explicit
any_tuple
(
co
w_ptr
<
detail
::
abstract_tuple
>
const
&
vals
);
public:
public:
...
@@ -32,32 +32,32 @@ class any_tuple
...
@@ -32,32 +32,32 @@ class any_tuple
any_tuple
();
any_tuple
();
template
<
typename
...
Args
>
template
<
typename
...
Args
>
any_tuple
(
const
tuple
<
Args
...
>
&
t
)
:
m_vals
(
t
.
vals
())
{
}
any_tuple
(
tuple
<
Args
...
>
const
&
t
)
:
m_vals
(
t
.
vals
())
{
}
template
<
typename
...
Args
>
template
<
typename
...
Args
>
any_tuple
(
const
tuple_view
<
Args
...
>
&
t
)
:
m_vals
(
t
.
vals
())
{
}
any_tuple
(
tuple_view
<
Args
...
>
const
&
t
)
:
m_vals
(
t
.
vals
())
{
}
explicit
any_tuple
(
detail
::
abstract_tuple
*
);
explicit
any_tuple
(
detail
::
abstract_tuple
*
);
any_tuple
(
any_tuple
&&
);
any_tuple
(
any_tuple
&&
);
any_tuple
(
const
any_tuple
&
)
=
default
;
any_tuple
(
any_tuple
const
&
)
=
default
;
any_tuple
&
operator
=
(
any_tuple
&&
);
any_tuple
&
operator
=
(
any_tuple
&&
);
any_tuple
&
operator
=
(
const
any_tuple
&
)
=
default
;
any_tuple
&
operator
=
(
any_tuple
const
&
)
=
default
;
size_t
size
()
const
;
size_t
size
()
const
;
void
*
mutable_at
(
size_t
p
);
void
*
mutable_at
(
size_t
p
);
const
void
*
at
(
size_t
p
)
const
;
void
const
*
at
(
size_t
p
)
const
;
const
uniform_type_info
&
utype_info_at
(
size_t
p
)
const
;
uniform_type_info
const
&
utype_info_at
(
size_t
p
)
const
;
co
nst
cow_ptr
<
detail
::
abstract_tuple
>
&
vals
()
const
;
co
w_ptr
<
detail
::
abstract_tuple
>
const
&
vals
()
const
;
bool
equals
(
const
any_tuple
&
other
)
const
;
bool
equals
(
any_tuple
const
&
other
)
const
;
any_tuple
tail
(
size_t
offset
=
1
)
const
;
any_tuple
tail
(
size_t
offset
=
1
)
const
;
...
@@ -67,27 +67,27 @@ class any_tuple
...
@@ -67,27 +67,27 @@ class any_tuple
}
}
template
<
typename
T
>
template
<
typename
T
>
inline
const
T
&
get_as
(
size_t
p
)
const
;
inline
T
const
&
get_as
(
size_t
p
)
const
;
template
<
typename
T
>
template
<
typename
T
>
inline
T
&
get_mutable_as
(
size_t
p
);
inline
T
&
get_mutable_as
(
size_t
p
);
};
};
inline
bool
operator
==
(
const
any_tuple
&
lhs
,
const
any_tuple
&
rhs
)
inline
bool
operator
==
(
any_tuple
const
&
lhs
,
any_tuple
const
&
rhs
)
{
{
return
lhs
.
equals
(
rhs
);
return
lhs
.
equals
(
rhs
);
}
}
inline
bool
operator
!=
(
const
any_tuple
&
lhs
,
const
any_tuple
&
rhs
)
inline
bool
operator
!=
(
any_tuple
const
&
lhs
,
any_tuple
const
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
template
<
typename
T
>
template
<
typename
T
>
inline
const
T
&
any_tuple
::
get_as
(
size_t
p
)
const
inline
T
const
&
any_tuple
::
get_as
(
size_t
p
)
const
{
{
return
*
reinterpret_cast
<
const
T
*>
(
at
(
p
));
return
*
reinterpret_cast
<
T
const
*>
(
at
(
p
));
}
}
template
<
typename
T
>
template
<
typename
T
>
...
@@ -97,7 +97,7 @@ inline T& any_tuple::get_mutable_as(size_t p)
...
@@ -97,7 +97,7 @@ inline T& any_tuple::get_mutable_as(size_t p)
}
}
template
<
typename
...
Types
>
template
<
typename
...
Types
>
tuple_view
<
Types
...
>
tuple_cast
(
const
any_tuple
&
tup
)
tuple_view
<
Types
...
>
tuple_cast
(
any_tuple
const
&
tup
)
{
{
return
tuple_view
<
Types
...
>::
from
(
tup
.
vals
());
return
tuple_view
<
Types
...
>::
from
(
tup
.
vals
());
}
}
...
...
cppa/anything.hpp
View file @
42db08af
...
@@ -8,12 +8,12 @@ namespace cppa {
...
@@ -8,12 +8,12 @@ namespace cppa {
*/
*/
struct
anything
{
};
struct
anything
{
};
inline
bool
operator
==
(
const
anything
&
,
const
anything
&
)
inline
bool
operator
==
(
anything
const
&
,
anything
const
&
)
{
{
return
true
;
return
true
;
}
}
inline
bool
operator
!=
(
const
anything
&
,
const
anything
&
)
inline
bool
operator
!=
(
anything
const
&
,
anything
const
&
)
{
{
return
false
;
return
false
;
}
}
...
...
cppa/atom.hpp
View file @
42db08af
...
@@ -9,7 +9,7 @@ namespace cppa {
...
@@ -9,7 +9,7 @@ namespace cppa {
enum
class
atom_value
:
std
::
uint64_t
{
dirty_little_hack
=
37337
};
enum
class
atom_value
:
std
::
uint64_t
{
dirty_little_hack
=
37337
};
std
::
string
to_string
(
const
atom_value
&
a
);
std
::
string
to_string
(
atom_value
const
&
a
);
template
<
size_t
Size
>
template
<
size_t
Size
>
constexpr
atom_value
atom
(
const
char
(
&
str
)
[
Size
])
constexpr
atom_value
atom
(
const
char
(
&
str
)
[
Size
])
...
...
cppa/attachable.hpp
View file @
42db08af
...
@@ -12,8 +12,8 @@ namespace cppa {
...
@@ -12,8 +12,8 @@ namespace cppa {
class
attachable
class
attachable
{
{
attachable
(
const
attachable
&
)
=
delete
;
attachable
(
attachable
const
&
)
=
delete
;
attachable
&
operator
=
(
const
attachable
&
)
=
delete
;
attachable
&
operator
=
(
attachable
const
&
)
=
delete
;
protected:
protected:
...
@@ -23,9 +23,9 @@ class attachable
...
@@ -23,9 +23,9 @@ class attachable
struct
token
struct
token
{
{
const
std
::
type_info
&
subtype
;
std
::
type_info
const
&
subtype
;
const
void
*
ptr
;
void
const
*
ptr
;
inline
token
(
const
std
::
type_info
&
msubtype
,
const
void
*
mptr
)
inline
token
(
std
::
type_info
const
&
msubtype
,
void
const
*
mptr
)
:
subtype
(
msubtype
),
ptr
(
mptr
)
:
subtype
(
msubtype
),
ptr
(
mptr
)
{
{
}
}
...
@@ -41,7 +41,7 @@ class attachable
...
@@ -41,7 +41,7 @@ class attachable
*/
*/
virtual
void
actor_exited
(
std
::
uint32_t
reason
)
=
0
;
virtual
void
actor_exited
(
std
::
uint32_t
reason
)
=
0
;
virtual
bool
matches
(
const
token
&
)
=
0
;
virtual
bool
matches
(
token
const
&
)
=
0
;
};
};
...
...
cppa/binary_deserializer.hpp
View file @
42db08af
...
@@ -8,25 +8,25 @@ namespace cppa {
...
@@ -8,25 +8,25 @@ namespace cppa {
class
binary_deserializer
:
public
deserializer
class
binary_deserializer
:
public
deserializer
{
{
c
onst
char
*
pos
;
c
har
const
*
pos
;
c
onst
char
*
end
;
c
har
const
*
end
;
void
range_check
(
size_t
read_size
);
void
range_check
(
size_t
read_size
);
public:
public:
binary_deserializer
(
c
onst
char
*
buf
,
size_t
buf_size
);
binary_deserializer
(
c
har
const
*
buf
,
size_t
buf_size
);
binary_deserializer
(
c
onst
char
*
begin
,
const
char
*
end
);
binary_deserializer
(
c
har
const
*
begin
,
char
const
*
end
);
std
::
string
seek_object
();
std
::
string
seek_object
();
std
::
string
peek_object
();
std
::
string
peek_object
();
void
begin_object
(
const
std
::
string
&
type_name
);
void
begin_object
(
std
::
string
const
&
type_name
);
void
end_object
();
void
end_object
();
size_t
begin_sequence
();
size_t
begin_sequence
();
void
end_sequence
();
void
end_sequence
();
primitive_variant
read_value
(
primitive_type
ptype
);
primitive_variant
read_value
(
primitive_type
ptype
);
void
read_tuple
(
size_t
size
,
void
read_tuple
(
size_t
size
,
const
primitive_type
*
ptypes
,
primitive_type
const
*
ptypes
,
primitive_variant
*
storage
);
primitive_variant
*
storage
);
};
};
...
...
cppa/binary_serializer.hpp
View file @
42db08af
...
@@ -26,7 +26,7 @@ class binary_serializer : public serializer
...
@@ -26,7 +26,7 @@ class binary_serializer : public serializer
~
binary_serializer
();
~
binary_serializer
();
void
begin_object
(
const
std
::
string
&
tname
);
void
begin_object
(
std
::
string
const
&
tname
);
void
end_object
();
void
end_object
();
...
@@ -34,9 +34,9 @@ class binary_serializer : public serializer
...
@@ -34,9 +34,9 @@ class binary_serializer : public serializer
void
end_sequence
();
void
end_sequence
();
void
write_value
(
const
primitive_varian
t
&
value
);
void
write_value
(
primitive_variant
cons
t
&
value
);
void
write_tuple
(
size_t
size
,
const
primitive_varian
t
*
values
);
void
write_tuple
(
size_t
size
,
primitive_variant
cons
t
*
values
);
/**
/**
* @brief Takes the internal buffer and returns it.
* @brief Takes the internal buffer and returns it.
...
@@ -52,7 +52,7 @@ class binary_serializer : public serializer
...
@@ -52,7 +52,7 @@ class binary_serializer : public serializer
/**
/**
* @brief Returns a pointer to the internal buffer.
* @brief Returns a pointer to the internal buffer.
*/
*/
c
onst
char
*
data
()
const
;
c
har
const
*
data
()
const
;
/**
/**
* @brief Resets the internal buffer.
* @brief Resets the internal buffer.
...
...
cppa/channel.hpp
View file @
42db08af
...
@@ -34,7 +34,7 @@ class channel : public ref_counted
...
@@ -34,7 +34,7 @@ class channel : public ref_counted
/**
/**
* @brief Enqueues @p msg to the list of received messages.
* @brief Enqueues @p msg to the list of received messages.
*/
*/
virtual
void
enqueue
(
actor
*
sender
,
const
any_tuple
&
msg
)
=
0
;
virtual
void
enqueue
(
actor
*
sender
,
any_tuple
const
&
msg
)
=
0
;
virtual
void
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
)
=
0
;
virtual
void
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
)
=
0
;
...
...
cppa/cow_ptr.hpp
View file @
42db08af
...
@@ -21,14 +21,14 @@ constexpr int copy_method()
...
@@ -21,14 +21,14 @@ constexpr int copy_method()
// is_copyable
// is_copyable
template
<
typename
T
>
template
<
typename
T
>
T
*
copy_of
(
const
T
*
what
,
std
::
integral_constant
<
int
,
1
>
)
T
*
copy_of
(
T
const
*
what
,
std
::
integral_constant
<
int
,
1
>
)
{
{
return
new
T
(
*
what
);
return
new
T
(
*
what
);
}
}
// has_copy_member_fun
// has_copy_member_fun
template
<
typename
T
>
template
<
typename
T
>
T
*
copy_of
(
const
T
*
what
,
std
::
integral_constant
<
int
,
2
>
)
T
*
copy_of
(
T
const
*
what
,
std
::
integral_constant
<
int
,
2
>
)
{
{
return
what
->
copy
();
return
what
->
copy
();
}
}
...
@@ -71,17 +71,17 @@ class cow_ptr
...
@@ -71,17 +71,17 @@ class cow_ptr
cow_ptr
(
T
*
raw_ptr
)
:
m_ptr
(
raw_ptr
)
{
}
cow_ptr
(
T
*
raw_ptr
)
:
m_ptr
(
raw_ptr
)
{
}
cow_ptr
(
co
nst
cow_ptr
&
other
)
:
m_ptr
(
other
.
m_ptr
)
{
}
cow_ptr
(
co
w_ptr
const
&
other
)
:
m_ptr
(
other
.
m_ptr
)
{
}
template
<
typename
Y
>
template
<
typename
Y
>
cow_ptr
(
co
nst
cow_ptr
<
Y
>
&
other
)
:
m_ptr
(
const_cast
<
Y
*>
(
other
.
get
()))
{
}
cow_ptr
(
co
w_ptr
<
Y
>
const
&
other
)
:
m_ptr
(
const_cast
<
Y
*>
(
other
.
get
()))
{
}
inline
void
swap
(
cow_ptr
&
other
)
inline
void
swap
(
cow_ptr
&
other
)
{
{
m_ptr
.
swap
(
other
.
m_ptr
);
m_ptr
.
swap
(
other
.
m_ptr
);
}
}
cow_ptr
&
operator
=
(
co
nst
cow_ptr
&
other
)
cow_ptr
&
operator
=
(
co
w_ptr
const
&
other
)
{
{
cow_ptr
tmp
(
other
);
cow_ptr
tmp
(
other
);
swap
(
tmp
);
swap
(
tmp
);
...
@@ -89,7 +89,7 @@ class cow_ptr
...
@@ -89,7 +89,7 @@ class cow_ptr
}
}
template
<
typename
Y
>
template
<
typename
Y
>
cow_ptr
&
operator
=
(
co
nst
cow_ptr
<
Y
>
&
other
)
cow_ptr
&
operator
=
(
co
w_ptr
<
Y
>
const
&
other
)
{
{
cow_ptr
tmp
(
other
);
cow_ptr
tmp
(
other
);
swap
(
tmp
);
swap
(
tmp
);
...
@@ -98,15 +98,15 @@ class cow_ptr
...
@@ -98,15 +98,15 @@ class cow_ptr
inline
T
*
get
()
{
return
detach_ptr
();
}
inline
T
*
get
()
{
return
detach_ptr
();
}
inline
const
T
*
get
()
const
{
return
m_ptr
.
get
();
}
inline
T
const
*
get
()
const
{
return
m_ptr
.
get
();
}
inline
T
*
operator
->
()
{
return
detach_ptr
();
}
inline
T
*
operator
->
()
{
return
detach_ptr
();
}
inline
T
&
operator
*
()
{
return
detach_ptr
();
}
inline
T
&
operator
*
()
{
return
detach_ptr
();
}
inline
const
T
*
operator
->
()
const
{
return
m_ptr
.
get
();
}
inline
T
const
*
operator
->
()
const
{
return
m_ptr
.
get
();
}
inline
const
T
&
operator
*
()
const
{
return
*
m_ptr
.
get
();
}
inline
T
const
&
operator
*
()
const
{
return
*
m_ptr
.
get
();
}
inline
explicit
operator
bool
()
const
{
return
static_cast
<
bool
>
(
m_ptr
);
}
inline
explicit
operator
bool
()
const
{
return
static_cast
<
bool
>
(
m_ptr
);
}
...
...
cppa/cppa.hpp
View file @
42db08af
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, 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 CPPA_HPP
#ifndef CPPA_HPP
#define CPPA_HPP
#define CPPA_HPP
...
@@ -210,7 +182,7 @@
...
@@ -210,7 +182,7 @@
* @code
* @code
* receive
* receive
* (
* (
* on<atom("hello"), std::string>() >> [](
const std::string
& msg)
* on<atom("hello"), std::string>() >> [](
std::string const
& msg)
* {
* {
* cout << "received hello message: " << msg << endl;
* cout << "received hello message: " << msg << endl;
* },
* },
...
@@ -235,7 +207,7 @@
...
@@ -235,7 +207,7 @@
* @code
* @code
* receive
* receive
* (
* (
* on(atom("hello"), val<std::string>()) >> [](
const std::string
& msg)
* on(atom("hello"), val<std::string>()) >> [](
std::string const
& msg)
* {
* {
* cout << "received hello message: " << msg << endl;
* cout << "received hello message: " << msg << endl;
* },
* },
...
@@ -346,7 +318,7 @@
...
@@ -346,7 +318,7 @@
*
*
* The message passing of @p libcppa prohibits pointers in messages because
* The message passing of @p libcppa prohibits pointers in messages because
* it enforces network transparent messaging.
* it enforces network transparent messaging.
* Unfortunately, string literals in @p C++ have the type <tt>c
onst char
*</tt>,
* Unfortunately, string literals in @p C++ have the type <tt>c
har const
*</tt>,
* resp. <tt>const char[]</tt>. Since @p libcppa is a user-friendly library,
* resp. <tt>const char[]</tt>. Since @p libcppa is a user-friendly library,
* it silently converts string literals and C-strings to @p std::string objects.
* it silently converts string literals and C-strings to @p std::string objects.
* It also converts unicode literals to the corresponding STL container.
* It also converts unicode literals to the corresponding STL container.
...
@@ -356,7 +328,7 @@
...
@@ -356,7 +328,7 @@
* // sends an std::string containing "hello actor!" to itself
* // sends an std::string containing "hello actor!" to itself
* send(self, "hello actor!");
* send(self, "hello actor!");
*
*
* c
onst char
* cstring = "cstring";
* c
har const
* cstring = "cstring";
* // sends an std::string containing "cstring" to itself
* // sends an std::string containing "cstring" to itself
* send(self, cstring);
* send(self, cstring);
*
*
...
@@ -487,7 +459,7 @@ inline actor_ptr spawn(abstract_event_based_actor* what)
...
@@ -487,7 +459,7 @@ inline actor_ptr spawn(abstract_event_based_actor* what)
*/
*/
template
<
scheduling_hint
Hint
,
typename
F
,
typename
...
Args
>
template
<
scheduling_hint
Hint
,
typename
F
,
typename
...
Args
>
auto
//actor_ptr
auto
//actor_ptr
spawn
(
F
&&
what
,
const
Args
&
...
args
)
spawn
(
F
&&
what
,
Args
const
&
...
args
)
->
typename
util
::
disable_if_c
<
std
::
is_convertible
<
typename
util
::
rm_ref
<
F
>::
type
,
scheduled_actor
*>::
value
->
typename
util
::
disable_if_c
<
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
,
||
std
::
is_convertible
<
typename
util
::
rm_ref
<
F
>::
type
,
event_based_actor
*>::
value
,
actor_ptr
>::
type
actor_ptr
>::
type
...
@@ -506,7 +478,7 @@ spawn(F&& what, const Args&... args)
...
@@ -506,7 +478,7 @@ spawn(F&& what, const Args&... args)
*/
*/
template
<
typename
F
,
typename
...
Args
>
template
<
typename
F
,
typename
...
Args
>
auto
// actor_ptr
auto
// actor_ptr
spawn
(
F
&&
what
,
const
Args
&
...
args
)
spawn
(
F
&&
what
,
Args
const
&
...
args
)
->
typename
util
::
disable_if_c
<
std
::
is_convertible
<
typename
util
::
rm_ref
<
F
>::
type
,
scheduled_actor
*>::
value
->
typename
util
::
disable_if_c
<
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
,
||
std
::
is_convertible
<
typename
util
::
rm_ref
<
F
>::
type
,
event_based_actor
*>::
value
,
actor_ptr
>::
type
actor_ptr
>::
type
...
@@ -678,7 +650,7 @@ inline actor_ptr& last_sender()
...
@@ -678,7 +650,7 @@ inline actor_ptr& last_sender()
* @param args Any number of values for the message content.
* @param args Any number of values for the message content.
*/
*/
template
<
typename
Arg0
,
typename
...
Args
>
template
<
typename
Arg0
,
typename
...
Args
>
void
send
(
channel_ptr
&
whom
,
const
Arg0
&
arg0
,
const
Args
&
...
args
);
void
send
(
channel_ptr
&
whom
,
Arg0
const
&
arg0
,
Args
const
&
...
args
);
/**
/**
* @brief Send a message to @p whom.
* @brief Send a message to @p whom.
...
@@ -693,56 +665,36 @@ void send(channel_ptr& whom, const Arg0& arg0, const Args&... args);
...
@@ -693,56 +665,36 @@ void send(channel_ptr& whom, const Arg0& arg0, const Args&... args);
* @param what Content of the message.
* @param what Content of the message.
* @returns @p whom.
* @returns @p whom.
*/
*/
channel_ptr
&
operator
<<
(
channel_ptr
&
whom
,
const
any_tuple
&
what
);
channel_ptr
&
operator
<<
(
channel_ptr
&
whom
,
any_tuple
const
&
what
);
#else
#else
template
<
class
C
,
typename
Arg0
,
typename
...
Args
>
template
<
class
C
,
typename
Arg0
,
typename
...
Args
>
typename
util
::
enable_if
<
std
::
is_base_of
<
channel
,
C
>
,
void
>::
type
void
send
(
intrusive_ptr
<
C
>&
whom
,
Arg0
const
&
arg0
,
Args
const
&
...
args
)
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
)
whom
->
enqueue
(
self
,
make_tuple
(
arg0
,
args
...));
if
(
whom
)
whom
->
enqueue
(
self
,
make_tuple
(
arg0
,
args
...));
}
}
template
<
class
C
,
typename
Arg0
,
typename
...
Args
>
template
<
class
C
,
typename
Arg0
,
typename
...
Args
>
typename
util
::
enable_if
<
std
::
is_base_of
<
channel
,
C
>
,
void
>::
type
void
send
(
intrusive_ptr
<
C
>&&
whom
,
Arg0
const
&
arg0
,
Args
const
&
...
args
)
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
));
intrusive_ptr
<
C
>
tmp
(
std
::
move
(
whom
));
if
(
tmp
)
tmp
->
enqueue
(
self
,
make_tuple
(
arg0
,
args
...));
if
(
tmp
)
tmp
->
enqueue
(
self
,
make_tuple
(
arg0
,
args
...));
}
}
// matches send(self, ...);
// matches send(self, ...);
template
<
typename
Arg0
,
typename
...
Args
>
template
<
typename
Arg0
,
typename
...
Args
>
void
send
(
local_actor
*
whom
,
const
Arg0
&
arg0
,
const
Args
&
...
args
)
void
send
(
self_type
const
&
,
Arg0
const
&
arg0
,
Args
const
&
...
args
)
{
{
if
(
whom
)
whom
->
enqueue
(
self
,
make_tuple
(
arg0
,
args
...));
local_actor
*
s
=
self
;
}
s
->
enqueue
(
s
,
make_tuple
(
arg0
,
args
...));
template
<
class
C
>
typename
util
::
enable_if
<
std
::
is_base_of
<
channel
,
C
>
,
void
>::
type
send_tuple
(
intrusive_ptr
<
C
>&
whom
,
const
any_tuple
&
what
)
{
if
(
whom
)
whom
->
enqueue
(
self
,
what
);
}
template
<
class
C
>
typename
util
::
enable_if
<
std
::
is_base_of
<
channel
,
C
>
,
void
>::
type
send_tuple
(
intrusive_ptr
<
C
>&&
whom
,
const
any_tuple
&
what
)
{
intrusive_ptr
<
C
>
tmp
(
std
::
move
(
whom
));
if
(
tmp
)
tmp
->
enqueue
(
self
,
what
);
}
// matches send(self, ...);
inline
void
send_tuple
(
local_actor
*
whom
,
const
any_tuple
&
what
)
{
if
(
whom
)
whom
->
enqueue
(
self
,
what
);
}
}
template
<
class
C
>
template
<
class
C
>
typename
util
::
enable_if
<
std
::
is_base_of
<
channel
,
C
>
,
intrusive_ptr
<
C
>&>::
type
typename
util
::
enable_if
<
std
::
is_base_of
<
channel
,
C
>
,
intrusive_ptr
<
C
>&>::
type
operator
<<
(
intrusive_ptr
<
C
>&
whom
,
const
any_tuple
&
what
)
operator
<<
(
intrusive_ptr
<
C
>&
whom
,
any_tuple
const
&
what
)
{
{
if
(
whom
)
whom
->
enqueue
(
self
,
what
);
if
(
whom
)
whom
->
enqueue
(
self
,
what
);
return
whom
;
return
whom
;
...
@@ -750,7 +702,7 @@ operator<<(intrusive_ptr<C>& whom, const any_tuple& what)
...
@@ -750,7 +702,7 @@ operator<<(intrusive_ptr<C>& whom, const any_tuple& what)
template
<
class
C
>
template
<
class
C
>
typename
util
::
enable_if
<
std
::
is_base_of
<
channel
,
C
>
,
intrusive_ptr
<
C
>>::
type
typename
util
::
enable_if
<
std
::
is_base_of
<
channel
,
C
>
,
intrusive_ptr
<
C
>>::
type
operator
<<
(
intrusive_ptr
<
C
>&&
whom
,
const
any_tuple
&
what
)
operator
<<
(
intrusive_ptr
<
C
>&&
whom
,
any_tuple
const
&
what
)
{
{
intrusive_ptr
<
C
>
tmp
(
std
::
move
(
whom
));
intrusive_ptr
<
C
>
tmp
(
std
::
move
(
whom
));
if
(
tmp
)
tmp
->
enqueue
(
self
,
what
);
if
(
tmp
)
tmp
->
enqueue
(
self
,
what
);
...
@@ -774,25 +726,18 @@ operator<<(intrusive_ptr<C>&& whom, any_tuple&& what)
...
@@ -774,25 +726,18 @@ operator<<(intrusive_ptr<C>&& whom, any_tuple&& what)
return
std
::
move
(
tmp
);
return
std
::
move
(
tmp
);
}
}
// matches self << make_tuple(...)
self_type
const
&
operator
<<
(
self_type
const
&
s
,
any_tuple
const
&
what
);
local_actor
*
operator
<<
(
local_actor
*
whom
,
const
any_tuple
&
what
);
// matches self << make_tuple(...)
self_type
const
&
operator
<<
(
self_type
const
&
s
,
any_tuple
&&
what
);
local_actor
*
operator
<<
(
local_actor
*
whom
,
any_tuple
&&
what
);
#endif
#endif
template
<
typename
Arg0
,
typename
...
Args
>
template
<
typename
Arg0
,
typename
...
Args
>
void
reply
(
const
Arg0
&
arg0
,
const
Args
&
...
args
)
void
reply
(
Arg0
const
&
arg0
,
Args
const
&
...
args
)
{
{
send
(
self
->
last_sender
(),
arg0
,
args
...);
send
(
self
->
last_sender
(),
arg0
,
args
...);
}
}
inline
void
reply_tuple
(
const
any_tuple
&
what
)
{
send_tuple
(
self
->
last_sender
(),
what
);
}
/**
/**
* @brief Sends a message to @p whom that is delayed by @p rel_time.
* @brief Sends a message to @p whom that is delayed by @p rel_time.
* @param whom Receiver of the message.
* @param whom Receiver of the message.
...
@@ -800,7 +745,7 @@ inline void reply_tuple(const any_tuple& what)
...
@@ -800,7 +745,7 @@ inline void reply_tuple(const any_tuple& what)
* @param data Any number of values for the message content.
* @param data Any number of values for the message content.
*/
*/
template
<
typename
Duration
,
typename
...
Data
>
template
<
typename
Duration
,
typename
...
Data
>
void
future_send
(
actor_ptr
whom
,
const
Duration
&
rel_time
,
const
Data
&
...
data
)
void
future_send
(
actor_ptr
whom
,
Duration
const
&
rel_time
,
Data
const
&
...
data
)
{
{
get_scheduler
()
->
future_send
(
whom
,
rel_time
,
data
...);
get_scheduler
()
->
future_send
(
whom
,
rel_time
,
data
...);
}
}
...
@@ -838,7 +783,7 @@ void publish(actor_ptr&& whom, std::uint16_t port);
...
@@ -838,7 +783,7 @@ void publish(actor_ptr&& whom, std::uint16_t port);
* @param port TCP port.
* @param port TCP port.
* @returns A pointer to the proxy instance that represents the remote Actor.
* @returns A pointer to the proxy instance that represents the remote Actor.
*/
*/
actor_ptr
remote_actor
(
c
onst
char
*
host
,
std
::
uint16_t
port
);
actor_ptr
remote_actor
(
c
har
const
*
host
,
std
::
uint16_t
port
);
}
// namespace cppa
}
// namespace cppa
...
...
cppa/deserializer.hpp
View file @
42db08af
...
@@ -18,8 +18,8 @@ class object;
...
@@ -18,8 +18,8 @@ class object;
class
deserializer
class
deserializer
{
{
deserializer
(
const
deserializer
&
)
=
delete
;
deserializer
(
deserializer
const
&
)
=
delete
;
deserializer
&
operator
=
(
const
deserializer
&
)
=
delete
;
deserializer
&
operator
=
(
deserializer
const
&
)
=
delete
;
public:
public:
...
@@ -43,7 +43,7 @@ class deserializer
...
@@ -43,7 +43,7 @@ class deserializer
* @brief Begins deserialization of an object of type @p type_name.
* @brief Begins deserialization of an object of type @p type_name.
* @param type_name The platform-independent @p libcppa type name.
* @param type_name The platform-independent @p libcppa type name.
*/
*/
virtual
void
begin_object
(
const
std
::
string
&
type_name
)
=
0
;
virtual
void
begin_object
(
std
::
string
const
&
type_name
)
=
0
;
/**
/**
* @brief Ends deserialization of an object.
* @brief Ends deserialization of an object.
...
@@ -76,7 +76,7 @@ class deserializer
...
@@ -76,7 +76,7 @@ class deserializer
* @param storage Array of size @p num, storing the result of this function.
* @param storage Array of size @p num, storing the result of this function.
*/
*/
virtual
void
read_tuple
(
size_t
num
,
virtual
void
read_tuple
(
size_t
num
,
const
primitive_type
*
ptypes
,
primitive_type
const
*
ptypes
,
primitive_variant
*
storage
)
=
0
;
primitive_variant
*
storage
)
=
0
;
};
};
...
...
cppa/detail/abstract_scheduled_actor.hpp
View file @
42db08af
...
@@ -52,7 +52,7 @@ class abstract_scheduled_actor : public abstract_actor<local_actor>
...
@@ -52,7 +52,7 @@ class abstract_scheduled_actor : public abstract_actor<local_actor>
ordinary_message
ordinary_message
};
};
filter_result
filter_msg
(
const
any_tuple
&
msg
);
filter_result
filter_msg
(
any_tuple
const
&
msg
);
dq_result
dq
(
std
::
unique_ptr
<
queue_node
>&
node
,
dq_result
dq
(
std
::
unique_ptr
<
queue_node
>&
node
,
invoke_rules_base
&
rules
,
invoke_rules_base
&
rules
,
...
@@ -63,7 +63,7 @@ class abstract_scheduled_actor : public abstract_actor<local_actor>
...
@@ -63,7 +63,7 @@ class abstract_scheduled_actor : public abstract_actor<local_actor>
return
m_has_pending_timeout_request
;
return
m_has_pending_timeout_request
;
}
}
void
request_timeout
(
const
util
::
duration
&
d
);
void
request_timeout
(
util
::
duration
const
&
d
);
void
reset_timeout
()
void
reset_timeout
()
{
{
...
@@ -105,7 +105,7 @@ class abstract_scheduled_actor : public abstract_actor<local_actor>
...
@@ -105,7 +105,7 @@ class abstract_scheduled_actor : public abstract_actor<local_actor>
void
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
);
void
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
);
void
enqueue
(
actor
*
sender
,
const
any_tuple
&
msg
);
void
enqueue
(
actor
*
sender
,
any_tuple
const
&
msg
);
int
compare_exchange_state
(
int
expected
,
int
new_value
);
int
compare_exchange_state
(
int
expected
,
int
new_value
);
...
@@ -135,7 +135,7 @@ struct scheduled_actor_dummy : abstract_scheduled_actor
...
@@ -135,7 +135,7 @@ struct scheduled_actor_dummy : abstract_scheduled_actor
void
unlink_from
(
intrusive_ptr
<
actor
>&
);
void
unlink_from
(
intrusive_ptr
<
actor
>&
);
bool
establish_backlink
(
intrusive_ptr
<
actor
>&
);
bool
establish_backlink
(
intrusive_ptr
<
actor
>&
);
bool
remove_backlink
(
intrusive_ptr
<
actor
>&
);
bool
remove_backlink
(
intrusive_ptr
<
actor
>&
);
void
detach
(
const
attachable
::
token
&
);
void
detach
(
attachable
::
token
const
&
);
bool
attach
(
attachable
*
);
bool
attach
(
attachable
*
);
};
};
...
...
cppa/detail/abstract_tuple.hpp
View file @
42db08af
...
@@ -17,10 +17,10 @@ struct abstract_tuple : ref_counted
...
@@ -17,10 +17,10 @@ struct abstract_tuple : ref_counted
// accessors
// accessors
virtual
size_t
size
()
const
=
0
;
virtual
size_t
size
()
const
=
0
;
virtual
abstract_tuple
*
copy
()
const
=
0
;
virtual
abstract_tuple
*
copy
()
const
=
0
;
virtual
const
void
*
at
(
size_t
pos
)
const
=
0
;
virtual
void
const
*
at
(
size_t
pos
)
const
=
0
;
virtual
const
uniform_type_info
&
utype_info_at
(
size_t
pos
)
const
=
0
;
virtual
uniform_type_info
const
&
utype_info_at
(
size_t
pos
)
const
=
0
;
virtual
bool
equals
(
const
abstract_tuple
&
other
)
const
;
virtual
bool
equals
(
abstract_tuple
const
&
other
)
const
;
};
};
...
...
cppa/detail/actor_proxy_cache.hpp
View file @
42db08af
...
@@ -28,7 +28,7 @@ class actor_proxy_cache
...
@@ -28,7 +28,7 @@ class actor_proxy_cache
new_proxy_callback
m_new_cb
;
new_proxy_callback
m_new_cb
;
process_information_ptr
get_pinfo
(
const
key_tuple
&
key
);
process_information_ptr
get_pinfo
(
key_tuple
const
&
key
);
public:
public:
...
@@ -39,13 +39,13 @@ class actor_proxy_cache
...
@@ -39,13 +39,13 @@ class actor_proxy_cache
m_new_cb
=
std
::
forward
<
F
>
(
cb
);
m_new_cb
=
std
::
forward
<
F
>
(
cb
);
}
}
actor_proxy_ptr
get
(
const
key_tuple
&
key
);
actor_proxy_ptr
get
(
key_tuple
const
&
key
);
void
add
(
actor_proxy_ptr
&
pptr
);
void
add
(
actor_proxy_ptr
&
pptr
);
size_t
size
()
const
;
size_t
size
()
const
;
void
erase
(
const
actor_proxy_ptr
&
pptr
);
void
erase
(
actor_proxy_ptr
const
&
pptr
);
template
<
typename
F
>
template
<
typename
F
>
void
for_each
(
F
&&
fun
)
void
for_each
(
F
&&
fun
)
...
...
cppa/detail/addressed_message.hpp
View file @
42db08af
...
@@ -18,26 +18,26 @@ class addressed_message
...
@@ -18,26 +18,26 @@ class addressed_message
public:
public:
addressed_message
(
const
actor_ptr
&
from
,
addressed_message
(
actor_ptr
const
&
from
,
c
onst
channel_ptr
&
to
,
c
hannel_ptr
const
&
to
,
const
any_tuple
&
ut
);
any_tuple
const
&
ut
);
addressed_message
(
const
actor_ptr
&
from
,
addressed_message
(
actor_ptr
const
&
from
,
c
onst
channel_ptr
&
to
,
c
hannel_ptr
const
&
to
,
any_tuple
&&
ut
);
any_tuple
&&
ut
);
addressed_message
()
=
default
;
addressed_message
()
=
default
;
addressed_message
(
addressed_message
&&
)
=
default
;
addressed_message
(
addressed_message
&&
)
=
default
;
addressed_message
(
const
addressed_message
&
)
=
default
;
addressed_message
(
addressed_message
const
&
)
=
default
;
addressed_message
&
operator
=
(
addressed_message
&&
)
=
default
;
addressed_message
&
operator
=
(
addressed_message
&&
)
=
default
;
addressed_message
&
operator
=
(
const
addressed_message
&
)
=
default
;
addressed_message
&
operator
=
(
addressed_message
const
&
)
=
default
;
inline
actor_ptr
&
sender
()
inline
actor_ptr
&
sender
()
{
{
return
m_sender
;
return
m_sender
;
}
}
inline
const
actor_ptr
&
sender
()
const
inline
actor_ptr
const
&
sender
()
const
{
{
return
m_sender
;
return
m_sender
;
}
}
...
@@ -47,7 +47,7 @@ class addressed_message
...
@@ -47,7 +47,7 @@ class addressed_message
return
m_receiver
;
return
m_receiver
;
}
}
inline
c
onst
channel_ptr
&
receiver
()
const
inline
c
hannel_ptr
const
&
receiver
()
const
{
{
return
m_receiver
;
return
m_receiver
;
}
}
...
@@ -57,7 +57,7 @@ class addressed_message
...
@@ -57,7 +57,7 @@ class addressed_message
return
m_content
;
return
m_content
;
}
}
inline
const
any_tuple
&
content
()
const
inline
any_tuple
const
&
content
()
const
{
{
return
m_content
;
return
m_content
;
}
}
...
@@ -75,9 +75,9 @@ class addressed_message
...
@@ -75,9 +75,9 @@ class addressed_message
};
};
bool
operator
==
(
const
addressed_message
&
lhs
,
const
addressed_message
&
rhs
);
bool
operator
==
(
addressed_message
const
&
lhs
,
addressed_message
const
&
rhs
);
inline
bool
operator
!=
(
const
addressed_message
&
lhs
,
const
addressed_message
&
rhs
)
inline
bool
operator
!=
(
addressed_message
const
&
lhs
,
addressed_message
const
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
...
...
cppa/detail/atom_val.hpp
View file @
42db08af
...
@@ -27,7 +27,7 @@ inline constexpr std::uint64_t next_interim(std::uint64_t tmp, size_t char_code)
...
@@ -27,7 +27,7 @@ inline constexpr std::uint64_t next_interim(std::uint64_t tmp, size_t char_code)
return
(
tmp
<<
6
)
|
encoding_table
[
char_code
];
return
(
tmp
<<
6
)
|
encoding_table
[
char_code
];
}
}
constexpr
std
::
uint64_t
atom_val
(
c
onst
char
*
str
,
std
::
uint64_t
interim
=
0
)
constexpr
std
::
uint64_t
atom_val
(
c
har
const
*
str
,
std
::
uint64_t
interim
=
0
)
{
{
return
(
*
str
<=
0
)
?
interim
return
(
*
str
<=
0
)
?
interim
:
atom_val
(
str
+
1
,
next_interim
(
interim
,
*
str
));
:
atom_val
(
str
+
1
,
next_interim
(
interim
,
*
str
));
...
...
cppa/detail/channel.hpp
View file @
42db08af
...
@@ -10,7 +10,7 @@ namespace cppa { namespace detail {
...
@@ -10,7 +10,7 @@ namespace cppa { namespace detail {
// public part of the actor interface
// public part of the actor interface
struct
channel
:
ref_counted
struct
channel
:
ref_counted
{
{
virtual
void
enqueue_msg
(
const
message
&
msg
)
=
0
;
virtual
void
enqueue_msg
(
message
const
&
msg
)
=
0
;
};
};
}
}
// namespace cppa::detail
}
}
// namespace cppa::detail
...
...
cppa/detail/converted_thread_context.hpp
View file @
42db08af
...
@@ -43,7 +43,7 @@ class converted_thread_context : public abstract_actor<local_actor>
...
@@ -43,7 +43,7 @@ class converted_thread_context : public abstract_actor<local_actor>
void
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
)
/*override*/
;
void
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
)
/*override*/
;
void
enqueue
(
actor
*
sender
,
const
any_tuple
&
msg
)
/*override*/
;
void
enqueue
(
actor
*
sender
,
any_tuple
const
&
msg
)
/*override*/
;
void
dequeue
(
invoke_rules
&
rules
)
/*override*/
;
void
dequeue
(
invoke_rules
&
rules
)
/*override*/
;
...
@@ -69,7 +69,7 @@ class converted_thread_context : public abstract_actor<local_actor>
...
@@ -69,7 +69,7 @@ class converted_thread_context : public abstract_actor<local_actor>
invoke_rules_base
&
rules
,
invoke_rules_base
&
rules
,
queue_node_buffer
&
buffer
);
queue_node_buffer
&
buffer
);
throw_on_exit_result
throw_on_exit
(
const
any_tuple
&
msg
);
throw_on_exit_result
throw_on_exit
(
any_tuple
const
&
msg
);
pattern
<
atom_value
,
actor_ptr
,
std
::
uint32_t
>
m_exit_msg_pattern
;
pattern
<
atom_value
,
actor_ptr
,
std
::
uint32_t
>
m_exit_msg_pattern
;
...
...
cppa/detail/decorated_tuple.hpp
View file @
42db08af
...
@@ -27,7 +27,7 @@ class decorated_tuple : public abstract_tuple
...
@@ -27,7 +27,7 @@ class decorated_tuple : public abstract_tuple
typedef
cow_ptr
<
abstract_tuple
>
ptr_type
;
typedef
cow_ptr
<
abstract_tuple
>
ptr_type
;
decorated_tuple
(
const
ptr_type
&
d
,
const
vector_type
&
v
)
decorated_tuple
(
ptr_type
const
&
d
,
vector_type
const
&
v
)
:
m_decorated
(
d
),
m_mappings
(
v
)
:
m_decorated
(
d
),
m_mappings
(
v
)
{
{
}
}
...
@@ -47,17 +47,17 @@ class decorated_tuple : public abstract_tuple
...
@@ -47,17 +47,17 @@ class decorated_tuple : public abstract_tuple
return
new
decorated_tuple
(
*
this
);
return
new
decorated_tuple
(
*
this
);
}
}
virtual
const
void
*
at
(
size_t
pos
)
const
virtual
void
const
*
at
(
size_t
pos
)
const
{
{
return
m_decorated
->
at
(
m_mappings
[
pos
]);
return
m_decorated
->
at
(
m_mappings
[
pos
]);
}
}
virtual
const
uniform_type_info
&
utype_info_at
(
size_t
pos
)
const
virtual
uniform_type_info
const
&
utype_info_at
(
size_t
pos
)
const
{
{
return
m_decorated
->
utype_info_at
(
m_mappings
[
pos
]);
return
m_decorated
->
utype_info_at
(
m_mappings
[
pos
]);
}
}
virtual
bool
equals
(
const
abstract_tuple
&
)
const
virtual
bool
equals
(
abstract_tuple
const
&
)
const
{
{
return
false
;
return
false
;
}
}
...
@@ -67,14 +67,14 @@ class decorated_tuple : public abstract_tuple
...
@@ -67,14 +67,14 @@ class decorated_tuple : public abstract_tuple
ptr_type
m_decorated
;
ptr_type
m_decorated
;
vector_type
m_mappings
;
vector_type
m_mappings
;
decorated_tuple
(
const
decorated_tuple
&
other
)
decorated_tuple
(
decorated_tuple
const
&
other
)
:
abstract_tuple
()
:
abstract_tuple
()
,
m_decorated
(
other
.
m_decorated
)
,
m_decorated
(
other
.
m_decorated
)
,
m_mappings
(
other
.
m_mappings
)
,
m_mappings
(
other
.
m_mappings
)
{
{
}
}
decorated_tuple
&
operator
=
(
const
decorated_tuple
&
)
=
delete
;
decorated_tuple
&
operator
=
(
decorated_tuple
const
&
)
=
delete
;
};
};
...
...
cppa/detail/default_uniform_type_info_impl.hpp
View file @
42db08af
...
@@ -91,16 +91,16 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
...
@@ -91,16 +91,16 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
uniform_type_info
*
m_meta
;
uniform_type_info
*
m_meta
;
std
::
function
<
void
(
const
uniform_type_info
*
,
std
::
function
<
void
(
uniform_type_info
const
*
,
const
void
*
,
void
const
*
,
serializer
*
)
>
m_serialize
;
serializer
*
)
>
m_serialize
;
std
::
function
<
void
(
const
uniform_type_info
*
,
std
::
function
<
void
(
uniform_type_info
const
*
,
void
*
,
void
*
,
deserializer
*
)
>
m_deserialize
;
deserializer
*
)
>
m_deserialize
;
member
(
const
member
&
)
=
delete
;
member
(
member
const
&
)
=
delete
;
member
&
operator
=
(
const
member
&
)
=
delete
;
member
&
operator
=
(
member
const
&
)
=
delete
;
void
swap
(
member
&
other
)
void
swap
(
member
&
other
)
{
{
...
@@ -122,13 +122,13 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
...
@@ -122,13 +122,13 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
template
<
typename
R
,
class
C
>
template
<
typename
R
,
class
C
>
member
(
uniform_type_info
*
mtptr
,
R
C
::*
mem_ptr
)
:
m_meta
(
mtptr
)
member
(
uniform_type_info
*
mtptr
,
R
C
::*
mem_ptr
)
:
m_meta
(
mtptr
)
{
{
m_serialize
=
[
mem_ptr
]
(
const
uniform_type_info
*
mt
,
m_serialize
=
[
mem_ptr
]
(
uniform_type_info
const
*
mt
,
const
void
*
obj
,
void
const
*
obj
,
serializer
*
s
)
serializer
*
s
)
{
{
mt
->
serialize
(
&
(
*
reinterpret_cast
<
const
C
*>
(
obj
).
*
mem_ptr
),
s
);
mt
->
serialize
(
&
(
*
reinterpret_cast
<
C
const
*>
(
obj
).
*
mem_ptr
),
s
);
};
};
m_deserialize
=
[
mem_ptr
]
(
const
uniform_type_info
*
mt
,
m_deserialize
=
[
mem_ptr
]
(
uniform_type_info
const
*
mt
,
void
*
obj
,
void
*
obj
,
deserializer
*
d
)
deserializer
*
d
)
{
{
...
@@ -145,14 +145,14 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
...
@@ -145,14 +145,14 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
typedef
typename
util
::
rm_ref
<
SArg
>::
type
setter_arg
;
typedef
typename
util
::
rm_ref
<
SArg
>::
type
setter_arg
;
static_assert
(
std
::
is_same
<
getter_result
,
setter_arg
>::
value
,
static_assert
(
std
::
is_same
<
getter_result
,
setter_arg
>::
value
,
"getter result doesn't match setter argument"
);
"getter result doesn't match setter argument"
);
m_serialize
=
[
getter
]
(
const
uniform_type_info
*
mt
,
m_serialize
=
[
getter
]
(
uniform_type_info
const
*
mt
,
const
void
*
obj
,
void
const
*
obj
,
serializer
*
s
)
serializer
*
s
)
{
{
GRes
v
=
(
*
reinterpret_cast
<
const
C
*>
(
obj
).
*
getter
)();
GRes
v
=
(
*
reinterpret_cast
<
C
const
*>
(
obj
).
*
getter
)();
mt
->
serialize
(
&
v
,
s
);
mt
->
serialize
(
&
v
,
s
);
};
};
m_deserialize
=
[
setter
]
(
const
uniform_type_info
*
mt
,
m_deserialize
=
[
setter
]
(
uniform_type_info
const
*
mt
,
void
*
obj
,
void
*
obj
,
deserializer
*
d
)
deserializer
*
d
)
{
{
...
@@ -173,11 +173,11 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
...
@@ -173,11 +173,11 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
{
{
return
{
return
{
mtptr
,
mtptr
,
[]
(
const
uniform_type_info
*
mt
,
const
void
*
obj
,
serializer
*
s
)
[]
(
uniform_type_info
const
*
mt
,
void
const
*
obj
,
serializer
*
s
)
{
{
mt
->
serialize
(
obj
,
s
);
mt
->
serialize
(
obj
,
s
);
},
},
[]
(
const
uniform_type_info
*
mt
,
void
*
obj
,
deserializer
*
d
)
[]
(
uniform_type_info
const
*
mt
,
void
*
obj
,
deserializer
*
d
)
{
{
mt
->
deserialize
(
obj
,
d
);
mt
->
deserialize
(
obj
,
d
);
}
}
...
@@ -195,7 +195,7 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
...
@@ -195,7 +195,7 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
return
*
this
;
return
*
this
;
}
}
inline
void
serialize
(
const
void
*
parent
,
serializer
*
s
)
const
inline
void
serialize
(
void
const
*
parent
,
serializer
*
s
)
const
{
{
m_serialize
(
m_meta
,
parent
,
s
);
m_serialize
(
m_meta
,
parent
,
s
);
}
}
...
@@ -322,7 +322,7 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
...
@@ -322,7 +322,7 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
}
}
}
}
void
serialize
(
const
void
*
obj
,
serializer
*
s
)
const
void
serialize
(
void
const
*
obj
,
serializer
*
s
)
const
{
{
s
->
begin_object
(
this
->
name
());
s
->
begin_object
(
this
->
name
());
for
(
auto
&
m
:
m_members
)
for
(
auto
&
m
:
m_members
)
...
...
cppa/detail/demangle.hpp
View file @
42db08af
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
namespace
cppa
{
namespace
detail
{
namespace
cppa
{
namespace
detail
{
std
::
string
demangle
(
c
onst
char
*
typeid_name
);
std
::
string
demangle
(
c
har
const
*
typeid_name
);
}
}
// namespace cppa::detail
}
}
// namespace cppa::detail
...
...
cppa/detail/empty_tuple.hpp
View file @
42db08af
...
@@ -11,9 +11,9 @@ struct empty_tuple : cppa::detail::abstract_tuple
...
@@ -11,9 +11,9 @@ struct empty_tuple : cppa::detail::abstract_tuple
size_t
size
()
const
;
size_t
size
()
const
;
void
*
mutable_at
(
size_t
);
void
*
mutable_at
(
size_t
);
abstract_tuple
*
copy
()
const
;
abstract_tuple
*
copy
()
const
;
const
void
*
at
(
size_t
)
const
;
void
const
*
at
(
size_t
)
const
;
bool
equals
(
const
abstract_tuple
&
other
)
const
;
bool
equals
(
abstract_tuple
const
&
other
)
const
;
const
uniform_type_info
&
utype_info_at
(
size_t
)
const
;
uniform_type_info
const
&
utype_info_at
(
size_t
)
const
;
};
};
...
...
cppa/detail/get_behavior.hpp
View file @
42db08af
...
@@ -36,7 +36,7 @@ class ftor_behavior<true, true, F, Args...> : public scheduled_actor
...
@@ -36,7 +36,7 @@ class ftor_behavior<true, true, F, Args...> : public scheduled_actor
public:
public:
ftor_behavior
(
F
ptr
,
const
Args
&
...
args
)
:
m_fun
(
ptr
),
m_args
(
args
...)
{
}
ftor_behavior
(
F
ptr
,
Args
const
&
...
args
)
:
m_fun
(
ptr
),
m_args
(
args
...)
{
}
virtual
void
act
()
{
invoke
(
m_fun
,
m_args
);
}
virtual
void
act
()
{
invoke
(
m_fun
,
m_args
);
}
...
@@ -50,7 +50,7 @@ class ftor_behavior<false, false, F> : public scheduled_actor
...
@@ -50,7 +50,7 @@ class ftor_behavior<false, false, F> : public scheduled_actor
public:
public:
ftor_behavior
(
const
F
&
arg
)
:
m_fun
(
arg
)
{
}
ftor_behavior
(
F
const
&
arg
)
:
m_fun
(
arg
)
{
}
ftor_behavior
(
F
&&
arg
)
:
m_fun
(
std
::
move
(
arg
))
{
}
ftor_behavior
(
F
&&
arg
)
:
m_fun
(
std
::
move
(
arg
))
{
}
...
@@ -69,11 +69,11 @@ class ftor_behavior<false, true, F, Args...> : public scheduled_actor
...
@@ -69,11 +69,11 @@ class ftor_behavior<false, true, F, Args...> : public scheduled_actor
public:
public:
ftor_behavior
(
const
F
&
f
,
const
Args
&
...
args
)
:
m_fun
(
f
),
m_args
(
args
...)
ftor_behavior
(
F
const
&
f
,
Args
const
&
...
args
)
:
m_fun
(
f
),
m_args
(
args
...)
{
{
}
}
ftor_behavior
(
F
&&
f
,
const
Args
&
...
args
)
:
m_fun
(
std
::
move
(
f
))
ftor_behavior
(
F
&&
f
,
Args
const
&
...
args
)
:
m_fun
(
std
::
move
(
f
))
,
m_args
(
args
...)
,
m_args
(
args
...)
{
{
}
}
...
@@ -106,8 +106,8 @@ scheduled_actor* get_behavior(std::integral_constant<bool,false>, F&& ftor)
...
@@ -106,8 +106,8 @@ scheduled_actor* get_behavior(std::integral_constant<bool,false>, F&& ftor)
template
<
typename
F
,
typename
Arg0
,
typename
...
Args
>
template
<
typename
F
,
typename
Arg0
,
typename
...
Args
>
scheduled_actor
*
get_behavior
(
std
::
integral_constant
<
bool
,
true
>
,
scheduled_actor
*
get_behavior
(
std
::
integral_constant
<
bool
,
true
>
,
F
fptr
,
F
fptr
,
const
Arg0
&
arg0
,
Arg0
const
&
arg0
,
const
Args
&
...
args
)
Args
const
&
...
args
)
{
{
static_assert
(
std
::
is_convertible
<
decltype
(
fptr
(
arg0
,
args
...)),
scheduled_actor
*>::
value
==
false
,
static_assert
(
std
::
is_convertible
<
decltype
(
fptr
(
arg0
,
args
...)),
scheduled_actor
*>::
value
==
false
,
"Spawning a function returning an actor_behavior? "
"Spawning a function returning an actor_behavior? "
...
@@ -120,8 +120,8 @@ scheduled_actor* get_behavior(std::integral_constant<bool,true>,
...
@@ -120,8 +120,8 @@ scheduled_actor* get_behavior(std::integral_constant<bool,true>,
template
<
typename
F
,
typename
Arg0
,
typename
...
Args
>
template
<
typename
F
,
typename
Arg0
,
typename
...
Args
>
scheduled_actor
*
get_behavior
(
std
::
integral_constant
<
bool
,
false
>
,
scheduled_actor
*
get_behavior
(
std
::
integral_constant
<
bool
,
false
>
,
F
ftor
,
F
ftor
,
const
Arg0
&
arg0
,
Arg0
const
&
arg0
,
const
Args
&
...
args
)
Args
const
&
...
args
)
{
{
static_assert
(
std
::
is_convertible
<
decltype
(
ftor
(
arg0
,
args
...)),
scheduled_actor
*>::
value
==
false
,
static_assert
(
std
::
is_convertible
<
decltype
(
ftor
(
arg0
,
args
...)),
scheduled_actor
*>::
value
==
false
,
"Spawning a functor returning an actor_behavior? "
"Spawning a functor returning an actor_behavior? "
...
...
cppa/detail/group_manager.hpp
View file @
42db08af
...
@@ -16,8 +16,8 @@ class group_manager
...
@@ -16,8 +16,8 @@ class group_manager
group_manager
();
group_manager
();
intrusive_ptr
<
group
>
get
(
const
std
::
string
&
module_name
,
intrusive_ptr
<
group
>
get
(
std
::
string
const
&
module_name
,
const
std
::
string
&
group_identifier
);
std
::
string
const
&
group_identifier
);
void
add_module
(
group
::
module
*
);
void
add_module
(
group
::
module
*
);
...
...
cppa/detail/implicit_conversions.hpp
View file @
42db08af
...
@@ -17,20 +17,20 @@ template<typename T>
...
@@ -17,20 +17,20 @@ template<typename T>
struct
implicit_conversions
struct
implicit_conversions
{
{
typedef
typename
util
::
replace_type
<
T
,
std
::
string
,
typedef
typename
util
::
replace_type
<
T
,
std
::
string
,
std
::
is_same
<
T
,
c
onst
char
*>
,
std
::
is_same
<
T
,
c
har
const
*>
,
std
::
is_same
<
T
,
char
*>
,
std
::
is_same
<
T
,
char
*>
,
util
::
is_array_of
<
T
,
char
>
,
util
::
is_array_of
<
T
,
char
>
,
util
::
is_array_of
<
T
,
const
char
>
>::
type
util
::
is_array_of
<
T
,
const
char
>
>::
type
subtype1
;
subtype1
;
typedef
typename
util
::
replace_type
<
subtype1
,
std
::
u16string
,
typedef
typename
util
::
replace_type
<
subtype1
,
std
::
u16string
,
std
::
is_same
<
subtype1
,
c
onst
char16_
t
*>
,
std
::
is_same
<
subtype1
,
c
har16_t
cons
t
*>
,
std
::
is_same
<
subtype1
,
char16_t
*>
,
std
::
is_same
<
subtype1
,
char16_t
*>
,
util
::
is_array_of
<
subtype1
,
char16_t
>>::
type
util
::
is_array_of
<
subtype1
,
char16_t
>>::
type
subtype2
;
subtype2
;
typedef
typename
util
::
replace_type
<
subtype2
,
std
::
u32string
,
typedef
typename
util
::
replace_type
<
subtype2
,
std
::
u32string
,
std
::
is_same
<
subtype2
,
c
onst
char32_
t
*>
,
std
::
is_same
<
subtype2
,
c
har32_t
cons
t
*>
,
std
::
is_same
<
subtype2
,
char32_t
*>
,
std
::
is_same
<
subtype2
,
char32_t
*>
,
util
::
is_array_of
<
subtype2
,
char32_t
>>::
type
util
::
is_array_of
<
subtype2
,
char32_t
>>::
type
subtype3
;
subtype3
;
...
...
cppa/detail/intermediate.hpp
View file @
42db08af
...
@@ -8,8 +8,8 @@ namespace cppa { namespace detail {
...
@@ -8,8 +8,8 @@ namespace cppa { namespace detail {
class
intermediate
class
intermediate
{
{
intermediate
(
const
intermediate
&
)
=
delete
;
intermediate
(
intermediate
const
&
)
=
delete
;
intermediate
&
operator
=
(
const
intermediate
&
)
=
delete
;
intermediate
&
operator
=
(
intermediate
const
&
)
=
delete
;
public:
public:
...
@@ -53,7 +53,7 @@ class intermediate_impl<Impl, void> : public intermediate
...
@@ -53,7 +53,7 @@ class intermediate_impl<Impl, void> : public intermediate
public:
public:
intermediate_impl
(
const
Impl
&
impl
)
:
m_impl
(
impl
)
{
}
intermediate_impl
(
Impl
const
&
impl
)
:
m_impl
(
impl
)
{
}
intermediate_impl
(
Impl
&&
impl
)
:
m_impl
(
std
::
move
(
impl
))
{
}
intermediate_impl
(
Impl
&&
impl
)
:
m_impl
(
std
::
move
(
impl
))
{
}
...
...
cppa/detail/invokable.hpp
View file @
42db08af
...
@@ -19,14 +19,14 @@ namespace cppa { namespace detail {
...
@@ -19,14 +19,14 @@ namespace cppa { namespace detail {
class
invokable_base
class
invokable_base
{
{
invokable_base
(
const
invokable_base
&
)
=
delete
;
invokable_base
(
invokable_base
const
&
)
=
delete
;
invokable_base
&
operator
=
(
const
invokable_base
&
)
=
delete
;
invokable_base
&
operator
=
(
invokable_base
const
&
)
=
delete
;
public:
public:
invokable_base
()
=
default
;
invokable_base
()
=
default
;
virtual
~
invokable_base
();
virtual
~
invokable_base
();
virtual
bool
invoke
(
const
any_tuple
&
)
const
=
0
;
virtual
bool
invoke
(
any_tuple
const
&
)
const
=
0
;
};
};
...
@@ -37,11 +37,11 @@ class timed_invokable : public invokable_base
...
@@ -37,11 +37,11 @@ class timed_invokable : public invokable_base
protected:
protected:
timed_invokable
(
const
util
::
duration
&
);
timed_invokable
(
util
::
duration
const
&
);
public:
public:
inline
const
util
::
duration
&
timeout
()
const
inline
util
::
duration
const
&
timeout
()
const
{
{
return
m_timeout
;
return
m_timeout
;
}
}
...
@@ -58,12 +58,12 @@ class timed_invokable_impl : public timed_invokable
...
@@ -58,12 +58,12 @@ class timed_invokable_impl : public timed_invokable
public:
public:
timed_invokable_impl
(
const
util
::
duration
&
d
,
const
TargetFun
&
tfun
)
timed_invokable_impl
(
util
::
duration
const
&
d
,
TargetFun
const
&
tfun
)
:
super
(
d
),
m_target
(
tfun
)
:
super
(
d
),
m_target
(
tfun
)
{
{
}
}
bool
invoke
(
const
any_tuple
&
)
const
bool
invoke
(
any_tuple
const
&
)
const
{
{
m_target
();
m_target
();
return
true
;
return
true
;
...
@@ -76,7 +76,7 @@ class invokable : public invokable_base
...
@@ -76,7 +76,7 @@ class invokable : public invokable_base
public:
public:
virtual
intermediate
*
get_intermediate
(
const
any_tuple
&
)
=
0
;
virtual
intermediate
*
get_intermediate
(
any_tuple
const
&
)
=
0
;
};
};
...
@@ -87,10 +87,10 @@ class invokable_impl : public invokable
...
@@ -87,10 +87,10 @@ class invokable_impl : public invokable
struct
iimpl
:
intermediate
struct
iimpl
:
intermediate
{
{
const
TargetFun
&
m_target
;
TargetFun
const
&
m_target
;
TupleView
m_args
;
TupleView
m_args
;
iimpl
(
const
TargetFun
&
tf
)
:
m_target
(
tf
)
iimpl
(
TargetFun
const
&
tf
)
:
m_target
(
tf
)
{
{
}
}
...
@@ -109,12 +109,12 @@ class invokable_impl : public invokable
...
@@ -109,12 +109,12 @@ class invokable_impl : public invokable
public:
public:
invokable_impl
(
std
::
unique_ptr
<
Pattern
>&&
pptr
,
const
TargetFun
&
mt
)
invokable_impl
(
std
::
unique_ptr
<
Pattern
>&&
pptr
,
TargetFun
const
&
mt
)
:
m_pattern
(
std
::
move
(
pptr
)),
m_target
(
mt
),
m_iimpl
(
m_target
)
:
m_pattern
(
std
::
move
(
pptr
)),
m_target
(
mt
),
m_iimpl
(
m_target
)
{
{
}
}
bool
invoke
(
const
any_tuple
&
data
)
const
bool
invoke
(
any_tuple
const
&
data
)
const
{
{
vector_type
mv
;
vector_type
mv
;
...
@@ -137,7 +137,7 @@ class invokable_impl : public invokable
...
@@ -137,7 +137,7 @@ class invokable_impl : public invokable
return
false
;
return
false
;
}
}
intermediate
*
get_intermediate
(
const
any_tuple
&
data
)
intermediate
*
get_intermediate
(
any_tuple
const
&
data
)
{
{
vector_type
mv
;
vector_type
mv
;
if
((
*
m_pattern
)(
data
,
&
mv
))
if
((
*
m_pattern
)(
data
,
&
mv
))
...
@@ -164,9 +164,9 @@ class invokable_impl<TupleClass<>, Pattern, TargetFun> : public invokable
...
@@ -164,9 +164,9 @@ class invokable_impl<TupleClass<>, Pattern, TargetFun> : public invokable
struct
iimpl
:
intermediate
struct
iimpl
:
intermediate
{
{
const
TargetFun
&
m_target
;
TargetFun
const
&
m_target
;
iimpl
(
const
TargetFun
&
tf
)
:
m_target
(
tf
)
iimpl
(
TargetFun
const
&
tf
)
:
m_target
(
tf
)
{
{
}
}
...
@@ -182,12 +182,12 @@ class invokable_impl<TupleClass<>, Pattern, TargetFun> : public invokable
...
@@ -182,12 +182,12 @@ class invokable_impl<TupleClass<>, Pattern, TargetFun> : public invokable
public:
public:
invokable_impl
(
std
::
unique_ptr
<
Pattern
>&&
pptr
,
const
TargetFun
&
mt
)
invokable_impl
(
std
::
unique_ptr
<
Pattern
>&&
pptr
,
TargetFun
const
&
mt
)
:
m_pattern
(
std
::
move
(
pptr
)),
m_target
(
mt
),
m_iimpl
(
m_target
)
:
m_pattern
(
std
::
move
(
pptr
)),
m_target
(
mt
),
m_iimpl
(
m_target
)
{
{
}
}
bool
invoke
(
const
any_tuple
&
data
)
const
bool
invoke
(
any_tuple
const
&
data
)
const
{
{
if
((
*
m_pattern
)(
data
,
nullptr
))
if
((
*
m_pattern
)(
data
,
nullptr
))
{
{
...
@@ -197,7 +197,7 @@ class invokable_impl<TupleClass<>, Pattern, TargetFun> : public invokable
...
@@ -197,7 +197,7 @@ class invokable_impl<TupleClass<>, Pattern, TargetFun> : public invokable
return
false
;
return
false
;
}
}
intermediate
*
get_intermediate
(
const
any_tuple
&
data
)
intermediate
*
get_intermediate
(
any_tuple
const
&
data
)
{
{
return
((
*
m_pattern
)(
data
,
nullptr
))
?
&
m_iimpl
:
nullptr
;
return
((
*
m_pattern
)(
data
,
nullptr
))
?
&
m_iimpl
:
nullptr
;
}
}
...
...
cppa/detail/list_member.hpp
View file @
42db08af
...
@@ -11,7 +11,7 @@ struct list_member_util
...
@@ -11,7 +11,7 @@ struct list_member_util
{
{
typedef
typename
List
::
value_type
value_type
;
typedef
typename
List
::
value_type
value_type
;
static
constexpr
primitive_type
vptype
=
type_to_ptype
<
value_type
>::
ptype
;
static
constexpr
primitive_type
vptype
=
type_to_ptype
<
value_type
>::
ptype
;
void
operator
()(
const
Li
st
&
list
,
serializer
*
s
)
const
void
operator
()(
List
con
st
&
list
,
serializer
*
s
)
const
{
{
s
->
begin_sequence
(
list
.
size
());
s
->
begin_sequence
(
list
.
size
());
for
(
auto
i
=
list
.
begin
();
i
!=
list
.
end
();
++
i
)
for
(
auto
i
=
list
.
begin
();
i
!=
list
.
end
();
++
i
)
...
@@ -37,13 +37,13 @@ struct list_member_util<List, false>
...
@@ -37,13 +37,13 @@ struct list_member_util<List, false>
{
{
typedef
typename
List
::
value_type
value_type
;
typedef
typename
List
::
value_type
value_type
;
const
uniform_type_info
*
m_value_type
;
uniform_type_info
const
*
m_value_type
;
list_member_util
()
:
m_value_type
(
uniform_typeid
<
value_type
>
())
list_member_util
()
:
m_value_type
(
uniform_typeid
<
value_type
>
())
{
{
}
}
void
operator
()(
const
Li
st
&
list
,
serializer
*
s
)
const
void
operator
()(
List
con
st
&
list
,
serializer
*
s
)
const
{
{
s
->
begin_sequence
(
list
.
size
());
s
->
begin_sequence
(
list
.
size
());
for
(
auto
i
=
list
.
begin
();
i
!=
list
.
end
();
++
i
)
for
(
auto
i
=
list
.
begin
();
i
!=
list
.
end
();
++
i
)
...
@@ -76,9 +76,9 @@ class list_member : public util::abstract_uniform_type_info<List>
...
@@ -76,9 +76,9 @@ class list_member : public util::abstract_uniform_type_info<List>
public:
public:
void
serialize
(
const
void
*
obj
,
serializer
*
s
)
const
void
serialize
(
void
const
*
obj
,
serializer
*
s
)
const
{
{
auto
&
list
=
*
reinterpret_cast
<
const
Li
st
*>
(
obj
);
auto
&
list
=
*
reinterpret_cast
<
List
con
st
*>
(
obj
);
m_helper
(
list
,
s
);
m_helper
(
list
,
s
);
}
}
...
...
cppa/detail/mailman.hpp
View file @
42db08af
...
@@ -15,9 +15,9 @@ struct mailman_send_job
...
@@ -15,9 +15,9 @@ struct mailman_send_job
process_information_ptr
target_peer
;
process_information_ptr
target_peer
;
addressed_message
msg
;
addressed_message
msg
;
inline
mailman_send_job
(
process_information_ptr
piptr
,
inline
mailman_send_job
(
process_information_ptr
piptr
,
const
actor_ptr
&
from
,
actor_ptr
const
&
from
,
c
onst
channel_ptr
&
to
,
c
hannel_ptr
const
&
to
,
const
any_tuple
&
content
)
any_tuple
const
&
content
)
:
target_peer
(
piptr
),
msg
(
from
,
to
,
content
)
:
target_peer
(
piptr
),
msg
(
from
,
to
,
content
)
{
{
}
}
...
@@ -28,7 +28,7 @@ struct mailman_add_peer
...
@@ -28,7 +28,7 @@ struct mailman_add_peer
native_socket_type
sockfd
;
native_socket_type
sockfd
;
process_information_ptr
pinfo
;
process_information_ptr
pinfo
;
inline
mailman_add_peer
(
native_socket_type
fd
,
inline
mailman_add_peer
(
native_socket_type
fd
,
const
process_information_ptr
&
piptr
)
process_information_ptr
const
&
piptr
)
:
sockfd
(
fd
),
pinfo
(
piptr
)
:
sockfd
(
fd
),
pinfo
(
piptr
)
{
{
}
}
...
@@ -49,11 +49,11 @@ class mailman_job
...
@@ -49,11 +49,11 @@ class mailman_job
};
};
mailman_job
(
process_information_ptr
piptr
,
mailman_job
(
process_information_ptr
piptr
,
const
actor_ptr
&
from
,
actor_ptr
const
&
from
,
c
onst
channel_ptr
&
to
,
c
hannel_ptr
const
&
to
,
const
any_tuple
&
omsg
);
any_tuple
const
&
omsg
);
mailman_job
(
native_socket_type
sockfd
,
const
process_information_ptr
&
pinfo
);
mailman_job
(
native_socket_type
sockfd
,
process_information_ptr
const
&
pinfo
);
static
mailman_job
*
kill_job
();
static
mailman_job
*
kill_job
();
...
...
cppa/detail/map_member.hpp
View file @
42db08af
...
@@ -23,7 +23,7 @@ struct map_member_util<T, false, true>
...
@@ -23,7 +23,7 @@ struct map_member_util<T, false, true>
{
{
primitive_member
<
T
>
impl
;
primitive_member
<
T
>
impl
;
void
serialize_value
(
const
T
&
what
,
serializer
*
s
)
const
void
serialize_value
(
T
const
&
what
,
serializer
*
s
)
const
{
{
impl
.
serialize
(
&
what
,
s
);
impl
.
serialize
(
&
what
,
s
);
}
}
...
@@ -41,13 +41,13 @@ struct map_member_util<T, false, true>
...
@@ -41,13 +41,13 @@ struct map_member_util<T, false, true>
template
<
typename
T
>
template
<
typename
T
>
struct
map_member_util
<
T
,
false
,
false
>
struct
map_member_util
<
T
,
false
,
false
>
{
{
const
uniform_type_info
*
m_type
;
uniform_type_info
const
*
m_type
;
map_member_util
()
:
m_type
(
uniform_typeid
<
T
>
())
map_member_util
()
:
m_type
(
uniform_typeid
<
T
>
())
{
{
}
}
void
serialize_value
(
const
T
&
what
,
serializer
*
s
)
const
void
serialize_value
(
T
const
&
what
,
serializer
*
s
)
const
{
{
m_type
->
serialize
(
&
what
,
s
);
m_type
->
serialize
(
&
what
,
s
);
}
}
...
@@ -73,7 +73,7 @@ struct map_member_util<T, true, false>
...
@@ -73,7 +73,7 @@ struct map_member_util<T, true, false>
pair_member
<
first_type
,
second_type
>
impl
;
pair_member
<
first_type
,
second_type
>
impl
;
void
serialize_value
(
const
T
&
what
,
serializer
*
s
)
const
void
serialize_value
(
T
const
&
what
,
serializer
*
s
)
const
{
{
// impl needs a pair without const modifier
// impl needs a pair without const modifier
std
::
pair
<
first_type
,
second_type
>
p
(
what
.
first
,
what
.
second
);
std
::
pair
<
first_type
,
second_type
>
p
(
what
.
first
,
what
.
second
);
...
@@ -105,11 +105,11 @@ class map_member : public util::abstract_uniform_type_info<Map>
...
@@ -105,11 +105,11 @@ class map_member : public util::abstract_uniform_type_info<Map>
public:
public:
void
serialize
(
const
void
*
obj
,
serializer
*
s
)
const
void
serialize
(
void
const
*
obj
,
serializer
*
s
)
const
{
{
auto
&
mp
=
*
reinterpret_cast
<
const
Map
*>
(
obj
);
auto
&
mp
=
*
reinterpret_cast
<
Map
const
*>
(
obj
);
s
->
begin_sequence
(
mp
.
size
());
s
->
begin_sequence
(
mp
.
size
());
for
(
const
auto
&
val
:
mp
)
for
(
auto
const
&
val
:
mp
)
{
{
m_helper
.
serialize_value
(
val
,
s
);
m_helper
.
serialize_value
(
val
,
s
);
}
}
...
...
cppa/detail/native_socket.hpp
View file @
42db08af
...
@@ -16,12 +16,12 @@ namespace cppa { namespace detail {
...
@@ -16,12 +16,12 @@ namespace cppa { namespace detail {
#ifdef CPPA_WINDOWS
#ifdef CPPA_WINDOWS
typedef
SOCKET
native_socket_type
;
typedef
SOCKET
native_socket_type
;
typedef
c
onst
char
*
socket_send_ptr
;
typedef
c
har
const
*
socket_send_ptr
;
typedef
char
*
socket_recv_ptr
;
typedef
char
*
socket_recv_ptr
;
constexpr
SOCKET
invalid_socket
=
INVALID_SOCKET
;
constexpr
SOCKET
invalid_socket
=
INVALID_SOCKET
;
#else
#else
typedef
int
native_socket_type
;
typedef
int
native_socket_type
;
typedef
const
void
*
socket_send_ptr
;
typedef
void
const
*
socket_send_ptr
;
typedef
void
*
socket_recv_ptr
;
typedef
void
*
socket_recv_ptr
;
constexpr
int
invalid_socket
=
-
1
;
constexpr
int
invalid_socket
=
-
1
;
void
closesocket
(
native_socket_type
s
);
void
closesocket
(
native_socket_type
s
);
...
...
cppa/detail/object_array.hpp
View file @
42db08af
...
@@ -19,14 +19,14 @@ class object_array : public detail::abstract_tuple
...
@@ -19,14 +19,14 @@ class object_array : public detail::abstract_tuple
object_array
(
object_array
&&
other
);
object_array
(
object_array
&&
other
);
object_array
(
const
object_array
&
other
);
object_array
(
object_array
const
&
other
);
/**
/**
* @pre
* @pre
*/
*/
void
push_back
(
object
&&
what
);
void
push_back
(
object
&&
what
);
void
push_back
(
const
objec
t
&
what
);
void
push_back
(
object
cons
t
&
what
);
void
*
mutable_at
(
size_t
pos
);
void
*
mutable_at
(
size_t
pos
);
...
@@ -34,11 +34,11 @@ class object_array : public detail::abstract_tuple
...
@@ -34,11 +34,11 @@ class object_array : public detail::abstract_tuple
abstract_tuple
*
copy
()
const
;
abstract_tuple
*
copy
()
const
;
const
void
*
at
(
size_t
pos
)
const
;
void
const
*
at
(
size_t
pos
)
const
;
bool
equals
(
c
onst
cppa
::
detail
::
abstract_tuple
&
)
const
;
bool
equals
(
c
ppa
::
detail
::
abstract_tuple
const
&
)
const
;
const
uniform_type_info
&
utype_info_at
(
size_t
pos
)
const
;
uniform_type_info
const
&
utype_info_at
(
size_t
pos
)
const
;
};
};
...
...
cppa/detail/object_impl.hpp
View file @
42db08af
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
namespace
cppa
{
namespace
cppa
{
template
<
typename
T
>
template
<
typename
T
>
const
utype
&
uniform_type_info
();
utype
const
&
uniform_type_info
();
}
}
...
@@ -17,11 +17,11 @@ struct obj_impl : object
...
@@ -17,11 +17,11 @@ struct obj_impl : object
{
{
T
m_value
;
T
m_value
;
obj_impl
()
:
m_value
()
{
}
obj_impl
()
:
m_value
()
{
}
obj_impl
(
const
T
&
v
)
:
m_value
(
v
)
{
}
obj_impl
(
T
const
&
v
)
:
m_value
(
v
)
{
}
virtual
object
*
copy
()
const
{
return
new
obj_impl
(
m_value
);
}
virtual
object
*
copy
()
const
{
return
new
obj_impl
(
m_value
);
}
virtual
const
utype
&
type
()
const
{
return
uniform_type_info
<
T
>
();
}
virtual
utype
const
&
type
()
const
{
return
uniform_type_info
<
T
>
();
}
virtual
void
*
mutable_value
()
{
return
&
m_value
;
}
virtual
void
*
mutable_value
()
{
return
&
m_value
;
}
virtual
const
void
*
value
()
const
{
return
&
m_value
;
}
virtual
void
const
*
value
()
const
{
return
&
m_value
;
}
virtual
void
serialize
(
serializer
&
s
)
const
virtual
void
serialize
(
serializer
&
s
)
const
{
{
s
<<
m_value
;
s
<<
m_value
;
...
...
cppa/detail/pair_member.hpp
View file @
42db08af
...
@@ -25,9 +25,9 @@ class pair_member : public util::abstract_uniform_type_info<std::pair<T1,T2>>
...
@@ -25,9 +25,9 @@ class pair_member : public util::abstract_uniform_type_info<std::pair<T1,T2>>
public:
public:
void
serialize
(
const
void
*
obj
,
serializer
*
s
)
const
void
serialize
(
void
const
*
obj
,
serializer
*
s
)
const
{
{
auto
&
p
=
*
reinterpret_cast
<
const
pair_type
*>
(
obj
);
auto
&
p
=
*
reinterpret_cast
<
pair_type
const
*>
(
obj
);
primitive_variant
values
[
2
]
=
{
p
.
first
,
p
.
second
};
primitive_variant
values
[
2
]
=
{
p
.
first
,
p
.
second
};
s
->
write_tuple
(
2
,
values
);
s
->
write_tuple
(
2
,
values
);
}
}
...
...
cppa/detail/pattern_details.hpp
View file @
42db08af
...
@@ -35,9 +35,9 @@ struct fill_vecs_util
...
@@ -35,9 +35,9 @@ struct fill_vecs_util
inline
static
void
_
(
size_t
pos
,
inline
static
void
_
(
size_t
pos
,
size_t
dt_size
,
size_t
dt_size
,
bool
*
dt_invalids
,
bool
*
dt_invalids
,
const
DataTuple
&
dt
,
DataTuple
const
&
dt
,
c
onst
cppa
::
uniform_type_info
*
*
utis
,
c
ppa
::
uniform_type_info
const
*
*
utis
,
const
void
*
*
data_ptrs
)
void
const
*
*
data_ptrs
)
{
{
utis
[
pos
]
=
uniform_typeid
<
T0
>
();
utis
[
pos
]
=
uniform_typeid
<
T0
>
();
if
(
pos
<
dt_size
&&
dt_invalids
[
pos
]
==
false
)
if
(
pos
<
dt_size
&&
dt_invalids
[
pos
]
==
false
)
...
@@ -58,9 +58,9 @@ struct fill_vecs_util<anything>
...
@@ -58,9 +58,9 @@ struct fill_vecs_util<anything>
inline
static
void
_
(
size_t
pos
,
inline
static
void
_
(
size_t
pos
,
size_t
,
size_t
,
bool
*
,
bool
*
,
const
DataTuple
&
,
DataTuple
const
&
,
c
onst
cppa
::
uniform_type_info
*
*
utis
,
c
ppa
::
uniform_type_info
const
*
*
utis
,
const
void
*
*
data_ptrs
)
void
const
*
*
data_ptrs
)
{
{
utis
[
pos
]
=
nullptr
;
utis
[
pos
]
=
nullptr
;
data_ptrs
[
pos
]
=
nullptr
;
data_ptrs
[
pos
]
=
nullptr
;
...
@@ -71,9 +71,9 @@ template<typename DataTuple, typename T0>
...
@@ -71,9 +71,9 @@ template<typename DataTuple, typename T0>
void
fill_vecs
(
size_t
pos
,
void
fill_vecs
(
size_t
pos
,
size_t
dt_size
,
size_t
dt_size
,
bool
*
dt_invalids
,
bool
*
dt_invalids
,
const
DataTuple
&
dt
,
DataTuple
const
&
dt
,
c
onst
cppa
::
uniform_type_info
*
*
utis
,
c
ppa
::
uniform_type_info
const
*
*
utis
,
const
void
*
*
data_ptrs
)
void
const
*
*
data_ptrs
)
{
{
fill_vecs_util
<
T0
>::
_
(
pos
,
dt_size
,
dt_invalids
,
dt
,
utis
,
data_ptrs
);
fill_vecs_util
<
T0
>::
_
(
pos
,
dt_size
,
dt_invalids
,
dt
,
utis
,
data_ptrs
);
}
}
...
@@ -82,9 +82,9 @@ template<typename DataTuple, typename T0, typename T1, typename... Tn>
...
@@ -82,9 +82,9 @@ template<typename DataTuple, typename T0, typename T1, typename... Tn>
void
fill_vecs
(
size_t
pos
,
void
fill_vecs
(
size_t
pos
,
size_t
dt_size
,
size_t
dt_size
,
bool
*
dt_invalids
,
bool
*
dt_invalids
,
const
DataTuple
&
dt
,
DataTuple
const
&
dt
,
c
onst
cppa
::
uniform_type_info
*
*
utis
,
c
ppa
::
uniform_type_info
const
*
*
utis
,
const
void
*
*
data_ptrs
)
void
const
*
*
data_ptrs
)
{
{
fill_vecs_util
<
T0
>::
_
(
pos
,
dt_size
,
dt_invalids
,
fill_vecs_util
<
T0
>::
_
(
pos
,
dt_size
,
dt_invalids
,
dt
,
utis
,
data_ptrs
);
dt
,
utis
,
data_ptrs
);
...
@@ -112,9 +112,9 @@ struct pattern_arg
...
@@ -112,9 +112,9 @@ struct pattern_arg
{
{
}
}
pattern_arg
(
const
pattern_arg
&
)
=
default
;
pattern_arg
(
pattern_arg
const
&
)
=
default
;
pattern_arg
&
operator
=
(
const
pattern_arg
&
)
=
default
;
pattern_arg
&
operator
=
(
pattern_arg
const
&
)
=
default
;
inline
bool
at_end
()
const
{
return
m_pos
==
m_size
;
}
inline
bool
at_end
()
const
{
return
m_pos
==
m_size
;
}
...
@@ -124,12 +124,12 @@ struct pattern_arg
...
@@ -124,12 +124,12 @@ struct pattern_arg
return
*
this
;
return
*
this
;
}
}
inline
const
uniform_type_info
*
type
()
const
inline
uniform_type_info
const
*
type
()
const
{
{
return
m_types
[
m_pos
];
return
m_types
[
m_pos
];
}
}
inline
const
void
*
value
()
const
inline
void
const
*
value
()
const
{
{
return
m_data
[
m_pos
];
return
m_data
[
m_pos
];
}
}
...
@@ -147,13 +147,13 @@ struct tuple_iterator_arg
...
@@ -147,13 +147,13 @@ struct tuple_iterator_arg
util
::
any_tuple_iterator
iter
;
util
::
any_tuple_iterator
iter
;
vector_type
*
mapping
;
vector_type
*
mapping
;
inline
tuple_iterator_arg
(
const
any_tuple
&
tup
,
inline
tuple_iterator_arg
(
any_tuple
const
&
tup
,
vector_type
*
mv
=
nullptr
)
vector_type
*
mv
=
nullptr
)
:
iter
(
tup
),
mapping
(
mv
)
:
iter
(
tup
),
mapping
(
mv
)
{
{
}
}
inline
tuple_iterator_arg
(
const
util
::
any_tuple_iterator
&
from_iter
,
inline
tuple_iterator_arg
(
util
::
any_tuple_iterator
const
&
from_iter
,
vector_type
*
mv
=
nullptr
)
vector_type
*
mv
=
nullptr
)
:
iter
(
from_iter
),
mapping
(
mv
)
:
iter
(
from_iter
),
mapping
(
mv
)
{
{
...
@@ -173,12 +173,12 @@ struct tuple_iterator_arg
...
@@ -173,12 +173,12 @@ struct tuple_iterator_arg
return
*
this
;
return
*
this
;
}
}
inline
const
uniform_type_info
*
type
()
const
inline
uniform_type_info
const
*
type
()
const
{
{
return
&
(
iter
.
type
());
return
&
(
iter
.
type
());
}
}
inline
const
void
*
value
()
const
inline
void
const
*
value
()
const
{
{
return
iter
.
value_ptr
();
return
iter
.
value_ptr
();
}
}
...
...
cppa/detail/post_office.hpp
View file @
42db08af
...
@@ -11,12 +11,12 @@ namespace cppa { namespace detail {
...
@@ -11,12 +11,12 @@ namespace cppa { namespace detail {
void
post_office_loop
(
int
pipe_read_handle
,
int
pipe_write_handle
);
void
post_office_loop
(
int
pipe_read_handle
,
int
pipe_write_handle
);
void
post_office_add_peer
(
native_socket_type
peer_socket
,
void
post_office_add_peer
(
native_socket_type
peer_socket
,
const
process_information_ptr
&
peer_ptr
,
process_information_ptr
const
&
peer_ptr
,
const
actor_proxy_ptr
&
peer_actor_ptr
,
actor_proxy_ptr
const
&
peer_actor_ptr
,
std
::
unique_ptr
<
attachable
>&&
peer_observer
);
std
::
unique_ptr
<
attachable
>&&
peer_observer
);
void
post_office_publish
(
native_socket_type
server_socket
,
void
post_office_publish
(
native_socket_type
server_socket
,
const
actor_ptr
&
published_actor
);
actor_ptr
const
&
published_actor
);
void
post_office_unpublish
(
actor_id
whom
);
void
post_office_unpublish
(
actor_id
whom
);
...
...
cppa/detail/post_office_msg.hpp
View file @
42db08af
...
@@ -33,8 +33,8 @@ class post_office_msg
...
@@ -33,8 +33,8 @@ class post_office_msg
std
::
unique_ptr
<
attachable
>
attachable_ptr
;
std
::
unique_ptr
<
attachable
>
attachable_ptr
;
add_peer
(
native_socket_type
peer_socket
,
add_peer
(
native_socket_type
peer_socket
,
const
process_information_ptr
&
peer_ptr
,
process_information_ptr
const
&
peer_ptr
,
const
actor_proxy_ptr
&
peer_actor_ptr
,
actor_proxy_ptr
const
&
peer_actor_ptr
,
std
::
unique_ptr
<
attachable
>&&
peer_observer
);
std
::
unique_ptr
<
attachable
>&&
peer_observer
);
};
};
...
@@ -45,24 +45,24 @@ class post_office_msg
...
@@ -45,24 +45,24 @@ class post_office_msg
native_socket_type
server_sockfd
;
native_socket_type
server_sockfd
;
actor_ptr
published_actor
;
actor_ptr
published_actor
;
add_server_socket
(
native_socket_type
ssockfd
,
const
actor_ptr
&
whom
);
add_server_socket
(
native_socket_type
ssockfd
,
actor_ptr
const
&
whom
);
};
};
struct
proxy_exited
struct
proxy_exited
{
{
actor_proxy_ptr
proxy_ptr
;
actor_proxy_ptr
proxy_ptr
;
inline
proxy_exited
(
const
actor_proxy_ptr
&
who
)
:
proxy_ptr
(
who
)
{
}
inline
proxy_exited
(
actor_proxy_ptr
const
&
who
)
:
proxy_ptr
(
who
)
{
}
};
};
post_office_msg
(
native_socket_type
arg0
,
post_office_msg
(
native_socket_type
arg0
,
const
process_information_ptr
&
arg1
,
process_information_ptr
const
&
arg1
,
const
actor_proxy_ptr
&
arg2
,
actor_proxy_ptr
const
&
arg2
,
std
::
unique_ptr
<
attachable
>&&
arg3
);
std
::
unique_ptr
<
attachable
>&&
arg3
);
post_office_msg
(
native_socket_type
arg0
,
const
actor_ptr
&
arg1
);
post_office_msg
(
native_socket_type
arg0
,
actor_ptr
const
&
arg1
);
post_office_msg
(
const
actor_proxy_ptr
&
proxy_ptr
);
post_office_msg
(
actor_proxy_ptr
const
&
proxy_ptr
);
inline
bool
is_add_peer_msg
()
const
inline
bool
is_add_peer_msg
()
const
{
{
...
...
cppa/detail/primitive_member.hpp
View file @
42db08af
...
@@ -21,9 +21,9 @@ class primitive_member : public util::abstract_uniform_type_info<T>
...
@@ -21,9 +21,9 @@ class primitive_member : public util::abstract_uniform_type_info<T>
public:
public:
void
serialize
(
const
void
*
obj
,
serializer
*
s
)
const
void
serialize
(
void
const
*
obj
,
serializer
*
s
)
const
{
{
s
->
write_value
(
*
reinterpret_cast
<
const
T
*>
(
obj
));
s
->
write_value
(
*
reinterpret_cast
<
T
const
*>
(
obj
));
}
}
void
deserialize
(
void
*
obj
,
deserializer
*
d
)
const
void
deserialize
(
void
*
obj
,
deserializer
*
d
)
const
...
...
cppa/detail/receive_loop_helper.hpp
View file @
42db08af
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, 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 RECEIVE_LOOP_HELPER_HPP
#ifndef RECEIVE_LOOP_HELPER_HPP
#define RECEIVE_LOOP_HELPER_HPP
#define RECEIVE_LOOP_HELPER_HPP
...
...
cppa/detail/ref_counted_impl.hpp
View file @
42db08af
...
@@ -9,9 +9,9 @@ class ref_counted_impl
...
@@ -9,9 +9,9 @@ class ref_counted_impl
T
m_rc
;
T
m_rc
;
ref_counted_impl
(
const
ref_counted_impl
&
)
=
delete
;
ref_counted_impl
(
ref_counted_impl
const
&
)
=
delete
;
ref_counted_impl
&
operator
=
(
const
ref_counted_impl
&
)
=
delete
;
ref_counted_impl
&
operator
=
(
ref_counted_impl
const
&
)
=
delete
;
public:
public:
...
...
cppa/detail/serialize_tuple.hpp
View file @
42db08af
...
@@ -14,7 +14,7 @@ template<typename List, size_t Pos = 0>
...
@@ -14,7 +14,7 @@ template<typename List, size_t Pos = 0>
struct
serialize_tuple
struct
serialize_tuple
{
{
template
<
typename
T
>
template
<
typename
T
>
inline
static
void
_
(
serializer
&
s
,
const
T
*
tup
)
inline
static
void
_
(
serializer
&
s
,
T
const
*
tup
)
{
{
s
<<
uniform_typeid
<
typename
List
::
head_type
>
()
->
name
()
s
<<
uniform_typeid
<
typename
List
::
head_type
>
()
->
name
()
<<
*
reinterpret_cast
<
const
typename
List
::
head_type
*>
(
tup
->
at
(
Pos
));
<<
*
reinterpret_cast
<
const
typename
List
::
head_type
*>
(
tup
->
at
(
Pos
));
...
@@ -26,7 +26,7 @@ template<size_t Pos>
...
@@ -26,7 +26,7 @@ template<size_t Pos>
struct
serialize_tuple
<
util
::
type_list
<>
,
Pos
>
struct
serialize_tuple
<
util
::
type_list
<>
,
Pos
>
{
{
template
<
typename
T
>
template
<
typename
T
>
inline
static
void
_
(
serializer
&
,
const
T
*
)
{
}
inline
static
void
_
(
serializer
&
,
T
const
*
)
{
}
};
};
}
}
// namespace cppa::detail
}
}
// namespace cppa::detail
...
...
cppa/detail/tdata.hpp
View file @
42db08af
...
@@ -29,17 +29,17 @@ struct tdata<>
...
@@ -29,17 +29,17 @@ struct tdata<>
throw
std
::
out_of_range
(
""
);
throw
std
::
out_of_range
(
""
);
}
}
const
tdata
<>
&
tail
()
const
tdata
<>
const
&
tail
()
const
{
{
throw
std
::
out_of_range
(
""
);
throw
std
::
out_of_range
(
""
);
}
}
inline
const
void
*
at
(
size_t
)
const
inline
void
const
*
at
(
size_t
)
const
{
{
throw
std
::
out_of_range
(
""
);
throw
std
::
out_of_range
(
""
);
}
}
inline
bool
operator
==
(
const
tdata
&
)
const
inline
bool
operator
==
(
tdata
const
&
)
const
{
{
return
true
;
return
true
;
}
}
...
@@ -56,15 +56,15 @@ struct tdata<Head, Tail...> : tdata<Tail...>
...
@@ -56,15 +56,15 @@ struct tdata<Head, Tail...> : tdata<Tail...>
inline
tdata
()
:
super
(),
head
()
{
}
inline
tdata
()
:
super
(),
head
()
{
}
//tdata(
const Head& v0, const Tail
&... vals) : super(vals...), head(v0) { }
//tdata(
Head const& v0, Tail const
&... vals) : super(vals...), head(v0) { }
// allow partial initialization
// allow partial initialization
template
<
typename
...
Args
>
template
<
typename
...
Args
>
tdata
(
const
Head
&
v0
,
const
Args
&
...
vals
)
:
super
(
vals
...),
head
(
v0
)
{
}
tdata
(
Head
const
&
v0
,
Args
const
&
...
vals
)
:
super
(
vals
...),
head
(
v0
)
{
}
// allow initialization with wrapped<Head> (uses the default constructor)
// allow initialization with wrapped<Head> (uses the default constructor)
template
<
typename
...
Args
>
template
<
typename
...
Args
>
tdata
(
const
util
::
wrapped
<
Head
>&
,
const
Args
&
...
vals
)
tdata
(
util
::
wrapped
<
Head
>
const
&
,
Args
const
&
...
vals
)
:
super
(
vals
...),
head
()
:
super
(
vals
...),
head
()
{
{
}
}
...
@@ -75,18 +75,18 @@ struct tdata<Head, Tail...> : tdata<Tail...>
...
@@ -75,18 +75,18 @@ struct tdata<Head, Tail...> : tdata<Tail...>
return
*
this
;
return
*
this
;
}
}
inline
const
tdata
<
Tail
...
>
&
tail
()
const
inline
tdata
<
Tail
...
>
const
&
tail
()
const
{
{
// upcast
// upcast
return
*
this
;
return
*
this
;
}
}
inline
bool
operator
==
(
const
tdata
&
other
)
const
inline
bool
operator
==
(
tdata
const
&
other
)
const
{
{
return
head
==
other
.
head
&&
tail
()
==
other
.
tail
();
return
head
==
other
.
head
&&
tail
()
==
other
.
tail
();
}
}
inline
const
void
*
at
(
size_t
pos
)
const
inline
void
const
*
at
(
size_t
pos
)
const
{
{
return
(
pos
==
0
)
?
&
head
:
super
::
at
(
pos
-
1
);
return
(
pos
==
0
)
?
&
head
:
super
::
at
(
pos
-
1
);
}
}
...
@@ -122,13 +122,13 @@ struct tdata_from_type_list<cppa::util::type_list<T...>>
...
@@ -122,13 +122,13 @@ struct tdata_from_type_list<cppa::util::type_list<T...>>
namespace
cppa
{
namespace
cppa
{
template
<
typename
...
Tn
>
template
<
typename
...
Tn
>
inline
detail
::
tdata
<
Tn
...
>
make_tdata
(
const
Tn
&
...
args
)
inline
detail
::
tdata
<
Tn
...
>
make_tdata
(
Tn
const
&
...
args
)
{
{
return
detail
::
tdata
<
Tn
...
>
(
args
...);
return
detail
::
tdata
<
Tn
...
>
(
args
...);
}
}
template
<
size_t
N
,
typename
...
Tn
>
template
<
size_t
N
,
typename
...
Tn
>
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
const
detail
::
tdata
<
Tn
...
>
&
tv
)
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
detail
::
tdata
<
Tn
...
>
const
&
tv
)
{
{
static_assert
(
N
<
sizeof
...(
Tn
),
"N >= tv.size()"
);
static_assert
(
N
<
sizeof
...(
Tn
),
"N >= tv.size()"
);
return
static_cast
<
const
typename
detail
::
tdata_upcast_helper
<
N
,
Tn
...
>::
type
&>
(
tv
).
head
;
return
static_cast
<
const
typename
detail
::
tdata_upcast_helper
<
N
,
Tn
...
>::
type
&>
(
tv
).
head
;
...
...
cppa/detail/thread.hpp
View file @
42db08af
...
@@ -18,7 +18,7 @@ namespace this_thread { using namespace boost::this_thread; }
...
@@ -18,7 +18,7 @@ namespace this_thread { using namespace boost::this_thread; }
template
<
class
Lock
,
class
Condition
>
template
<
class
Lock
,
class
Condition
>
inline
bool
wait_until
(
Lock
&
lock
,
Condition
&
cond
,
inline
bool
wait_until
(
Lock
&
lock
,
Condition
&
cond
,
const
boost
::
system_time
&
timeout
)
boost
::
system_time
const
&
timeout
)
{
{
return
cond
.
timed_wait
(
lock
,
timeout
);
return
cond
.
timed_wait
(
lock
,
timeout
);
}
}
...
@@ -31,7 +31,7 @@ inline boost::system_time now()
...
@@ -31,7 +31,7 @@ inline boost::system_time now()
}
}
// namespace cppa::detail
}
}
// namespace cppa::detail
inline
boost
::
system_time
&
operator
+=
(
boost
::
system_time
&
lhs
,
inline
boost
::
system_time
&
operator
+=
(
boost
::
system_time
&
lhs
,
c
onst
cppa
::
util
::
duration
&
rhs
)
c
ppa
::
util
::
duration
const
&
rhs
)
{
{
switch
(
rhs
.
unit
)
switch
(
rhs
.
unit
)
{
{
...
@@ -70,7 +70,7 @@ namespace this_thread { using namespace std::this_thread; }
...
@@ -70,7 +70,7 @@ namespace this_thread { using namespace std::this_thread; }
// returns false if a timeout occured
// returns false if a timeout occured
template
<
class
Lock
,
class
Condition
,
typename
TimePoint
>
template
<
class
Lock
,
class
Condition
,
typename
TimePoint
>
inline
bool
wait_until
(
Lock
&
lock
,
Condition
&
cond
,
const
TimePoin
t
&
timeout
)
inline
bool
wait_until
(
Lock
&
lock
,
Condition
&
cond
,
TimePoint
cons
t
&
timeout
)
{
{
return
cond
.
wait_until
(
lock
,
timeout
)
!=
std
::
cv_status
::
timeout
;
return
cond
.
wait_until
(
lock
,
timeout
)
!=
std
::
cv_status
::
timeout
;
}
}
...
...
cppa/detail/to_uniform_name.hpp
View file @
42db08af
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
namespace
cppa
{
namespace
detail
{
namespace
cppa
{
namespace
detail
{
std
::
string
to_uniform_name
(
const
std
::
string
&
demangled_name
);
std
::
string
to_uniform_name
(
std
::
string
const
&
demangled_name
);
std
::
string
to_uniform_name
(
const
std
::
type_info
&
tinfo
);
std
::
string
to_uniform_name
(
std
::
type_info
const
&
tinfo
);
}
}
// namespace cppa::detail
}
}
// namespace cppa::detail
...
...
cppa/detail/tuple_vals.hpp
View file @
42db08af
...
@@ -32,20 +32,20 @@ class tuple_vals : public abstract_tuple
...
@@ -32,20 +32,20 @@ class tuple_vals : public abstract_tuple
}
}
template
<
typename
...
Types
>
template
<
typename
...
Types
>
const
void
*
tdata_at
(
const
tdata
<
Types
...
>
&
d
,
size_t
pos
)
const
void
const
*
tdata_at
(
tdata
<
Types
...
>
const
&
d
,
size_t
pos
)
const
{
{
return
(
pos
==
0
)
?
&
(
d
.
head
)
:
tdata_at
(
d
.
tail
(),
pos
-
1
);
return
(
pos
==
0
)
?
&
(
d
.
head
)
:
tdata_at
(
d
.
tail
(),
pos
-
1
);
}
}
public:
public:
tuple_vals
(
const
tuple_vals
&
other
)
:
super
(),
m_data
(
other
.
m_data
)
{
}
tuple_vals
(
tuple_vals
const
&
other
)
:
super
(),
m_data
(
other
.
m_data
)
{
}
tuple_vals
()
:
m_data
()
{
}
tuple_vals
()
:
m_data
()
{
}
tuple_vals
(
const
ElementTypes
&
...
args
)
:
m_data
(
args
...)
{
}
tuple_vals
(
ElementTypes
const
&
...
args
)
:
m_data
(
args
...)
{
}
inline
const
data_type
&
data
()
const
{
return
m_data
;
}
inline
data_type
const
&
data
()
const
{
return
m_data
;
}
inline
data_type
&
data_ref
()
{
return
m_data
;
}
inline
data_type
&
data_ref
()
{
return
m_data
;
}
...
@@ -64,20 +64,20 @@ class tuple_vals : public abstract_tuple
...
@@ -64,20 +64,20 @@ class tuple_vals : public abstract_tuple
return
new
tuple_vals
(
*
this
);
return
new
tuple_vals
(
*
this
);
}
}
const
void
*
at
(
size_t
pos
)
const
void
const
*
at
(
size_t
pos
)
const
{
{
return
tdata_at
(
m_data
,
pos
);
return
tdata_at
(
m_data
,
pos
);
}
}
const
uniform_type_info
&
utype_info_at
(
size_t
pos
)
const
uniform_type_info
const
&
utype_info_at
(
size_t
pos
)
const
{
{
return
m_types
.
at
(
pos
);
return
m_types
.
at
(
pos
);
}
}
bool
equals
(
const
abstract_tuple
&
other
)
const
bool
equals
(
abstract_tuple
const
&
other
)
const
{
{
if
(
size
()
!=
other
.
size
())
return
false
;
if
(
size
()
!=
other
.
size
())
return
false
;
const
tuple_vals
*
o
=
dynamic_cast
<
const
tuple_vals
*>
(
&
other
);
tuple_vals
const
*
o
=
dynamic_cast
<
tuple_vals
const
*>
(
&
other
);
if
(
o
)
if
(
o
)
{
{
return
m_data
==
(
o
->
m_data
);
return
m_data
==
(
o
->
m_data
);
...
...
cppa/detail/uniform_type_info_map.hpp
View file @
42db08af
...
@@ -29,19 +29,19 @@ class uniform_type_info_map
...
@@ -29,19 +29,19 @@ class uniform_type_info_map
~
uniform_type_info_map
();
~
uniform_type_info_map
();
inline
const
int_map
&
int_names
()
const
inline
int_map
const
&
int_names
()
const
{
{
return
m_ints
;
return
m_ints
;
}
}
uniform_type_info
*
by_raw_name
(
const
std
::
string
&
name
)
const
;
uniform_type_info
*
by_raw_name
(
std
::
string
const
&
name
)
const
;
uniform_type_info
*
by_uniform_name
(
const
std
::
string
&
name
)
const
;
uniform_type_info
*
by_uniform_name
(
std
::
string
const
&
name
)
const
;
std
::
vector
<
uniform_type_info
*>
get_all
()
const
;
std
::
vector
<
uniform_type_info
*>
get_all
()
const
;
// NOT thread safe!
// NOT thread safe!
bool
insert
(
const
std
::
set
<
std
::
string
>
&
raw_names
,
uniform_type_info
*
uti
);
bool
insert
(
std
::
set
<
std
::
string
>
const
&
raw_names
,
uniform_type_info
*
uti
);
private:
private:
...
...
cppa/exception.hpp
View file @
42db08af
...
@@ -22,7 +22,7 @@ class exception : public std::exception
...
@@ -22,7 +22,7 @@ class exception : public std::exception
* @brief Returns the error message.
* @brief Returns the error message.
* @returns The error message as C-string.
* @returns The error message as C-string.
*/
*/
c
onst
char
*
what
()
const
throw
();
c
har
const
*
what
()
const
throw
();
protected:
protected:
...
@@ -36,7 +36,7 @@ class exception : public std::exception
...
@@ -36,7 +36,7 @@ class exception : public std::exception
* @brief Creates an exception with the error string @p what_str.
* @brief Creates an exception with the error string @p what_str.
* @param what_str Error message as string.
* @param what_str Error message as string.
*/
*/
exception
(
const
std
::
string
&
what_str
);
exception
(
std
::
string
const
&
what_str
);
private:
private:
...
@@ -77,7 +77,7 @@ class network_error : public exception
...
@@ -77,7 +77,7 @@ class network_error : public exception
public:
public:
network_error
(
std
::
string
&&
what_str
);
network_error
(
std
::
string
&&
what_str
);
network_error
(
const
std
::
string
&
what_str
);
network_error
(
std
::
string
const
&
what_str
);
};
};
...
...
cppa/from_string.hpp
View file @
42db08af
...
@@ -10,13 +10,13 @@
...
@@ -10,13 +10,13 @@
namespace
cppa
{
namespace
cppa
{
object
from_string
(
const
std
::
string
&
what
);
object
from_string
(
std
::
string
const
&
what
);
template
<
typename
T
>
template
<
typename
T
>
T
from_string
(
const
std
::
string
&
what
)
T
from_string
(
const
std
::
string
&
what
)
{
{
object
o
=
from_string
(
what
);
object
o
=
from_string
(
what
);
const
std
::
type_info
&
tinfo
=
typeid
(
T
);
std
::
type_info
const
&
tinfo
=
typeid
(
T
);
if
(
o
.
type
()
==
tinfo
)
if
(
o
.
type
()
==
tinfo
)
{
{
return
std
::
move
(
get
<
T
>
(
o
));
return
std
::
move
(
get
<
T
>
(
o
));
...
...
cppa/get.hpp
View file @
42db08af
...
@@ -17,17 +17,17 @@ template<typename...> class tuple;
...
@@ -17,17 +17,17 @@ template<typename...> class tuple;
// forward declaration of tuple_view
// forward declaration of tuple_view
template
<
typename
...
>
class
tuple_view
;
template
<
typename
...
>
class
tuple_view
;
// forward declaration of get(
const detail::tdata<...>
&)
// forward declaration of get(
detail::tdata<...> const
&)
template
<
size_t
N
,
typename
...
Tn
>
template
<
size_t
N
,
typename
...
Tn
>
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
const
detail
::
tdata
<
Tn
...
>
&
);
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
detail
::
tdata
<
Tn
...
>
const
&
);
// forward declarations of get(
const tuple<...>
&)
// forward declarations of get(
tuple<...> const
&)
template
<
size_t
N
,
typename
...
Tn
>
template
<
size_t
N
,
typename
...
Tn
>
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
const
tuple
<
Tn
...
>
&
);
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
tuple
<
Tn
...
>
const
&
);
// forward declarations of get(
const tuple_view<...>
&)
// forward declarations of get(
tuple_view<...> const
&)
template
<
size_t
N
,
typename
...
Tn
>
template
<
size_t
N
,
typename
...
Tn
>
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
const
tuple_view
<
Tn
...
>
&
);
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
tuple_view
<
Tn
...
>
const
&
);
// forward declarations of get_ref(detail::tdata<...>&)
// forward declarations of get_ref(detail::tdata<...>&)
template
<
size_t
N
,
typename
...
Tn
>
template
<
size_t
N
,
typename
...
Tn
>
...
...
cppa/get_view.hpp
View file @
42db08af
...
@@ -15,7 +15,7 @@ namespace cppa {
...
@@ -15,7 +15,7 @@ namespace cppa {
template
<
typename
...
MatchRules
>
template
<
typename
...
MatchRules
>
typename
tuple_view_type_from_type_list
<
typename
util
::
filter_type_list
<
anything
,
util
::
type_list
<
MatchRules
...
>>::
type
>::
type
typename
tuple_view_type_from_type_list
<
typename
util
::
filter_type_list
<
anything
,
util
::
type_list
<
MatchRules
...
>>::
type
>::
type
get_view
(
const
any_tuple
&
ut
)
get_view
(
any_tuple
const
&
ut
)
{
{
pattern
<
MatchRules
...
>
p
;
pattern
<
MatchRules
...
>
p
;
typename
pattern
<
MatchRules
...
>::
mapping_vector
mapping
;
typename
pattern
<
MatchRules
...
>::
mapping_vector
mapping
;
...
...
cppa/group.hpp
View file @
42db08af
...
@@ -27,9 +27,9 @@ class group : public channel
...
@@ -27,9 +27,9 @@ class group : public channel
group
(
std
::
string
&&
id
,
std
::
string
&&
mod_name
);
group
(
std
::
string
&&
id
,
std
::
string
&&
mod_name
);
group
(
const
std
::
string
&
id
,
const
std
::
string
&
mod_name
);
group
(
std
::
string
const
&
id
,
std
::
string
const
&
mod_name
);
virtual
void
unsubscribe
(
c
onst
channel_ptr
&
who
)
=
0
;
virtual
void
unsubscribe
(
c
hannel_ptr
const
&
who
)
=
0
;
public:
public:
...
@@ -49,14 +49,14 @@ class group : public channel
...
@@ -49,14 +49,14 @@ class group : public channel
public:
public:
unsubscriber
(
c
onst
channel_ptr
&
s
,
const
intrusive_ptr
<
group
>
&
g
);
unsubscriber
(
c
hannel_ptr
const
&
s
,
intrusive_ptr
<
group
>
const
&
g
);
~
unsubscriber
();
~
unsubscriber
();
void
actor_exited
(
std
::
uint32_t
);
void
actor_exited
(
std
::
uint32_t
);
// matches on m_group
// matches on m_group
bool
matches
(
const
attachable
::
token
&
what
);
bool
matches
(
attachable
::
token
const
&
what
);
};
};
...
@@ -73,7 +73,7 @@ class group : public channel
...
@@ -73,7 +73,7 @@ class group : public channel
protected:
protected:
module
(
std
::
string
&&
module_name
);
module
(
std
::
string
&&
module_name
);
module
(
const
std
::
string
&
module_name
);
module
(
std
::
string
const
&
module_name
);
public:
public:
...
@@ -82,14 +82,14 @@ class group : public channel
...
@@ -82,14 +82,14 @@ class group : public channel
* @returns The name of this module implementation.
* @returns The name of this module implementation.
* @threadsafe
* @threadsafe
*/
*/
const
std
::
string
&
name
();
std
::
string
const
&
name
();
/**
/**
* @brief Get a pointer to the group associated with
* @brief Get a pointer to the group associated with
* the name @p group_name.
* the name @p group_name.
* @threadsafe
* @threadsafe
*/
*/
virtual
intrusive_ptr
<
group
>
get
(
const
std
::
string
&
group_name
)
=
0
;
virtual
intrusive_ptr
<
group
>
get
(
std
::
string
const
&
group_name
)
=
0
;
};
};
...
@@ -98,28 +98,28 @@ class group : public channel
...
@@ -98,28 +98,28 @@ class group : public channel
* @returns The group identifier as string (e.g. "224.0.0.1" for IPv4
* @returns The group identifier as string (e.g. "224.0.0.1" for IPv4
* multicast or a user-defined string for local groups).
* multicast or a user-defined string for local groups).
*/
*/
const
std
::
string
&
identifier
()
const
;
std
::
string
const
&
identifier
()
const
;
/**
/**
* @brief The name of the module.
* @brief The name of the module.
* @returns The module name of this group (e.g. "local").
* @returns The module name of this group (e.g. "local").
*/
*/
const
std
::
string
&
module_name
()
const
;
std
::
string
const
&
module_name
()
const
;
/**
/**
* @brief Subscribe @p who to this group.
* @brief Subscribe @p who to this group.
* @returns A {@link subscription} object that unsubscribes @p who
* @returns A {@link subscription} object that unsubscribes @p who
* if the lifetime of @p who ends.
* if the lifetime of @p who ends.
*/
*/
virtual
subscription
subscribe
(
c
onst
channel_ptr
&
who
)
=
0
;
virtual
subscription
subscribe
(
c
hannel_ptr
const
&
who
)
=
0
;
/**
/**
* @brief Get a pointer to the group associated with
* @brief Get a pointer to the group associated with
* @p group_identifier from the module @p module_name.
* @p group_identifier from the module @p module_name.
* @threadsafe
* @threadsafe
*/
*/
static
intrusive_ptr
<
group
>
get
(
const
std
::
string
&
module_name
,
static
intrusive_ptr
<
group
>
get
(
std
::
string
const
&
module_name
,
const
std
::
string
&
group_identifier
);
std
::
string
const
&
group_identifier
);
/**
/**
* @brief Add a new group module to the libcppa group management.
* @brief Add a new group module to the libcppa group management.
...
...
cppa/intrusive_ptr.hpp
View file @
42db08af
...
@@ -16,7 +16,7 @@ struct convertible
...
@@ -16,7 +16,7 @@ struct convertible
{
{
To
convert
()
const
To
convert
()
const
{
{
return
static_cast
<
const
From
*>
(
this
)
->
do_convert
();
return
static_cast
<
From
const
*>
(
this
)
->
do_convert
();
}
}
};
};
...
@@ -25,7 +25,7 @@ struct convertible
...
@@ -25,7 +25,7 @@ struct convertible
* @relates ref_counted
* @relates ref_counted
*/
*/
template
<
typename
T
>
template
<
typename
T
>
class
intrusive_ptr
:
util
::
comparable
<
intrusive_ptr
<
T
>
,
const
T
*>
,
class
intrusive_ptr
:
util
::
comparable
<
intrusive_ptr
<
T
>
,
T
const
*>
,
util
::
comparable
<
intrusive_ptr
<
T
>>
util
::
comparable
<
intrusive_ptr
<
T
>>
{
{
...
@@ -43,7 +43,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
...
@@ -43,7 +43,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
intrusive_ptr
(
T
*
raw_ptr
)
{
set_ptr
(
raw_ptr
);
}
intrusive_ptr
(
T
*
raw_ptr
)
{
set_ptr
(
raw_ptr
);
}
intrusive_ptr
(
const
intrusive_ptr
&
other
)
intrusive_ptr
(
intrusive_ptr
const
&
other
)
{
{
set_ptr
(
other
.
m_ptr
);
set_ptr
(
other
.
m_ptr
);
}
}
...
@@ -59,7 +59,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
...
@@ -59,7 +59,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
}
}
template
<
typename
Y
>
template
<
typename
Y
>
intrusive_ptr
(
const
intrusive_ptr
<
Y
>
&
other
)
intrusive_ptr
(
intrusive_ptr
<
Y
>
const
&
other
)
{
{
static_assert
(
std
::
is_convertible
<
Y
*
,
T
*>::
value
,
static_assert
(
std
::
is_convertible
<
Y
*
,
T
*>::
value
,
"Y* is not assignable to T*"
);
"Y* is not assignable to T*"
);
...
@@ -83,7 +83,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
...
@@ -83,7 +83,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
inline
T
*
get
()
{
return
m_ptr
;
}
inline
T
*
get
()
{
return
m_ptr
;
}
inline
const
T
*
get
()
const
{
return
m_ptr
;
}
inline
T
const
*
get
()
const
{
return
m_ptr
;
}
T
*
take
()
T
*
take
()
{
{
...
@@ -109,7 +109,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
...
@@ -109,7 +109,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
return
*
this
;
return
*
this
;
}
}
intrusive_ptr
&
operator
=
(
const
intrusive_ptr
&
other
)
intrusive_ptr
&
operator
=
(
intrusive_ptr
const
&
other
)
{
{
intrusive_ptr
tmp
(
other
);
intrusive_ptr
tmp
(
other
);
swap
(
tmp
);
swap
(
tmp
);
...
@@ -124,7 +124,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
...
@@ -124,7 +124,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
}
}
template
<
typename
Y
>
template
<
typename
Y
>
intrusive_ptr
&
operator
=
(
const
intrusive_ptr
<
Y
>
&
other
)
intrusive_ptr
&
operator
=
(
intrusive_ptr
<
Y
>
const
&
other
)
{
{
static_assert
(
std
::
is_convertible
<
Y
*
,
T
*>::
value
,
static_assert
(
std
::
is_convertible
<
Y
*
,
T
*>::
value
,
"Y* is not assignable to T*"
);
"Y* is not assignable to T*"
);
...
@@ -154,18 +154,18 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
...
@@ -154,18 +154,18 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
inline
T
&
operator
*
()
{
return
*
m_ptr
;
}
inline
T
&
operator
*
()
{
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
T
const
&
operator
*
()
const
{
return
*
m_ptr
;
}
inline
explicit
operator
bool
()
const
{
return
m_ptr
!=
nullptr
;
}
inline
explicit
operator
bool
()
const
{
return
m_ptr
!=
nullptr
;
}
inline
ptrdiff_t
compare
(
const
T
*
ptr
)
const
inline
ptrdiff_t
compare
(
T
const
*
ptr
)
const
{
{
return
static_cast
<
ptrdiff_t
>
(
get
()
-
ptr
);
return
static_cast
<
ptrdiff_t
>
(
get
()
-
ptr
);
}
}
inline
ptrdiff_t
compare
(
const
intrusive_ptr
&
other
)
const
inline
ptrdiff_t
compare
(
intrusive_ptr
const
&
other
)
const
{
{
return
compare
(
other
.
get
());
return
compare
(
other
.
get
());
}
}
...
@@ -173,13 +173,13 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
...
@@ -173,13 +173,13 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
};
};
template
<
typename
X
,
typename
Y
>
template
<
typename
X
,
typename
Y
>
bool
operator
==
(
const
intrusive_ptr
<
X
>&
lhs
,
const
intrusive_ptr
<
Y
>
&
rhs
)
bool
operator
==
(
intrusive_ptr
<
X
>
const
&
lhs
,
intrusive_ptr
<
Y
>
const
&
rhs
)
{
{
return
lhs
.
get
()
==
rhs
.
get
();
return
lhs
.
get
()
==
rhs
.
get
();
}
}
template
<
typename
X
,
typename
Y
>
template
<
typename
X
,
typename
Y
>
inline
bool
operator
!=
(
const
intrusive_ptr
<
X
>&
lhs
,
const
intrusive_ptr
<
Y
>
&
rhs
)
inline
bool
operator
!=
(
intrusive_ptr
<
X
>
const
&
lhs
,
intrusive_ptr
<
Y
>
const
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
...
...
cppa/invoke.hpp
View file @
42db08af
...
@@ -25,7 +25,7 @@ struct invoke_helper
...
@@ -25,7 +25,7 @@ struct invoke_helper
typedef
typename
rlist
::
head_type
back_type
;
typedef
typename
rlist
::
head_type
back_type
;
typedef
typename
util
::
element_at
<
N
,
Tuple
>::
type
tuple_val_type
;
typedef
typename
util
::
element_at
<
N
,
Tuple
>::
type
tuple_val_type
;
typedef
typename
util
::
pop_back
<
ArgTypeList
>::
type
next_list
;
typedef
typename
util
::
pop_back
<
ArgTypeList
>::
type
next_list
;
inline
static
ResultType
_
(
F
&
f
,
const
Tuple
&
t
,
const
Args
&
...
args
)
inline
static
ResultType
_
(
F
&
f
,
Tuple
const
&
t
,
Args
const
&
...
args
)
{
{
static_assert
(
std
::
is_convertible
<
tuple_val_type
,
back_type
>::
value
,
static_assert
(
std
::
is_convertible
<
tuple_val_type
,
back_type
>::
value
,
"tuple element is not convertible to expected argument"
);
"tuple element is not convertible to expected argument"
);
...
@@ -37,7 +37,7 @@ struct invoke_helper
...
@@ -37,7 +37,7 @@ struct invoke_helper
template
<
size_t
N
,
typename
F
,
typename
ResultType
,
class
Tuple
,
typename
...
Args
>
template
<
size_t
N
,
typename
F
,
typename
ResultType
,
class
Tuple
,
typename
...
Args
>
struct
invoke_helper
<
N
,
F
,
ResultType
,
Tuple
,
util
::
type_list
<>
,
Args
...
>
struct
invoke_helper
<
N
,
F
,
ResultType
,
Tuple
,
util
::
type_list
<>
,
Args
...
>
{
{
inline
static
ResultType
_
(
F
&
f
,
const
Tuple
&
,
const
Args
&
...
args
)
inline
static
ResultType
_
(
F
&
f
,
Tuple
const
&
,
Args
const
&
...
args
)
{
{
return
f
(
args
...);
return
f
(
args
...);
}
}
...
@@ -59,7 +59,7 @@ struct invoke_impl<true, F, Tuple<TTypes...> >
...
@@ -59,7 +59,7 @@ struct invoke_impl<true, F, Tuple<TTypes...> >
typedef
Tuple
<
TTypes
...
>
tuple_type
;
typedef
Tuple
<
TTypes
...
>
tuple_type
;
inline
static
result_type
_
(
F
&
f
,
const
tuple_type
&
t
)
inline
static
result_type
_
(
F
&
f
,
tuple_type
const
&
t
)
{
{
return
invoke_helper
<
sizeof
...(
TTypes
)
-
1
,
F
,
result_type
,
tuple_type
,
arg_types
>::
_
(
f
,
t
);
return
invoke_helper
<
sizeof
...(
TTypes
)
-
1
,
F
,
result_type
,
tuple_type
,
arg_types
>::
_
(
f
,
t
);
}
}
...
@@ -79,7 +79,7 @@ struct invoke_impl<false, F, Tuple<TTypes...> >
...
@@ -79,7 +79,7 @@ struct invoke_impl<false, F, Tuple<TTypes...> >
typedef
Tuple
<
TTypes
...
>
tuple_type
;
typedef
Tuple
<
TTypes
...
>
tuple_type
;
inline
static
result_type
_
(
F
&
f
,
const
tuple_type
&
t
)
inline
static
result_type
_
(
F
&
f
,
tuple_type
const
&
t
)
{
{
return
invoke_helper
<
sizeof
...(
TTypes
)
-
1
,
F
,
result_type
,
tuple_type
,
arg_types
>::
_
(
f
,
t
);
return
invoke_helper
<
sizeof
...(
TTypes
)
-
1
,
F
,
result_type
,
tuple_type
,
arg_types
>::
_
(
f
,
t
);
}
}
...
@@ -92,7 +92,7 @@ namespace cppa {
...
@@ -92,7 +92,7 @@ namespace cppa {
template
<
typename
F
,
class
Tuple
>
template
<
typename
F
,
class
Tuple
>
typename
detail
::
invoke_impl
<
std
::
is_function
<
typename
std
::
remove_pointer
<
F
>::
type
>::
value
,
F
,
Tuple
>::
result_type
typename
detail
::
invoke_impl
<
std
::
is_function
<
typename
std
::
remove_pointer
<
F
>::
type
>::
value
,
F
,
Tuple
>::
result_type
invoke
(
F
what
,
const
Tuple
&
args
)
invoke
(
F
what
,
Tuple
const
&
args
)
{
{
typedef
typename
std
::
remove_pointer
<
F
>::
type
f_type
;
typedef
typename
std
::
remove_pointer
<
F
>::
type
f_type
;
static
constexpr
bool
is_fun
=
std
::
is_function
<
f_type
>::
value
;
static
constexpr
bool
is_fun
=
std
::
is_function
<
f_type
>::
value
;
...
...
cppa/invoke_rules.hpp
View file @
42db08af
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, 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 INVOKE_RULES_HPP
#ifndef INVOKE_RULES_HPP
#define INVOKE_RULES_HPP
#define INVOKE_RULES_HPP
...
@@ -89,7 +61,7 @@ class invoke_rules_base
...
@@ -89,7 +61,7 @@ class invoke_rules_base
* @returns @p true if a pattern matched @p data;
* @returns @p true if a pattern matched @p data;
* otherwise @p false.
* otherwise @p false.
*/
*/
bool
operator
()(
const
any_tuple
&
data
)
const
;
bool
operator
()(
any_tuple
const
&
data
)
const
;
/**
/**
* @brief Tries to match @p data with one of the stored patterns.
* @brief Tries to match @p data with one of the stored patterns.
...
@@ -97,7 +69,7 @@ class invoke_rules_base
...
@@ -97,7 +69,7 @@ class invoke_rules_base
* @returns An {@link intermediate} instance that could invoke
* @returns An {@link intermediate} instance that could invoke
* the corresponding callback; otherwise @p nullptr.
* the corresponding callback; otherwise @p nullptr.
*/
*/
detail
::
intermediate
*
get_intermediate
(
const
any_tuple
&
data
)
const
;
detail
::
intermediate
*
get_intermediate
(
any_tuple
const
&
data
)
const
;
};
};
...
@@ -111,8 +83,8 @@ class timed_invoke_rules : public invoke_rules_base
...
@@ -111,8 +83,8 @@ class timed_invoke_rules : public invoke_rules_base
friend
class
invoke_rules
;
friend
class
invoke_rules
;
timed_invoke_rules
(
const
timed_invoke_rules
&
)
=
delete
;
timed_invoke_rules
(
timed_invoke_rules
const
&
)
=
delete
;
timed_invoke_rules
&
operator
=
(
const
timed_invoke_rules
&
)
=
delete
;
timed_invoke_rules
&
operator
=
(
timed_invoke_rules
const
&
)
=
delete
;
timed_invoke_rules
(
invokable_list
&&
prepended_list
,
timed_invoke_rules
(
invokable_list
&&
prepended_list
,
timed_invoke_rules
&&
other
);
timed_invoke_rules
&&
other
);
...
@@ -127,7 +99,7 @@ public:
...
@@ -127,7 +99,7 @@ public:
timed_invoke_rules
&
operator
=
(
timed_invoke_rules
&&
);
timed_invoke_rules
&
operator
=
(
timed_invoke_rules
&&
);
const
util
::
duration
&
timeout
()
const
;
util
::
duration
const
&
timeout
()
const
;
void
handle_timeout
()
const
;
void
handle_timeout
()
const
;
...
@@ -147,8 +119,8 @@ class invoke_rules : public invoke_rules_base
...
@@ -147,8 +119,8 @@ class invoke_rules : public invoke_rules_base
friend
class
timed_invoke_rules
;
friend
class
timed_invoke_rules
;
invoke_rules
(
const
invoke_rules
&
)
=
delete
;
invoke_rules
(
invoke_rules
const
&
)
=
delete
;
invoke_rules
&
operator
=
(
const
invoke_rules
&
)
=
delete
;
invoke_rules
&
operator
=
(
invoke_rules
const
&
)
=
delete
;
public:
public:
...
...
cppa/object.hpp
View file @
42db08af
...
@@ -15,11 +15,11 @@ namespace cppa {
...
@@ -15,11 +15,11 @@ namespace cppa {
// forward declarations
// forward declarations
class
object
;
class
object
;
bool
operator
==
(
const
object
&
lhs
,
const
objec
t
&
rhs
);
bool
operator
==
(
object
const
&
lhs
,
object
cons
t
&
rhs
);
class
uniform_type_info
;
class
uniform_type_info
;
const
uniform_type_info
*
uniform_typeid
(
const
std
::
type_info
&
);
uniform_type_info
const
*
uniform_typeid
(
std
::
type_info
const
&
);
bool
operator
==
(
const
uniform_type_info
&
lhs
,
const
std
::
type_info
&
rhs
);
bool
operator
==
(
uniform_type_info
const
&
lhs
,
std
::
type_info
const
&
rhs
);
/**
/**
* @brief Grants mutable access to the stored value of @p obj.
* @brief Grants mutable access to the stored value of @p obj.
...
@@ -39,7 +39,7 @@ T& get_ref(object& obj);
...
@@ -39,7 +39,7 @@ T& get_ref(object& obj);
* @throws std::invalid_argument if <tt>obj.type() != typeid(T)</tt>
* @throws std::invalid_argument if <tt>obj.type() != typeid(T)</tt>
*/
*/
template
<
typename
T
>
template
<
typename
T
>
const
T
&
get
(
const
objec
t
&
obj
);
T
const
&
get
(
object
cons
t
&
obj
);
/**
/**
* @brief An abstraction class that stores an instance of
* @brief An abstraction class that stores an instance of
...
@@ -48,7 +48,7 @@ const T& get(const object& obj);
...
@@ -48,7 +48,7 @@ const T& get(const object& obj);
class
object
class
object
{
{
friend
bool
operator
==
(
const
object
&
lhs
,
const
objec
t
&
rhs
);
friend
bool
operator
==
(
object
const
&
lhs
,
object
cons
t
&
rhs
);
public:
public:
...
@@ -59,7 +59,7 @@ class object
...
@@ -59,7 +59,7 @@ class object
* @warning {@link object} takes ownership of @p val.
* @warning {@link object} takes ownership of @p val.
* @pre {@code val != nullptr && utinfo != nullptr}
* @pre {@code val != nullptr && utinfo != nullptr}
*/
*/
object
(
void
*
val
,
const
uniform_type_info
*
utinfo
);
object
(
void
*
val
,
uniform_type_info
const
*
utinfo
);
/**
/**
* @brief Creates an empty object.
* @brief Creates an empty object.
...
@@ -77,7 +77,7 @@ class object
...
@@ -77,7 +77,7 @@ class object
* @brief Creates a (deep) copy of @p other.
* @brief Creates a (deep) copy of @p other.
* @post {*this == other}
* @post {*this == other}
*/
*/
object
(
const
objec
t
&
other
);
object
(
object
cons
t
&
other
);
/**
/**
* @brief Moves the content from @p other to this.
* @brief Moves the content from @p other to this.
...
@@ -89,21 +89,21 @@ class object
...
@@ -89,21 +89,21 @@ class object
* @brief Creates a (deep) copy of @p other and assigns it to @p this.
* @brief Creates a (deep) copy of @p other and assigns it to @p this.
* @return @p *this
* @return @p *this
*/
*/
object
&
operator
=
(
const
objec
t
&
other
);
object
&
operator
=
(
object
cons
t
&
other
);
/**
/**
* @brief Gets the RTTI of this object.
* @brief Gets the RTTI of this object.
* @returns A {@link uniform_type_info} describing the current
* @returns A {@link uniform_type_info} describing the current
* type of @p this.
* type of @p this.
*/
*/
const
uniform_type_info
&
type
()
const
;
uniform_type_info
const
&
type
()
const
;
/**
/**
* @brief Gets the stored value.
* @brief Gets the stored value.
* @returns A const pointer to the currently stored value.
* @returns A const pointer to the currently stored value.
* @see get(
const objec
t&)
* @see get(
object cons
t&)
*/
*/
const
void
*
value
()
const
;
void
const
*
value
()
const
;
/**
/**
* @brief Gets the stored value.
* @brief Gets the stored value.
...
@@ -125,7 +125,7 @@ class object
...
@@ -125,7 +125,7 @@ class object
private:
private:
void
*
m_value
;
void
*
m_value
;
const
uniform_type_info
*
m_type
;
uniform_type_info
const
*
m_type
;
void
swap
(
object
&
other
);
void
swap
(
object
&
other
);
...
@@ -140,7 +140,7 @@ object object::from(T&& what)
...
@@ -140,7 +140,7 @@ object object::from(T&& what)
return
{
new
value_type
(
std
::
forward
<
T
>
(
what
)),
rtti
};
return
{
new
value_type
(
std
::
forward
<
T
>
(
what
)),
rtti
};
}
}
inline
bool
operator
!=
(
const
object
&
lhs
,
const
objec
t
&
rhs
)
inline
bool
operator
!=
(
object
const
&
lhs
,
object
cons
t
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
...
@@ -159,7 +159,7 @@ T& get_ref(object& obj)
...
@@ -159,7 +159,7 @@ T& get_ref(object& obj)
}
}
template
<
typename
T
>
template
<
typename
T
>
const
T
&
get
(
const
objec
t
&
obj
)
T
const
&
get
(
object
cons
t
&
obj
)
{
{
static_assert
(
util
::
disjunction
<
std
::
is_pointer
<
T
>
,
static_assert
(
util
::
disjunction
<
std
::
is_pointer
<
T
>
,
std
::
is_reference
<
T
>>::
value
==
false
,
std
::
is_reference
<
T
>>::
value
==
false
,
...
@@ -168,7 +168,7 @@ const T& get(const object& obj)
...
@@ -168,7 +168,7 @@ const T& get(const object& obj)
{
{
throw
std
::
invalid_argument
(
"obj.type() != typeid(T)"
);
throw
std
::
invalid_argument
(
"obj.type() != typeid(T)"
);
}
}
return
*
reinterpret_cast
<
const
T
*>
(
obj
.
value
());
return
*
reinterpret_cast
<
T
const
*>
(
obj
.
value
());
}
}
}
// namespace cppa
}
// namespace cppa
...
...
cppa/on.hpp
View file @
42db08af
...
@@ -33,7 +33,7 @@ class timed_invoke_rule_builder
...
@@ -33,7 +33,7 @@ class timed_invoke_rule_builder
public:
public:
constexpr
timed_invoke_rule_builder
(
const
util
::
duration
&
d
)
:
m_timeout
(
d
)
constexpr
timed_invoke_rule_builder
(
util
::
duration
const
&
d
)
:
m_timeout
(
d
)
{
{
}
}
...
@@ -67,7 +67,7 @@ class invoke_rule_builder
...
@@ -67,7 +67,7 @@ class invoke_rule_builder
public:
public:
template
<
typename
...
Args
>
template
<
typename
...
Args
>
invoke_rule_builder
(
const
Args
&
...
args
)
invoke_rule_builder
(
Args
const
&
...
args
)
{
{
m_pattern
.
reset
(
new
pattern_type
(
args
...));
m_pattern
.
reset
(
new
pattern_type
(
args
...));
}
}
...
@@ -86,16 +86,19 @@ class on_the_fly_invoke_rule_builder
...
@@ -86,16 +86,19 @@ class on_the_fly_invoke_rule_builder
public:
public:
constexpr
on_the_fly_invoke_rule_builder
()
{
}
template
<
typename
F
>
template
<
typename
F
>
invoke_rules
operator
>>
(
F
&&
f
)
invoke_rules
operator
>>
(
F
&&
f
)
const
{
{
typedef
typename
util
::
get_callable_trait
<
F
>::
type
ctrait
;
using
namespace
::
cppa
::
util
;
typedef
typename
get_callable_trait
<
F
>::
type
ctrait
;
typedef
typename
ctrait
::
arg_types
raw_types
;
typedef
typename
ctrait
::
arg_types
raw_types
;
static_assert
(
raw_types
::
size
>
0
,
"functor has no arguments"
);
static_assert
(
raw_types
::
size
>
0
,
"functor has no arguments"
);
typedef
typename
util
::
type_list_apply
<
raw_types
,
util
::
rm_ref
>::
type
typedef
typename
type_list_apply
<
raw_types
,
rm_ref
>::
type
types
;
types
;
typedef
typename
pattern_type_from_type_list
<
types
>::
type
pattern_type
;
typedef
typename
pattern_type_from_type_list
<
types
>::
type
pattern_type
;
typedef
typename
pattern_type
::
tuple_view_type
tuple_view_type
;
typedef
typename
pattern_type
::
tuple_view_type
tuple_view_type
;
typedef
invokable_impl
<
tuple_view_type
,
pattern_type
,
F
>
impl
;
typedef
invokable_impl
<
tuple_view_type
,
pattern_type
,
F
>
impl
;
std
::
unique_ptr
<
pattern_type
>
pptr
(
new
pattern_type
);
std
::
unique_ptr
<
pattern_type
>
pptr
(
new
pattern_type
);
...
@@ -114,18 +117,14 @@ constexpr typename detail::boxed<T>::type val()
...
@@ -114,18 +117,14 @@ constexpr typename detail::boxed<T>::type val()
return
typename
detail
::
boxed
<
T
>::
type
();
return
typename
detail
::
boxed
<
T
>::
type
();
}
}
//constexpr detail::boxed<anything> any_vals = detail::boxed<anything>();
constexpr
anything
any_vals
=
anything
();
constexpr
anything
any_vals
=
anything
();
constexpr
detail
::
on_the_fly_invoke_rule_builder
on_arg_match
()
constexpr
detail
::
on_the_fly_invoke_rule_builder
on_arg_match
;
{
return
{
};
}
template
<
typename
Arg0
,
typename
...
Args
>
template
<
typename
Arg0
,
typename
...
Args
>
detail
::
invoke_rule_builder
<
typename
detail
::
unboxed
<
Arg0
>::
type
,
detail
::
invoke_rule_builder
<
typename
detail
::
unboxed
<
Arg0
>::
type
,
typename
detail
::
unboxed
<
Args
>::
type
...
>
typename
detail
::
unboxed
<
Args
>::
type
...
>
on
(
const
Arg0
&
arg0
,
const
Args
&
...
args
)
on
(
Arg0
const
&
arg0
,
Args
const
&
...
args
)
{
{
return
{
arg0
,
args
...
};
return
{
arg0
,
args
...
};
}
}
...
...
cppa/pattern.hpp
View file @
42db08af
...
@@ -24,8 +24,8 @@ template<typename T0, typename... Tn>
...
@@ -24,8 +24,8 @@ template<typename T0, typename... Tn>
class
pattern
<
T0
,
Tn
...
>
class
pattern
<
T0
,
Tn
...
>
{
{
pattern
(
const
pattern
&
)
=
delete
;
pattern
(
pattern
const
&
)
=
delete
;
pattern
&
operator
=
(
const
pattern
&
)
=
delete
;
pattern
&
operator
=
(
pattern
const
&
)
=
delete
;
public:
public:
...
@@ -41,12 +41,9 @@ class pattern<T0, Tn...>
...
@@ -41,12 +41,9 @@ class pattern<T0, Tn...>
typedef
typename
tuple_view_type
::
mapping_vector
mapping_vector
;
typedef
typename
tuple_view_type
::
mapping_vector
mapping_vector
;
//typedef typename detail::tdata_from_type_list<filtered_tpl_args>::type
// data_type;
pattern
()
pattern
()
{
{
c
onst
cppa
::
uniform_type_info
*
*
iter
=
m_utis
;
c
ppa
::
uniform_type_info
const
*
*
iter
=
m_utis
;
detail
::
fill_uti_vec
<
decltype
(
iter
),
T0
,
Tn
...
>
(
iter
);
detail
::
fill_uti_vec
<
decltype
(
iter
),
T0
,
Tn
...
>
(
iter
);
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
{
{
...
@@ -55,7 +52,7 @@ class pattern<T0, Tn...>
...
@@ -55,7 +52,7 @@ class pattern<T0, Tn...>
}
}
template
<
typename
Arg0
,
typename
...
Args
>
template
<
typename
Arg0
,
typename
...
Args
>
pattern
(
const
Arg0
&
arg0
,
const
Args
&
...
args
)
:
m_data
(
arg0
,
args
...)
pattern
(
Arg0
const
&
arg0
,
Args
const
&
...
args
)
:
m_data
(
arg0
,
args
...)
{
{
bool
invalid_args
[]
=
{
detail
::
is_boxed
<
Arg0
>::
value
,
bool
invalid_args
[]
=
{
detail
::
is_boxed
<
Arg0
>::
value
,
detail
::
is_boxed
<
Args
>::
value
...
};
detail
::
is_boxed
<
Args
>::
value
...
};
...
@@ -66,8 +63,7 @@ class pattern<T0, Tn...>
...
@@ -66,8 +63,7 @@ class pattern<T0, Tn...>
m_utis
,
m_data_ptr
);
m_utis
,
m_data_ptr
);
}
}
// todo: calculate expected vector type
bool
operator
()(
cppa
::
any_tuple
const
&
msg
,
bool
operator
()(
const
cppa
::
any_tuple
&
msg
,
mapping_vector
*
mapping
=
nullptr
)
const
mapping_vector
*
mapping
=
nullptr
)
const
{
{
detail
::
pattern_arg
arg0
(
size
,
m_data_ptr
,
m_utis
);
detail
::
pattern_arg
arg0
(
size
,
m_data_ptr
,
m_utis
);
...
@@ -77,10 +73,9 @@ class pattern<T0, Tn...>
...
@@ -77,10 +73,9 @@ class pattern<T0, Tn...>
private:
private:
//typename detail::tdata_from_type_list<filtered_tpl_args>::type m_data;
detail
::
tdata
<
T0
,
Tn
...
>
m_data
;
detail
::
tdata
<
T0
,
Tn
...
>
m_data
;
c
onst
cppa
::
uniform_type_info
*
m_utis
[
size
];
c
ppa
::
uniform_type_info
const
*
m_utis
[
size
];
const
void
*
m_data_ptr
[
size
];
void
const
*
m_data_ptr
[
size
];
};
};
...
...
cppa/primitive_type.hpp
View file @
42db08af
...
@@ -30,7 +30,7 @@ enum primitive_type
...
@@ -30,7 +30,7 @@ enum primitive_type
pt_null
/**< equivalent of @p void */
pt_null
/**< equivalent of @p void */
};
};
constexpr
c
onst
char
*
primitive_type_names
[]
=
constexpr
c
har
const
*
primitive_type_names
[]
=
{
{
"pt_int8"
,
"pt_int16"
,
"pt_int32"
,
"pt_int64"
,
"pt_int8"
,
"pt_int16"
,
"pt_int32"
,
"pt_int64"
,
"pt_uint8"
,
"pt_uint16"
,
"pt_uint32"
,
"pt_uint64"
,
"pt_uint8"
,
"pt_uint16"
,
"pt_uint32"
,
"pt_uint64"
,
...
@@ -45,7 +45,7 @@ constexpr const char* primitive_type_names[] =
...
@@ -45,7 +45,7 @@ constexpr const char* primitive_type_names[] =
* @param ptype Requestet @p primitive_type.
* @param ptype Requestet @p primitive_type.
* @returns A C-string representation of @p ptype.
* @returns A C-string representation of @p ptype.
*/
*/
constexpr
c
onst
char
*
primitive_type_name
(
primitive_type
ptype
)
constexpr
c
har
const
*
primitive_type_name
(
primitive_type
ptype
)
{
{
return
primitive_type_names
[
static_cast
<
int
>
(
ptype
)];
return
primitive_type_names
[
static_cast
<
int
>
(
ptype
)];
}
}
...
...
cppa/primitive_variant.hpp
View file @
42db08af
...
@@ -34,7 +34,7 @@ namespace cppa {
...
@@ -34,7 +34,7 @@ namespace cppa {
class
primitive_variant
;
class
primitive_variant
;
template
<
typename
T
>
template
<
typename
T
>
const
T
&
get
(
const
primitive_varian
t
&
pv
);
T
const
&
get
(
primitive_variant
cons
t
&
pv
);
template
<
typename
T
>
template
<
typename
T
>
T
&
get_ref
(
primitive_variant
&
pv
);
T
&
get_ref
(
primitive_variant
&
pv
);
...
@@ -46,11 +46,11 @@ T& get_ref(primitive_variant& pv);
...
@@ -46,11 +46,11 @@ T& get_ref(primitive_variant& pv);
class
primitive_variant
class
primitive_variant
{
{
friend
bool
operator
==
(
const
primitive_varian
t
&
lhs
,
friend
bool
operator
==
(
primitive_variant
cons
t
&
lhs
,
const
primitive_varian
t
&
rhs
);
primitive_variant
cons
t
&
rhs
);
template
<
typename
T
>
template
<
typename
T
>
friend
const
T
&
get
(
const
primitive_varian
t
&
pv
);
friend
T
const
&
get
(
primitive_variant
cons
t
&
pv
);
template
<
typename
T
>
template
<
typename
T
>
friend
T
&
get_ref
(
primitive_variant
&
pv
);
friend
T
&
get_ref
(
primitive_variant
&
pv
);
...
@@ -185,7 +185,7 @@ class primitive_variant
...
@@ -185,7 +185,7 @@ class primitive_variant
* @brief Creates a copy from @p other.
* @brief Creates a copy from @p other.
* @param other A primitive variant.
* @param other A primitive variant.
*/
*/
primitive_variant
(
const
primitive_varian
t
&
other
);
primitive_variant
(
primitive_variant
cons
t
&
other
);
/**
/**
* @brief Creates a new variant and move the value from @p other to it.
* @brief Creates a new variant and move the value from @p other to it.
...
@@ -223,7 +223,7 @@ class primitive_variant
...
@@ -223,7 +223,7 @@ class primitive_variant
* @param other A primitive variant.
* @param other A primitive variant.
* @returns <tt>*this</tt>.
* @returns <tt>*this</tt>.
*/
*/
primitive_variant
&
operator
=
(
const
primitive_varian
t
&
other
);
primitive_variant
&
operator
=
(
primitive_variant
cons
t
&
other
);
/**
/**
* @brief Moves the content of @p other to @p this.
* @brief Moves the content of @p other to @p this.
...
@@ -244,7 +244,7 @@ class primitive_variant
...
@@ -244,7 +244,7 @@ class primitive_variant
* otherwise typeid(T) is returned, where T is the C++ type
* otherwise typeid(T) is returned, where T is the C++ type
* of @p this.
* of @p this.
*/
*/
const
std
::
type_info
&
type
()
const
;
std
::
type_info
const
&
type
()
const
;
~
primitive_variant
();
~
primitive_variant
();
...
@@ -259,7 +259,7 @@ class primitive_variant
...
@@ -259,7 +259,7 @@ class primitive_variant
* @throws <tt>std::logic_error</tt> if @p pv is not of type @p T.
* @throws <tt>std::logic_error</tt> if @p pv is not of type @p T.
*/
*/
template
<
typename
T
>
template
<
typename
T
>
const
T
&
get
(
const
primitive_varian
t
&
pv
)
T
const
&
get
(
primitive_variant
cons
t
&
pv
)
{
{
static
const
primitive_type
ptype
=
detail
::
type_to_ptype
<
T
>::
ptype
;
static
const
primitive_type
ptype
=
detail
::
type_to_ptype
<
T
>::
ptype
;
return
pv
.
get_as
<
ptype
>
();
return
pv
.
get_as
<
ptype
>
();
...
@@ -291,7 +291,7 @@ T& get_ref(primitive_variant& pv)
...
@@ -291,7 +291,7 @@ T& get_ref(primitive_variant& pv)
* @returns A const reference to the value of @p pv of type @p T.
* @returns A const reference to the value of @p pv of type @p T.
*/
*/
template
<
primitive_type
PT
>
template
<
primitive_type
PT
>
const
T
&
get_ref
(
const
primitive_varian
t
&
pv
);
T
const
&
get_ref
(
primitive_variant
cons
t
&
pv
);
/**
/**
* @ingroup TypeSystem
* @ingroup TypeSystem
...
@@ -308,7 +308,7 @@ T& get_ref(primitive_variant& pv);
...
@@ -308,7 +308,7 @@ T& get_ref(primitive_variant& pv);
template
<
primitive_type
PT
>
template
<
primitive_type
PT
>
inline
const
typename
detail
::
ptype_to_type
<
PT
>::
type
&
inline
const
typename
detail
::
ptype_to_type
<
PT
>::
type
&
get
(
const
primitive_varian
t
&
pv
)
get
(
primitive_variant
cons
t
&
pv
)
{
{
static_assert
(
PT
!=
pt_null
,
"PT == pt_null"
);
static_assert
(
PT
!=
pt_null
,
"PT == pt_null"
);
return
get
<
typename
detail
::
ptype_to_type
<
PT
>::
type
>
(
pv
);
return
get
<
typename
detail
::
ptype_to_type
<
PT
>::
type
>
(
pv
);
...
@@ -324,17 +324,17 @@ get_ref(primitive_variant& pv)
...
@@ -324,17 +324,17 @@ get_ref(primitive_variant& pv)
#endif
#endif
bool
operator
==
(
const
primitive_variant
&
lhs
,
const
primitive_varian
t
&
rhs
);
bool
operator
==
(
primitive_variant
const
&
lhs
,
primitive_variant
cons
t
&
rhs
);
inline
inline
bool
operator
!=
(
const
primitive_variant
&
lhs
,
const
primitive_varian
t
&
rhs
)
bool
operator
!=
(
primitive_variant
const
&
lhs
,
primitive_variant
cons
t
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
template
<
typename
T
>
template
<
typename
T
>
typename
util
::
enable_if
<
util
::
is_primitive
<
T
>
,
bool
>::
type
typename
util
::
enable_if
<
util
::
is_primitive
<
T
>
,
bool
>::
type
operator
==
(
const
T
&
lhs
,
const
primitive_varian
t
&
rhs
)
operator
==
(
T
const
&
lhs
,
primitive_variant
cons
t
&
rhs
)
{
{
static
constexpr
primitive_type
ptype
=
detail
::
type_to_ptype
<
T
>::
ptype
;
static
constexpr
primitive_type
ptype
=
detail
::
type_to_ptype
<
T
>::
ptype
;
static_assert
(
ptype
!=
pt_null
,
"T is an incompatible type"
);
static_assert
(
ptype
!=
pt_null
,
"T is an incompatible type"
);
...
@@ -343,21 +343,21 @@ operator==(const T& lhs, const primitive_variant& rhs)
...
@@ -343,21 +343,21 @@ operator==(const T& lhs, const primitive_variant& rhs)
template
<
typename
T
>
template
<
typename
T
>
typename
util
::
enable_if
<
util
::
is_primitive
<
T
>
,
bool
>::
type
typename
util
::
enable_if
<
util
::
is_primitive
<
T
>
,
bool
>::
type
operator
==
(
const
primitive_variant
&
lhs
,
const
T
&
rhs
)
operator
==
(
primitive_variant
const
&
lhs
,
T
const
&
rhs
)
{
{
return
(
rhs
==
lhs
);
return
(
rhs
==
lhs
);
}
}
template
<
typename
T
>
template
<
typename
T
>
typename
util
::
enable_if
<
util
::
is_primitive
<
T
>
,
bool
>::
type
typename
util
::
enable_if
<
util
::
is_primitive
<
T
>
,
bool
>::
type
operator
!=
(
const
primitive_variant
&
lhs
,
const
T
&
rhs
)
operator
!=
(
primitive_variant
const
&
lhs
,
T
const
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
template
<
typename
T
>
template
<
typename
T
>
typename
util
::
enable_if
<
util
::
is_primitive
<
T
>
,
bool
>::
type
typename
util
::
enable_if
<
util
::
is_primitive
<
T
>
,
bool
>::
type
operator
!=
(
const
T
&
lhs
,
const
primitive_varian
t
&
rhs
)
operator
!=
(
T
const
&
lhs
,
primitive_variant
cons
t
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
...
...
cppa/process_information.hpp
View file @
42db08af
...
@@ -28,11 +28,11 @@ class process_information : public ref_counted,
...
@@ -28,11 +28,11 @@ class process_information : public ref_counted,
//process_information();
//process_information();
process_information
(
std
::
uint32_t
process_id
,
const
node_id_type
&
node_id
);
process_information
(
std
::
uint32_t
process_id
,
node_id_type
const
&
node_id
);
process_information
(
std
::
uint32_t
process_id
,
const
std
::
string
&
hash
);
process_information
(
std
::
uint32_t
process_id
,
std
::
string
const
&
hash
);
process_information
(
const
process_information
&
other
);
process_information
(
process_information
const
&
other
);
/**
/**
* @brief Identifies the running process.
* @brief Identifies the running process.
...
@@ -45,16 +45,16 @@ class process_information : public ref_counted,
...
@@ -45,16 +45,16 @@ class process_information : public ref_counted,
* A hash build from the MAC address of the first network device
* A hash build from the MAC address of the first network device
* and the serial number from the root HD (mounted in "/" or "C:").
* and the serial number from the root HD (mounted in "/" or "C:").
*/
*/
inline
const
node_id_type
&
node_id
()
const
{
return
m_node_id
;
}
inline
node_id_type
const
&
node_id
()
const
{
return
m_node_id
;
}
/**
/**
* @brief Returns the proccess_information for the running process.
* @brief Returns the proccess_information for the running process.
* @returns
* @returns
*/
*/
static
const
intrusive_ptr
<
process_information
>
&
get
();
static
intrusive_ptr
<
process_information
>
const
&
get
();
// "inherited" from comparable<process_information>
// "inherited" from comparable<process_information>
int
compare
(
const
process_information
&
other
)
const
;
int
compare
(
process_information
const
&
other
)
const
;
private:
private:
...
@@ -63,24 +63,24 @@ class process_information : public ref_counted,
...
@@ -63,24 +63,24 @@ class process_information : public ref_counted,
};
};
void
node_id_from_string
(
const
std
::
string
&
hash
,
void
node_id_from_string
(
std
::
string
const
&
hash
,
process_information
::
node_id_type
&
node_id
);
process_information
::
node_id_type
&
node_id
);
bool
equal
(
const
std
::
string
&
hash
,
bool
equal
(
std
::
string
const
&
hash
,
const
process_information
::
node_id_type
&
node_id
);
process_information
::
node_id_type
const
&
node_id
);
inline
bool
equal
(
const
process_information
::
node_id_type
&
node_id
,
inline
bool
equal
(
process_information
::
node_id_type
const
&
node_id
,
const
std
::
string
&
hash
)
std
::
string
const
&
hash
)
{
{
return
equal
(
hash
,
node_id
);
return
equal
(
hash
,
node_id
);
}
}
std
::
string
to_string
(
const
process_information
&
what
);
std
::
string
to_string
(
process_information
const
&
what
);
/**
/**
* @brief Converts {@link node_id} to an hexadecimal string.
* @brief Converts {@link node_id} to an hexadecimal string.
*/
*/
std
::
string
to_string
(
const
process_information
::
node_id_type
&
node_id
);
std
::
string
to_string
(
process_information
::
node_id_type
const
&
node_id
);
/**
/**
* @brief A smart pointer type that manages instances of
* @brief A smart pointer type that manages instances of
...
...
cppa/scheduler.hpp
View file @
42db08af
...
@@ -78,8 +78,8 @@ class scheduler
...
@@ -78,8 +78,8 @@ class scheduler
virtual
attachable
*
register_hidden_context
();
virtual
attachable
*
register_hidden_context
();
template
<
typename
Duration
,
typename
...
Data
>
template
<
typename
Duration
,
typename
...
Data
>
void
future_send
(
const
actor_ptr
&
to
,
void
future_send
(
actor_ptr
const
&
to
,
const
Duration
&
rel_time
,
const
Data
&
...
data
)
Duration
const
&
rel_time
,
Data
const
&
...
data
)
{
{
static_assert
(
sizeof
...(
Data
)
>
0
,
"no message to send"
);
static_assert
(
sizeof
...(
Data
)
>
0
,
"no message to send"
);
any_tuple
tup
=
make_tuple
(
util
::
duration
(
rel_time
),
to
,
data
...);
any_tuple
tup
=
make_tuple
(
util
::
duration
(
rel_time
),
to
,
data
...);
...
...
cppa/self.hpp
View file @
42db08af
...
@@ -27,8 +27,8 @@ class self_type : public convertible<self_type, actor*>
...
@@ -27,8 +27,8 @@ class self_type : public convertible<self_type, actor*>
static
local_actor
*
get_impl
();
static
local_actor
*
get_impl
();
self_type
(
const
self_type
&
)
=
delete
;
self_type
(
self_type
const
&
)
=
delete
;
self_type
&
operator
=
(
const
self_type
&
)
=
delete
;
self_type
&
operator
=
(
self_type
const
&
)
=
delete
;
public:
public:
...
...
cppa/serializer.hpp
View file @
42db08af
...
@@ -19,8 +19,8 @@ class primitive_variant;
...
@@ -19,8 +19,8 @@ class primitive_variant;
class
serializer
class
serializer
{
{
serializer
(
const
serializer
&
)
=
delete
;
serializer
(
serializer
const
&
)
=
delete
;
serializer
&
operator
=
(
const
serializer
&
)
=
delete
;
serializer
&
operator
=
(
serializer
const
&
)
=
delete
;
public:
public:
...
@@ -33,7 +33,7 @@ class serializer
...
@@ -33,7 +33,7 @@ class serializer
* named @p type_name.
* named @p type_name.
* @param type_name The platform-independent @p libcppa type name.
* @param type_name The platform-independent @p libcppa type name.
*/
*/
virtual
void
begin_object
(
const
std
::
string
&
type_name
)
=
0
;
virtual
void
begin_object
(
std
::
string
const
&
type_name
)
=
0
;
/**
/**
* @brief Ends serialization of an object.
* @brief Ends serialization of an object.
...
@@ -54,19 +54,19 @@ class serializer
...
@@ -54,19 +54,19 @@ class serializer
* @brief Writes a single value to the data sink.
* @brief Writes a single value to the data sink.
* @param value A primitive data value.
* @param value A primitive data value.
*/
*/
virtual
void
write_value
(
const
primitive_varian
t
&
value
)
=
0
;
virtual
void
write_value
(
primitive_variant
cons
t
&
value
)
=
0
;
/**
/**
* @brief Writes @p num values as a tuple to the data sink.
* @brief Writes @p num values as a tuple to the data sink.
* @param num Size of the array @p values.
* @param num Size of the array @p values.
* @param values An array of size @p num of primitive data values.
* @param values An array of size @p num of primitive data values.
*/
*/
virtual
void
write_tuple
(
size_t
num
,
const
primitive_varian
t
*
values
)
=
0
;
virtual
void
write_tuple
(
size_t
num
,
primitive_variant
cons
t
*
values
)
=
0
;
};
};
template
<
typename
T
>
template
<
typename
T
>
serializer
&
operator
<<
(
serializer
&
s
,
const
T
&
what
)
serializer
&
operator
<<
(
serializer
&
s
,
T
const
&
what
)
{
{
auto
mtype
=
uniform_typeid
<
T
>
();
auto
mtype
=
uniform_typeid
<
T
>
();
if
(
mtype
==
nullptr
)
if
(
mtype
==
nullptr
)
...
...
cppa/to_string.hpp
View file @
42db08af
...
@@ -7,7 +7,7 @@ namespace cppa {
...
@@ -7,7 +7,7 @@ namespace cppa {
namespace
detail
{
namespace
detail
{
std
::
string
to_string_impl
(
const
void
*
what
,
const
uniform_type_info
*
utype
);
std
::
string
to_string_impl
(
void
const
*
what
,
uniform_type_info
const
*
utype
);
}
// namespace detail
}
// namespace detail
...
@@ -17,7 +17,7 @@ std::string to_string_impl(const void* what, const uniform_type_info* utype);
...
@@ -17,7 +17,7 @@ std::string to_string_impl(const void* what, const uniform_type_info* utype);
* @returns A string representation of @p what.
* @returns A string representation of @p what.
*/
*/
template
<
typename
T
>
template
<
typename
T
>
std
::
string
to_string
(
const
T
&
what
)
std
::
string
to_string
(
T
const
&
what
)
{
{
auto
utype
=
uniform_typeid
<
T
>
();
auto
utype
=
uniform_typeid
<
T
>
();
if
(
utype
==
nullptr
)
if
(
utype
==
nullptr
)
...
...
cppa/tuple.hpp
View file @
42db08af
...
@@ -69,7 +69,7 @@ class tuple
...
@@ -69,7 +69,7 @@ class tuple
* @brief Initializes the tuple with @p args.
* @brief Initializes the tuple with @p args.
* @param args Initialization values.
* @param args Initialization values.
*/
*/
tuple
(
const
ElementTypes
&
...
args
)
:
m_vals
(
new
vals_t
(
args
...))
tuple
(
ElementTypes
const
&
...
args
)
:
m_vals
(
new
vals_t
(
args
...))
{
{
}
}
...
@@ -87,7 +87,7 @@ class tuple
...
@@ -87,7 +87,7 @@ class tuple
* @brief Gets a pointer to the internal data.
* @brief Gets a pointer to the internal data.
* @returns A const void pointer to the <tt>N</tt>th element.
* @returns A const void pointer to the <tt>N</tt>th element.
*/
*/
inline
const
void
*
at
(
size_t
p
)
const
inline
void
const
*
at
(
size_t
p
)
const
{
{
return
m_vals
->
at
(
p
);
return
m_vals
->
at
(
p
);
}
}
...
@@ -97,7 +97,7 @@ class tuple
...
@@ -97,7 +97,7 @@ class tuple
* of an element.
* of an element.
* @returns The uniform type of the <tt>N</tt>th element.
* @returns The uniform type of the <tt>N</tt>th element.
*/
*/
inline
const
uniform_type_info
*
utype_at
(
size_t
p
)
const
inline
uniform_type_info
const
*
utype_at
(
size_t
p
)
const
{
{
return
m_vals
->
utype_info_at
(
p
);
return
m_vals
->
utype_info_at
(
p
);
}
}
...
@@ -109,7 +109,7 @@ class tuple
...
@@ -109,7 +109,7 @@ class tuple
*/
*/
cow_ptr
<
InternalData
>
vals
()
const
;
cow_ptr
<
InternalData
>
vals
()
const
;
# else
# else
inline
co
nst
cow_ptr
<
vals_t
>
&
vals
()
const
inline
co
w_ptr
<
vals_t
>
const
&
vals
()
const
{
{
return
m_vals
;
return
m_vals
;
}
}
...
@@ -137,7 +137,7 @@ struct tuple_type_from_type_list<util::type_list<Types...>>
...
@@ -137,7 +137,7 @@ struct tuple_type_from_type_list<util::type_list<Types...>>
* @relates tuple
* @relates tuple
*/
*/
template
<
size_t
N
,
typename
T
>
template
<
size_t
N
,
typename
T
>
const
T
&
get
(
const
tuple
<
...
>
&
tup
);
T
const
&
get
(
tuple
<
...
>
const
&
tup
);
/**
/**
* @ingroup CopyOnWrite
* @ingroup CopyOnWrite
...
@@ -159,12 +159,12 @@ T& get_ref(tuple<...>& tup);
...
@@ -159,12 +159,12 @@ T& get_ref(tuple<...>& tup);
* @relates tuple
* @relates tuple
*/
*/
template
<
typename
...
Types
>
template
<
typename
...
Types
>
tuple
<
Types
...
>
make_tuple
(
const
Types
&
...
args
);
tuple
<
Types
...
>
make_tuple
(
Types
const
&
...
args
);
#else
#else
template
<
size_t
N
,
typename
...
Types
>
template
<
size_t
N
,
typename
...
Types
>
const
typename
util
::
at
<
N
,
Types
...
>::
type
&
get
(
const
tuple
<
Types
...
>
&
tup
)
const
typename
util
::
at
<
N
,
Types
...
>::
type
&
get
(
tuple
<
Types
...
>
const
&
tup
)
{
{
return
get
<
N
>
(
tup
.
vals
()
->
data
());
return
get
<
N
>
(
tup
.
vals
()
->
data
());
}
}
...
@@ -179,7 +179,7 @@ template<typename... Types>
...
@@ -179,7 +179,7 @@ template<typename... Types>
typename
tuple_type_from_type_list
<
typename
tuple_type_from_type_list
<
typename
util
::
type_list_apply
<
util
::
type_list
<
Types
...
>
,
typename
util
::
type_list_apply
<
util
::
type_list
<
Types
...
>
,
detail
::
implicit_conversions
>::
type
>::
type
detail
::
implicit_conversions
>::
type
>::
type
make_tuple
(
const
Types
&
...
args
)
make_tuple
(
Types
const
&
...
args
)
{
{
return
{
args
...
};
return
{
args
...
};
}
}
...
@@ -194,8 +194,8 @@ make_tuple(const Types&... args)
...
@@ -194,8 +194,8 @@ make_tuple(const Types&... args)
* @relates tuple
* @relates tuple
*/
*/
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
inline
bool
operator
==
(
const
tuple
<
LhsTypes
...
>
&
lhs
,
inline
bool
operator
==
(
tuple
<
LhsTypes
...
>
const
&
lhs
,
const
tuple
<
RhsTypes
...
>
&
rhs
)
tuple
<
RhsTypes
...
>
const
&
rhs
)
{
{
return
util
::
compare_tuples
(
lhs
,
rhs
);
return
util
::
compare_tuples
(
lhs
,
rhs
);
}
}
...
@@ -208,8 +208,8 @@ inline bool operator==(const tuple<LhsTypes...>& lhs,
...
@@ -208,8 +208,8 @@ inline bool operator==(const tuple<LhsTypes...>& lhs,
* @relates tuple
* @relates tuple
*/
*/
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
inline
bool
operator
!=
(
const
tuple
<
LhsTypes
...
>
&
lhs
,
inline
bool
operator
!=
(
tuple
<
LhsTypes
...
>
const
&
lhs
,
const
tuple
<
RhsTypes
...
>
&
rhs
)
tuple
<
RhsTypes
...
>
const
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
...
...
cppa/tuple_view.hpp
View file @
42db08af
...
@@ -42,7 +42,7 @@ class tuple_view
...
@@ -42,7 +42,7 @@ class tuple_view
tuple_view
()
:
m_vals
(
tuple
<
ElementTypes
...
>
().
vals
())
{
}
tuple_view
()
:
m_vals
(
tuple
<
ElementTypes
...
>
().
vals
())
{
}
static
tuple_view
from
(
const
vals_
t
&
vals
)
static
tuple_view
from
(
vals_t
cons
t
&
vals
)
{
{
return
tuple_view
(
vals
);
return
tuple_view
(
vals
);
}
}
...
@@ -52,7 +52,7 @@ class tuple_view
...
@@ -52,7 +52,7 @@ class tuple_view
return
tuple_view
(
std
::
move
(
vals
));
return
tuple_view
(
std
::
move
(
vals
));
}
}
tuple_view
(
const
vals_
t
&
vals
,
mapping_vector
&
mapping
)
tuple_view
(
vals_t
cons
t
&
vals
,
mapping_vector
&
mapping
)
:
m_vals
(
new
detail
::
decorated_tuple
<
ElementTypes
...
>
(
vals
,
mapping
))
:
m_vals
(
new
detail
::
decorated_tuple
<
ElementTypes
...
>
(
vals
,
mapping
))
{
{
}
}
...
@@ -61,7 +61,7 @@ class tuple_view
...
@@ -61,7 +61,7 @@ class tuple_view
{
{
}
}
tuple_view
&
operator
=
(
const
tuple_view
&
other
)
tuple_view
&
operator
=
(
tuple_view
const
&
other
)
{
{
m_vals
=
other
.
m_vals
;
m_vals
=
other
.
m_vals
;
return
*
this
;
return
*
this
;
...
@@ -73,9 +73,9 @@ class tuple_view
...
@@ -73,9 +73,9 @@ class tuple_view
return
*
this
;
return
*
this
;
}
}
tuple_view
(
const
tuple_view
&
)
=
default
;
tuple_view
(
tuple_view
const
&
)
=
default
;
inline
const
vals_
t
&
vals
()
const
inline
vals_t
cons
t
&
vals
()
const
{
{
return
m_vals
;
return
m_vals
;
}
}
...
@@ -88,7 +88,7 @@ class tuple_view
...
@@ -88,7 +88,7 @@ class tuple_view
private:
private:
explicit
tuple_view
(
const
vals_
t
&
vals
)
:
m_vals
(
vals
)
explicit
tuple_view
(
vals_t
cons
t
&
vals
)
:
m_vals
(
vals
)
{
{
}
}
...
@@ -101,11 +101,11 @@ class tuple_view
...
@@ -101,11 +101,11 @@ class tuple_view
};
};
template
<
size_t
N
,
typename
...
Types
>
template
<
size_t
N
,
typename
...
Types
>
const
typename
util
::
at
<
N
,
Types
...
>::
type
&
get
(
const
tuple_view
<
Types
...
>
&
t
)
const
typename
util
::
at
<
N
,
Types
...
>::
type
&
get
(
tuple_view
<
Types
...
>
const
&
t
)
{
{
static_assert
(
N
<
sizeof
...(
Types
),
"N >= t.size()"
);
static_assert
(
N
<
sizeof
...(
Types
),
"N >= t.size()"
);
typedef
typename
util
::
at
<
N
,
Types
...
>::
type
result_t
;
typedef
typename
util
::
at
<
N
,
Types
...
>::
type
result_t
;
return
*
reinterpret_cast
<
const
result_
t
*>
(
t
.
vals
()
->
at
(
N
));
return
*
reinterpret_cast
<
result_t
cons
t
*>
(
t
.
vals
()
->
at
(
N
));
}
}
template
<
size_t
N
,
typename
...
Types
>
template
<
size_t
N
,
typename
...
Types
>
...
@@ -126,43 +126,43 @@ struct tuple_view_type_from_type_list<util::type_list<Types...>>
...
@@ -126,43 +126,43 @@ struct tuple_view_type_from_type_list<util::type_list<Types...>>
};
};
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
inline
bool
operator
==
(
const
tuple_view
<
LhsTypes
...
>
&
lhs
,
inline
bool
operator
==
(
tuple_view
<
LhsTypes
...
>
const
&
lhs
,
const
tuple_view
<
RhsTypes
...
>
&
rhs
)
tuple_view
<
RhsTypes
...
>
const
&
rhs
)
{
{
return
util
::
compare_tuples
(
lhs
,
rhs
);
return
util
::
compare_tuples
(
lhs
,
rhs
);
}
}
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
inline
bool
operator
==
(
const
tuple
<
LhsTypes
...
>
&
lhs
,
inline
bool
operator
==
(
tuple
<
LhsTypes
...
>
const
&
lhs
,
const
tuple_view
<
RhsTypes
...
>
&
rhs
)
tuple_view
<
RhsTypes
...
>
const
&
rhs
)
{
{
return
util
::
compare_tuples
(
lhs
,
rhs
);
return
util
::
compare_tuples
(
lhs
,
rhs
);
}
}
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
inline
bool
operator
==
(
const
tuple_view
<
LhsTypes
...
>
&
lhs
,
inline
bool
operator
==
(
tuple_view
<
LhsTypes
...
>
const
&
lhs
,
const
tuple
<
RhsTypes
...
>
&
rhs
)
tuple
<
RhsTypes
...
>
const
&
rhs
)
{
{
return
util
::
compare_tuples
(
lhs
,
rhs
);
return
util
::
compare_tuples
(
lhs
,
rhs
);
}
}
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
inline
bool
operator
!=
(
const
tuple_view
<
LhsTypes
...
>
&
lhs
,
inline
bool
operator
!=
(
tuple_view
<
LhsTypes
...
>
const
&
lhs
,
const
tuple_view
<
RhsTypes
...
>
&
rhs
)
tuple_view
<
RhsTypes
...
>
const
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
inline
bool
operator
!=
(
const
tuple
<
LhsTypes
...
>
&
lhs
,
inline
bool
operator
!=
(
tuple
<
LhsTypes
...
>
const
&
lhs
,
const
tuple_view
<
RhsTypes
...
>
&
rhs
)
tuple_view
<
RhsTypes
...
>
const
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
template
<
typename
...
LhsTypes
,
typename
...
RhsTypes
>
inline
bool
operator
!=
(
const
tuple_view
<
LhsTypes
...
>
&
lhs
,
inline
bool
operator
!=
(
tuple_view
<
LhsTypes
...
>
const
&
lhs
,
const
tuple
<
RhsTypes
...
>
&
rhs
)
tuple
<
RhsTypes
...
>
const
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
...
...
cppa/uniform_type_info.hpp
View file @
42db08af
...
@@ -23,7 +23,7 @@ class serializer;
...
@@ -23,7 +23,7 @@ class serializer;
class
deserializer
;
class
deserializer
;
class
uniform_type_info
;
class
uniform_type_info
;
const
uniform_type_info
*
uniform_typeid
(
const
std
::
type_info
&
);
uniform_type_info
const
*
uniform_typeid
(
std
::
type_info
const
&
);
/**
/**
* @defgroup TypeSystem libcppa's platform-independent type system.
* @defgroup TypeSystem libcppa's platform-independent type system.
...
@@ -121,16 +121,16 @@ class uniform_type_info
...
@@ -121,16 +121,16 @@ class uniform_type_info
friend
class
object
;
friend
class
object
;
friend
bool
operator
==
(
const
uniform_type_info
&
lhs
,
friend
bool
operator
==
(
uniform_type_info
const
&
lhs
,
const
uniform_type_info
&
rhs
);
uniform_type_info
const
&
rhs
);
// disable copy and move constructors
// disable copy and move constructors
uniform_type_info
(
uniform_type_info
&&
)
=
delete
;
uniform_type_info
(
uniform_type_info
&&
)
=
delete
;
uniform_type_info
(
const
uniform_type_info
&
)
=
delete
;
uniform_type_info
(
uniform_type_info
const
&
)
=
delete
;
// disable assignment operators
// disable assignment operators
uniform_type_info
&
operator
=
(
uniform_type_info
&&
)
=
delete
;
uniform_type_info
&
operator
=
(
uniform_type_info
&&
)
=
delete
;
uniform_type_info
&
operator
=
(
const
uniform_type_info
&
)
=
delete
;
uniform_type_info
&
operator
=
(
uniform_type_info
const
&
)
=
delete
;
public:
public:
...
@@ -142,7 +142,7 @@ class uniform_type_info
...
@@ -142,7 +142,7 @@ class uniform_type_info
* @returns The instance associated to @p uniform_name.
* @returns The instance associated to @p uniform_name.
* @throws std::runtime_error if no type named @p uniform_name was found.
* @throws std::runtime_error if no type named @p uniform_name was found.
*/
*/
static
uniform_type_info
*
from
(
const
std
::
string
&
uniform_name
);
static
uniform_type_info
*
from
(
std
::
string
const
&
uniform_name
);
/**
/**
* @brief Get instance by std::type_info.
* @brief Get instance by std::type_info.
...
@@ -150,7 +150,7 @@ class uniform_type_info
...
@@ -150,7 +150,7 @@ class uniform_type_info
* @returns An instance describing the same type as @p tinfo.
* @returns An instance describing the same type as @p tinfo.
* @throws std::runtime_error if @p tinfo is not an announced type.
* @throws std::runtime_error if @p tinfo is not an announced type.
*/
*/
static
const
uniform_type_info
*
from
(
const
std
::
type_info
&
tinfo
);
static
uniform_type_info
const
*
from
(
std
::
type_info
const
&
tinfo
);
/**
/**
* @brief Get all instances.
* @brief Get all instances.
...
@@ -162,7 +162,7 @@ class uniform_type_info
...
@@ -162,7 +162,7 @@ class uniform_type_info
* @brief Get the internal @p libcppa name for this type.
* @brief Get the internal @p libcppa name for this type.
* @returns A string describing the @p libcppa internal type name.
* @returns A string describing the @p libcppa internal type name.
*/
*/
inline
const
std
::
string
&
name
()
const
{
return
m_name
;
}
inline
std
::
string
const
&
name
()
const
{
return
m_name
;
}
/**
/**
* @brief Creates an object of this type.
* @brief Creates an object of this type.
...
@@ -179,7 +179,7 @@ class uniform_type_info
...
@@ -179,7 +179,7 @@ class uniform_type_info
* type than @p tinfo.
* type than @p tinfo.
* @returns @p true if @p tinfo describes the same type as @p this.
* @returns @p true if @p tinfo describes the same type as @p this.
*/
*/
virtual
bool
equals
(
const
std
::
type_info
&
tinfo
)
const
=
0
;
virtual
bool
equals
(
std
::
type_info
const
&
tinfo
)
const
=
0
;
/**
/**
* @brief Compares two instances of this type.
* @brief Compares two instances of this type.
...
@@ -188,7 +188,7 @@ class uniform_type_info
...
@@ -188,7 +188,7 @@ class uniform_type_info
* @returns @p true if <tt>*instance1 == *instance2</tt>.
* @returns @p true if <tt>*instance1 == *instance2</tt>.
* @pre @p instance1 and @p instance2 have the type of @p this.
* @pre @p instance1 and @p instance2 have the type of @p this.
*/
*/
virtual
bool
equals
(
const
void
*
instance1
,
const
void
*
instance2
)
const
=
0
;
virtual
bool
equals
(
void
const
*
instance1
,
void
const
*
instance2
)
const
=
0
;
/**
/**
* @brief Serializes @p instance to @p sink.
* @brief Serializes @p instance to @p sink.
...
@@ -196,7 +196,7 @@ class uniform_type_info
...
@@ -196,7 +196,7 @@ class uniform_type_info
* @param sink Target data sink.
* @param sink Target data sink.
* @pre @p instance has the type of @p this.
* @pre @p instance has the type of @p this.
*/
*/
virtual
void
serialize
(
const
void
*
instance
,
serializer
*
sink
)
const
=
0
;
virtual
void
serialize
(
void
const
*
instance
,
serializer
*
sink
)
const
=
0
;
/**
/**
* @brief Deserializes @p instance from @p source.
* @brief Deserializes @p instance from @p source.
...
@@ -208,7 +208,7 @@ class uniform_type_info
...
@@ -208,7 +208,7 @@ class uniform_type_info
protected:
protected:
uniform_type_info
(
const
std
::
string
&
uniform_name
);
uniform_type_info
(
std
::
string
const
&
uniform_name
);
/**
/**
* @brief Casts @p instance to the native type and deletes it.
* @brief Casts @p instance to the native type and deletes it.
...
@@ -226,7 +226,7 @@ class uniform_type_info
...
@@ -226,7 +226,7 @@ class uniform_type_info
* with the default constructor.
* with the default constructor.
* @pre @p instance has the type of @p this or is set to @p nullptr.
* @pre @p instance has the type of @p this or is set to @p nullptr.
*/
*/
virtual
void
*
new_instance
(
const
void
*
instance
=
nullptr
)
const
=
0
;
virtual
void
*
new_instance
(
void
const
*
instance
=
nullptr
)
const
=
0
;
private:
private:
...
@@ -235,41 +235,41 @@ class uniform_type_info
...
@@ -235,41 +235,41 @@ class uniform_type_info
};
};
template
<
typename
T
>
template
<
typename
T
>
inline
const
uniform_type_info
*
uniform_typeid
()
inline
uniform_type_info
const
*
uniform_typeid
()
{
{
return
uniform_typeid
(
typeid
(
T
));
return
uniform_typeid
(
typeid
(
T
));
}
}
inline
bool
operator
==
(
const
uniform_type_info
&
lhs
,
inline
bool
operator
==
(
uniform_type_info
const
&
lhs
,
const
uniform_type_info
&
rhs
)
uniform_type_info
const
&
rhs
)
{
{
// uniform_type_info instances are singletons,
// uniform_type_info instances are singletons,
// thus, equal == identical
// thus, equal == identical
return
&
lhs
==
&
rhs
;
return
&
lhs
==
&
rhs
;
}
}
inline
bool
operator
!=
(
const
uniform_type_info
&
lhs
,
inline
bool
operator
!=
(
uniform_type_info
const
&
lhs
,
const
uniform_type_info
&
rhs
)
uniform_type_info
const
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
inline
bool
operator
==
(
const
uniform_type_info
&
lhs
,
const
std
::
type_info
&
rhs
)
inline
bool
operator
==
(
uniform_type_info
const
&
lhs
,
std
::
type_info
const
&
rhs
)
{
{
return
lhs
.
equals
(
rhs
);
return
lhs
.
equals
(
rhs
);
}
}
inline
bool
operator
!=
(
const
uniform_type_info
&
lhs
,
const
std
::
type_info
&
rhs
)
inline
bool
operator
!=
(
uniform_type_info
const
&
lhs
,
std
::
type_info
const
&
rhs
)
{
{
return
!
(
lhs
.
equals
(
rhs
));
return
!
(
lhs
.
equals
(
rhs
));
}
}
inline
bool
operator
==
(
const
std
::
type_info
&
lhs
,
const
uniform_type_info
&
rhs
)
inline
bool
operator
==
(
std
::
type_info
const
&
lhs
,
uniform_type_info
const
&
rhs
)
{
{
return
rhs
.
equals
(
lhs
);
return
rhs
.
equals
(
lhs
);
}
}
inline
bool
operator
!=
(
const
std
::
type_info
&
lhs
,
const
uniform_type_info
&
rhs
)
inline
bool
operator
!=
(
std
::
type_info
const
&
lhs
,
uniform_type_info
const
&
rhs
)
{
{
return
!
(
rhs
.
equals
(
lhs
));
return
!
(
rhs
.
equals
(
lhs
));
}
}
...
...
cppa/util/abstract_uniform_type_info.hpp
View file @
42db08af
...
@@ -14,9 +14,9 @@ template<typename T>
...
@@ -14,9 +14,9 @@ template<typename T>
class
abstract_uniform_type_info
:
public
uniform_type_info
class
abstract_uniform_type_info
:
public
uniform_type_info
{
{
inline
static
const
T
&
deref
(
const
void
*
ptr
)
inline
static
T
const
&
deref
(
void
const
*
ptr
)
{
{
return
*
reinterpret_cast
<
const
T
*>
(
ptr
);
return
*
reinterpret_cast
<
T
const
*>
(
ptr
);
}
}
inline
static
T
&
deref
(
void
*
ptr
)
inline
static
T
&
deref
(
void
*
ptr
)
...
@@ -26,18 +26,18 @@ class abstract_uniform_type_info : public uniform_type_info
...
@@ -26,18 +26,18 @@ class abstract_uniform_type_info : public uniform_type_info
protected:
protected:
abstract_uniform_type_info
(
const
std
::
string
&
uname
abstract_uniform_type_info
(
std
::
string
const
&
uname
=
detail
::
to_uniform_name
(
typeid
(
T
)))
=
detail
::
to_uniform_name
(
typeid
(
T
)))
:
uniform_type_info
(
uname
)
:
uniform_type_info
(
uname
)
{
{
}
}
bool
equals
(
const
void
*
lhs
,
const
void
*
rhs
)
const
bool
equals
(
void
const
*
lhs
,
void
const
*
rhs
)
const
{
{
return
deref
(
lhs
)
==
deref
(
rhs
);
return
deref
(
lhs
)
==
deref
(
rhs
);
}
}
void
*
new_instance
(
const
void
*
ptr
)
const
void
*
new_instance
(
void
const
*
ptr
)
const
{
{
return
(
ptr
)
?
new
T
(
deref
(
ptr
))
:
new
T
();
return
(
ptr
)
?
new
T
(
deref
(
ptr
))
:
new
T
();
}
}
...
@@ -49,7 +49,7 @@ class abstract_uniform_type_info : public uniform_type_info
...
@@ -49,7 +49,7 @@ class abstract_uniform_type_info : public uniform_type_info
public:
public:
bool
equals
(
const
std
::
type_info
&
tinfo
)
const
bool
equals
(
std
::
type_info
const
&
tinfo
)
const
{
{
return
typeid
(
T
)
==
tinfo
;
return
typeid
(
T
)
==
tinfo
;
}
}
...
...
cppa/util/any_tuple_iterator.hpp
View file @
42db08af
...
@@ -8,21 +8,21 @@ namespace cppa { namespace util {
...
@@ -8,21 +8,21 @@ namespace cppa { namespace util {
class
any_tuple_iterator
class
any_tuple_iterator
{
{
const
any_tuple
&
m_data
;
any_tuple
const
&
m_data
;
size_t
m_pos
;
size_t
m_pos
;
public:
public:
any_tuple_iterator
(
const
any_tuple
&
data
,
size_t
pos
=
0
);
any_tuple_iterator
(
any_tuple
const
&
data
,
size_t
pos
=
0
);
inline
bool
at_end
()
const
;
inline
bool
at_end
()
const
;
template
<
typename
T
>
template
<
typename
T
>
inline
const
T
&
value
()
const
;
inline
T
const
&
value
()
const
;
inline
const
void
*
value_ptr
()
const
;
inline
void
const
*
value_ptr
()
const
;
inline
c
onst
cppa
::
uniform_type_info
&
type
()
const
;
inline
c
ppa
::
uniform_type_info
const
&
type
()
const
;
inline
size_t
position
()
const
;
inline
size_t
position
()
const
;
...
@@ -36,17 +36,17 @@ inline bool any_tuple_iterator::at_end() const
...
@@ -36,17 +36,17 @@ inline bool any_tuple_iterator::at_end() const
}
}
template
<
typename
T
>
template
<
typename
T
>
inline
const
T
&
any_tuple_iterator
::
value
()
const
inline
T
const
&
any_tuple_iterator
::
value
()
const
{
{
return
*
reinterpret_cast
<
const
T
*>
(
m_data
.
at
(
m_pos
));
return
*
reinterpret_cast
<
T
const
*>
(
m_data
.
at
(
m_pos
));
}
}
inline
const
uniform_type_info
&
any_tuple_iterator
::
type
()
const
inline
uniform_type_info
const
&
any_tuple_iterator
::
type
()
const
{
{
return
m_data
.
utype_info_at
(
m_pos
);
return
m_data
.
utype_info_at
(
m_pos
);
}
}
inline
const
void
*
any_tuple_iterator
::
value_ptr
()
const
inline
void
const
*
any_tuple_iterator
::
value_ptr
()
const
{
{
return
m_data
.
at
(
m_pos
);
return
m_data
.
at
(
m_pos
);
}
}
...
...
cppa/util/comparable.hpp
View file @
42db08af
...
@@ -16,62 +16,62 @@ template<typename Subclass, typename T = Subclass>
...
@@ -16,62 +16,62 @@ template<typename Subclass, typename T = Subclass>
class
comparable
class
comparable
{
{
friend
bool
operator
==
(
const
Subclass
&
lhs
,
const
T
&
rhs
)
friend
bool
operator
==
(
Subclass
const
&
lhs
,
T
const
&
rhs
)
{
{
return
lhs
.
compare
(
rhs
)
==
0
;
return
lhs
.
compare
(
rhs
)
==
0
;
}
}
friend
bool
operator
==
(
const
T
&
lhs
,
const
Subclass
&
rhs
)
friend
bool
operator
==
(
T
const
&
lhs
,
Subclass
const
&
rhs
)
{
{
return
rhs
.
compare
(
lhs
)
==
0
;
return
rhs
.
compare
(
lhs
)
==
0
;
}
}
friend
bool
operator
!=
(
const
Subclass
&
lhs
,
const
T
&
rhs
)
friend
bool
operator
!=
(
Subclass
const
&
lhs
,
T
const
&
rhs
)
{
{
return
lhs
.
compare
(
rhs
)
!=
0
;
return
lhs
.
compare
(
rhs
)
!=
0
;
}
}
friend
bool
operator
!=
(
const
T
&
lhs
,
const
Subclass
&
rhs
)
friend
bool
operator
!=
(
T
const
&
lhs
,
Subclass
const
&
rhs
)
{
{
return
rhs
.
compare
(
lhs
)
!=
0
;
return
rhs
.
compare
(
lhs
)
!=
0
;
}
}
friend
bool
operator
<
(
const
Subclass
&
lhs
,
const
T
&
rhs
)
friend
bool
operator
<
(
Subclass
const
&
lhs
,
T
const
&
rhs
)
{
{
return
lhs
.
compare
(
rhs
)
<
0
;
return
lhs
.
compare
(
rhs
)
<
0
;
}
}
friend
bool
operator
>
(
const
Subclass
&
lhs
,
const
T
&
rhs
)
friend
bool
operator
>
(
Subclass
const
&
lhs
,
T
const
&
rhs
)
{
{
return
lhs
.
compare
(
rhs
)
>
0
;
return
lhs
.
compare
(
rhs
)
>
0
;
}
}
friend
bool
operator
<
(
const
T
&
lhs
,
const
Subclass
&
rhs
)
friend
bool
operator
<
(
T
const
&
lhs
,
Subclass
const
&
rhs
)
{
{
return
rhs
>
lhs
;
return
rhs
>
lhs
;
}
}
friend
bool
operator
>
(
const
T
&
lhs
,
const
Subclass
&
rhs
)
friend
bool
operator
>
(
T
const
&
lhs
,
Subclass
const
&
rhs
)
{
{
return
rhs
<
lhs
;
return
rhs
<
lhs
;
}
}
friend
bool
operator
<=
(
const
Subclass
&
lhs
,
const
T
&
rhs
)
friend
bool
operator
<=
(
Subclass
const
&
lhs
,
T
const
&
rhs
)
{
{
return
lhs
.
compare
(
rhs
)
<=
0
;
return
lhs
.
compare
(
rhs
)
<=
0
;
}
}
friend
bool
operator
>=
(
const
Subclass
&
lhs
,
const
T
&
rhs
)
friend
bool
operator
>=
(
Subclass
const
&
lhs
,
T
const
&
rhs
)
{
{
return
lhs
.
compare
(
rhs
)
>=
0
;
return
lhs
.
compare
(
rhs
)
>=
0
;
}
}
friend
bool
operator
<=
(
const
T
&
lhs
,
const
Subclass
&
rhs
)
friend
bool
operator
<=
(
T
const
&
lhs
,
Subclass
const
&
rhs
)
{
{
return
rhs
>=
lhs
;
return
rhs
>=
lhs
;
}
}
friend
bool
operator
>=
(
const
T
&
lhs
,
const
Subclass
&
rhs
)
friend
bool
operator
>=
(
T
const
&
lhs
,
Subclass
const
&
rhs
)
{
{
return
rhs
<=
lhs
;
return
rhs
<=
lhs
;
}
}
...
@@ -82,32 +82,32 @@ template<typename Subclass>
...
@@ -82,32 +82,32 @@ template<typename Subclass>
class
comparable
<
Subclass
,
Subclass
>
class
comparable
<
Subclass
,
Subclass
>
{
{
friend
bool
operator
==
(
const
Subclass
&
lhs
,
const
Subclass
&
rhs
)
friend
bool
operator
==
(
Subclass
const
&
lhs
,
Subclass
const
&
rhs
)
{
{
return
lhs
.
compare
(
rhs
)
==
0
;
return
lhs
.
compare
(
rhs
)
==
0
;
}
}
friend
bool
operator
!=
(
const
Subclass
&
lhs
,
const
Subclass
&
rhs
)
friend
bool
operator
!=
(
Subclass
const
&
lhs
,
Subclass
const
&
rhs
)
{
{
return
lhs
.
compare
(
rhs
)
!=
0
;
return
lhs
.
compare
(
rhs
)
!=
0
;
}
}
friend
bool
operator
<
(
const
Subclass
&
lhs
,
const
Subclass
&
rhs
)
friend
bool
operator
<
(
Subclass
const
&
lhs
,
Subclass
const
&
rhs
)
{
{
return
lhs
.
compare
(
rhs
)
<
0
;
return
lhs
.
compare
(
rhs
)
<
0
;
}
}
friend
bool
operator
<=
(
const
Subclass
&
lhs
,
const
Subclass
&
rhs
)
friend
bool
operator
<=
(
Subclass
const
&
lhs
,
Subclass
const
&
rhs
)
{
{
return
lhs
.
compare
(
rhs
)
<=
0
;
return
lhs
.
compare
(
rhs
)
<=
0
;
}
}
friend
bool
operator
>
(
const
Subclass
&
lhs
,
const
Subclass
&
rhs
)
friend
bool
operator
>
(
Subclass
const
&
lhs
,
Subclass
const
&
rhs
)
{
{
return
lhs
.
compare
(
rhs
)
>
0
;
return
lhs
.
compare
(
rhs
)
>
0
;
}
}
friend
bool
operator
>=
(
const
Subclass
&
lhs
,
const
Subclass
&
rhs
)
friend
bool
operator
>=
(
Subclass
const
&
lhs
,
Subclass
const
&
rhs
)
{
{
return
lhs
.
compare
(
rhs
)
>=
0
;
return
lhs
.
compare
(
rhs
)
>=
0
;
}
}
...
...
cppa/util/compare_tuples.hpp
View file @
42db08af
...
@@ -12,7 +12,7 @@ namespace cppa { namespace detail {
...
@@ -12,7 +12,7 @@ namespace cppa { namespace detail {
template
<
size_t
N
,
template
<
typename
...
>
class
Tuple
,
typename
...
Types
>
template
<
size_t
N
,
template
<
typename
...
>
class
Tuple
,
typename
...
Types
>
const
typename
util
::
at
<
N
,
Types
...
>::
type
&
const
typename
util
::
at
<
N
,
Types
...
>::
type
&
do_get
(
const
Tuple
<
Types
...
>
&
t
)
do_get
(
Tuple
<
Types
...
>
const
&
t
)
{
{
return
::
cppa
::
get
<
N
,
Types
...
>
(
t
);
return
::
cppa
::
get
<
N
,
Types
...
>
(
t
);
}
}
...
@@ -20,7 +20,7 @@ do_get(const Tuple<Types...>& t)
...
@@ -20,7 +20,7 @@ do_get(const Tuple<Types...>& t)
template
<
size_t
N
,
typename
LhsTuple
,
typename
RhsTuple
>
template
<
size_t
N
,
typename
LhsTuple
,
typename
RhsTuple
>
struct
cmp_helper
struct
cmp_helper
{
{
inline
static
bool
cmp
(
const
LhsTuple
&
lhs
,
const
RhsTuple
&
rhs
)
inline
static
bool
cmp
(
LhsTuple
const
&
lhs
,
RhsTuple
const
&
rhs
)
{
{
return
do_get
<
N
>
(
lhs
)
==
do_get
<
N
>
(
rhs
)
return
do_get
<
N
>
(
lhs
)
==
do_get
<
N
>
(
rhs
)
&&
cmp_helper
<
N
-
1
,
LhsTuple
,
RhsTuple
>::
cmp
(
lhs
,
rhs
);
&&
cmp_helper
<
N
-
1
,
LhsTuple
,
RhsTuple
>::
cmp
(
lhs
,
rhs
);
...
@@ -30,7 +30,7 @@ struct cmp_helper
...
@@ -30,7 +30,7 @@ struct cmp_helper
template
<
typename
LhsTuple
,
typename
RhsTuple
>
template
<
typename
LhsTuple
,
typename
RhsTuple
>
struct
cmp_helper
<
0
,
LhsTuple
,
RhsTuple
>
struct
cmp_helper
<
0
,
LhsTuple
,
RhsTuple
>
{
{
inline
static
bool
cmp
(
const
LhsTuple
&
lhs
,
const
RhsTuple
&
rhs
)
inline
static
bool
cmp
(
LhsTuple
const
&
lhs
,
RhsTuple
const
&
rhs
)
{
{
return
do_get
<
0
>
(
lhs
)
==
do_get
<
0
>
(
rhs
);
return
do_get
<
0
>
(
lhs
)
==
do_get
<
0
>
(
rhs
);
}
}
...
@@ -42,8 +42,8 @@ namespace cppa { namespace util {
...
@@ -42,8 +42,8 @@ namespace cppa { namespace util {
template
<
template
<
typename
...
>
class
LhsTuple
,
typename
...
LhsTypes
,
template
<
template
<
typename
...
>
class
LhsTuple
,
typename
...
LhsTypes
,
template
<
typename
...
>
class
RhsTuple
,
typename
...
RhsTypes
>
template
<
typename
...
>
class
RhsTuple
,
typename
...
RhsTypes
>
bool
compare_tuples
(
const
LhsTuple
<
LhsTypes
...
>
&
lhs
,
bool
compare_tuples
(
LhsTuple
<
LhsTypes
...
>
const
&
lhs
,
const
RhsTuple
<
RhsTypes
...
>
&
rhs
)
RhsTuple
<
RhsTypes
...
>
const
&
rhs
)
{
{
static_assert
(
sizeof
...(
LhsTypes
)
==
sizeof
...(
RhsTypes
),
static_assert
(
sizeof
...(
LhsTypes
)
==
sizeof
...(
RhsTypes
),
"could not compare tuples of different size"
);
"could not compare tuples of different size"
);
...
@@ -58,8 +58,8 @@ bool compare_tuples(const LhsTuple<LhsTypes...>& lhs,
...
@@ -58,8 +58,8 @@ bool compare_tuples(const LhsTuple<LhsTypes...>& lhs,
template
<
template
<
typename
...
>
class
LhsTuple
,
typename
...
LhsTypes
,
template
<
template
<
typename
...
>
class
LhsTuple
,
typename
...
LhsTypes
,
template
<
typename
...
>
class
RhsTuple
,
typename
...
RhsTypes
>
template
<
typename
...
>
class
RhsTuple
,
typename
...
RhsTypes
>
bool
compare_first_elements
(
const
LhsTuple
<
LhsTypes
...
>
&
lhs
,
bool
compare_first_elements
(
LhsTuple
<
LhsTypes
...
>
const
&
lhs
,
const
RhsTuple
<
RhsTypes
...
>
&
rhs
)
RhsTuple
<
RhsTypes
...
>
const
&
rhs
)
{
{
typedef
util
::
type_list
<
LhsTypes
...
>
lhs_types
;
typedef
util
::
type_list
<
LhsTypes
...
>
lhs_types
;
typedef
util
::
type_list
<
RhsTypes
...
>
rhs_types
;
typedef
util
::
type_list
<
RhsTypes
...
>
rhs_types
;
...
...
cppa/util/duration.hpp
View file @
42db08af
...
@@ -55,9 +55,9 @@ class duration
...
@@ -55,9 +55,9 @@ class duration
};
};
bool
operator
==
(
const
duration
&
lhs
,
const
duration
&
rhs
);
bool
operator
==
(
duration
const
&
lhs
,
duration
const
&
rhs
);
inline
bool
operator
!=
(
const
duration
&
lhs
,
const
duration
&
rhs
)
inline
bool
operator
!=
(
duration
const
&
lhs
,
duration
const
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
...
@@ -67,7 +67,7 @@ inline bool operator!=(const duration& lhs, const duration& rhs)
...
@@ -67,7 +67,7 @@ inline bool operator!=(const duration& lhs, const duration& rhs)
template
<
class
Clock
,
class
Duration
>
template
<
class
Clock
,
class
Duration
>
std
::
chrono
::
time_point
<
Clock
,
Duration
>&
std
::
chrono
::
time_point
<
Clock
,
Duration
>&
operator
+=
(
std
::
chrono
::
time_point
<
Clock
,
Duration
>&
lhs
,
operator
+=
(
std
::
chrono
::
time_point
<
Clock
,
Duration
>&
lhs
,
c
onst
cppa
::
util
::
duration
&
rhs
)
c
ppa
::
util
::
duration
const
&
rhs
)
{
{
switch
(
rhs
.
unit
)
switch
(
rhs
.
unit
)
{
{
...
...
cppa/util/either.hpp
View file @
42db08af
...
@@ -21,7 +21,7 @@ class either
...
@@ -21,7 +21,7 @@ class either
bool
m_is_left
;
bool
m_is_left
;
void
check_flag
(
bool
flag
,
c
onst
char
*
side
)
void
check_flag
(
bool
flag
,
c
har
const
*
side
)
{
{
if
(
m_is_left
!=
flag
)
if
(
m_is_left
!=
flag
)
{
{
...
@@ -63,7 +63,7 @@ class either
...
@@ -63,7 +63,7 @@ class either
new
(
&
m_left
)
Left
();
new
(
&
m_left
)
Left
();
}
}
either
(
const
Lef
t
&
value
)
:
m_is_left
(
true
)
either
(
Left
cons
t
&
value
)
:
m_is_left
(
true
)
{
{
cr_left
(
value
);
cr_left
(
value
);
}
}
...
@@ -73,7 +73,7 @@ class either
...
@@ -73,7 +73,7 @@ class either
cr_left
(
std
::
move
(
value
));
cr_left
(
std
::
move
(
value
));
}
}
either
(
const
Righ
t
&
value
)
:
m_is_left
(
false
)
either
(
Right
cons
t
&
value
)
:
m_is_left
(
false
)
{
{
cr_right
(
value
);
cr_right
(
value
);
}
}
...
@@ -83,7 +83,7 @@ class either
...
@@ -83,7 +83,7 @@ class either
cr_right
(
std
::
move
(
value
));
cr_right
(
std
::
move
(
value
));
}
}
either
(
const
either
&
other
)
:
m_is_left
(
other
.
m_is_left
)
either
(
either
const
&
other
)
:
m_is_left
(
other
.
m_is_left
)
{
{
if
(
other
.
m_is_left
)
if
(
other
.
m_is_left
)
{
{
...
@@ -112,7 +112,7 @@ class either
...
@@ -112,7 +112,7 @@ class either
destroy
();
destroy
();
}
}
either
&
operator
=
(
const
either
&
other
)
either
&
operator
=
(
either
const
&
other
)
{
{
if
(
m_is_left
==
other
.
m_is_left
)
if
(
m_is_left
==
other
.
m_is_left
)
{
{
...
@@ -186,7 +186,7 @@ class either
...
@@ -186,7 +186,7 @@ class either
return
m_left
;
return
m_left
;
}
}
const
Lef
t
&
left
()
const
Left
cons
t
&
left
()
const
{
{
check_flag
(
true
,
"left"
);
check_flag
(
true
,
"left"
);
return
m_left
;
return
m_left
;
...
@@ -198,7 +198,7 @@ class either
...
@@ -198,7 +198,7 @@ class either
return
m_right
;
return
m_right
;
}
}
const
Righ
t
&
right
()
const
Right
cons
t
&
right
()
const
{
{
check_flag
(
false
,
"right"
);
check_flag
(
false
,
"right"
);
return
m_right
;
return
m_right
;
...
@@ -225,25 +225,25 @@ bool operator==(const either<Left, Right>& lhs,
...
@@ -225,25 +225,25 @@ bool operator==(const either<Left, Right>& lhs,
}
}
template
<
typename
Left
,
typename
Right
>
template
<
typename
Left
,
typename
Right
>
bool
operator
==
(
const
either
<
Left
,
Right
>&
lhs
,
const
Lef
t
&
rhs
)
bool
operator
==
(
const
either
<
Left
,
Right
>&
lhs
,
Left
cons
t
&
rhs
)
{
{
return
lhs
.
is_left
()
&&
lhs
.
left
()
==
rhs
;
return
lhs
.
is_left
()
&&
lhs
.
left
()
==
rhs
;
}
}
template
<
typename
Left
,
typename
Right
>
template
<
typename
Left
,
typename
Right
>
bool
operator
==
(
const
Lef
t
&
lhs
,
const
either
<
Left
,
Right
>&
rhs
)
bool
operator
==
(
Left
cons
t
&
lhs
,
const
either
<
Left
,
Right
>&
rhs
)
{
{
return
rhs
==
lhs
;
return
rhs
==
lhs
;
}
}
template
<
typename
Left
,
typename
Right
>
template
<
typename
Left
,
typename
Right
>
bool
operator
==
(
const
either
<
Left
,
Right
>&
lhs
,
const
Righ
t
&
rhs
)
bool
operator
==
(
const
either
<
Left
,
Right
>&
lhs
,
Right
cons
t
&
rhs
)
{
{
return
lhs
.
is_right
()
&&
lhs
.
right
()
==
rhs
;
return
lhs
.
is_right
()
&&
lhs
.
right
()
==
rhs
;
}
}
template
<
typename
Left
,
typename
Right
>
template
<
typename
Left
,
typename
Right
>
bool
operator
==
(
const
Righ
t
&
lhs
,
const
either
<
Left
,
Right
>&
rhs
)
bool
operator
==
(
Right
cons
t
&
lhs
,
const
either
<
Left
,
Right
>&
rhs
)
{
{
return
rhs
==
lhs
;
return
rhs
==
lhs
;
}
}
...
@@ -256,25 +256,25 @@ bool operator!=(const either<Left, Right>& lhs,
...
@@ -256,25 +256,25 @@ bool operator!=(const either<Left, Right>& lhs,
}
}
template
<
typename
Left
,
typename
Right
>
template
<
typename
Left
,
typename
Right
>
bool
operator
!=
(
const
either
<
Left
,
Right
>&
lhs
,
const
Lef
t
&
rhs
)
bool
operator
!=
(
const
either
<
Left
,
Right
>&
lhs
,
Left
cons
t
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
template
<
typename
Left
,
typename
Right
>
template
<
typename
Left
,
typename
Right
>
bool
operator
!=
(
const
Lef
t
&
lhs
,
const
either
<
Left
,
Right
>&
rhs
)
bool
operator
!=
(
Left
cons
t
&
lhs
,
const
either
<
Left
,
Right
>&
rhs
)
{
{
return
!
(
rhs
==
lhs
);
return
!
(
rhs
==
lhs
);
}
}
template
<
typename
Left
,
typename
Right
>
template
<
typename
Left
,
typename
Right
>
bool
operator
!=
(
const
either
<
Left
,
Right
>&
lhs
,
const
Righ
t
&
rhs
)
bool
operator
!=
(
const
either
<
Left
,
Right
>&
lhs
,
Right
cons
t
&
rhs
)
{
{
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
template
<
typename
Left
,
typename
Right
>
template
<
typename
Left
,
typename
Right
>
bool
operator
!=
(
const
Righ
t
&
lhs
,
const
either
<
Left
,
Right
>&
rhs
)
bool
operator
!=
(
Right
cons
t
&
lhs
,
const
either
<
Left
,
Right
>&
rhs
)
{
{
return
!
(
rhs
==
lhs
);
return
!
(
rhs
==
lhs
);
}
}
...
...
cppa/util/fixed_vector.hpp
View file @
42db08af
...
@@ -21,16 +21,16 @@ class fixed_vector
...
@@ -21,16 +21,16 @@ class fixed_vector
typedef
size_t
size_type
;
typedef
size_t
size_type
;
typedef
T
&
reference
;
typedef
T
&
reference
;
typedef
const
T
&
const_reference
;
typedef
T
const
&
const_reference
;
typedef
T
*
iterator
;
typedef
T
*
iterator
;
typedef
const
T
*
const_iterator
;
typedef
T
const
*
const_iterator
;
constexpr
fixed_vector
()
:
m_size
(
0
)
constexpr
fixed_vector
()
:
m_size
(
0
)
{
{
}
}
fixed_vector
(
const
fixed_vector
&
other
)
:
m_size
(
other
.
m_size
)
fixed_vector
(
fixed_vector
const
&
other
)
:
m_size
(
other
.
m_size
)
{
{
std
::
copy
(
other
.
m_data
,
other
.
m_data
+
other
.
m_size
,
m_data
);
std
::
copy
(
other
.
m_data
,
other
.
m_data
+
other
.
m_size
,
m_data
);
}
}
...
@@ -50,7 +50,7 @@ class fixed_vector
...
@@ -50,7 +50,7 @@ class fixed_vector
return
m_size
==
MaxSize
;
return
m_size
==
MaxSize
;
}
}
inline
void
push_back
(
const
T
&
what
)
inline
void
push_back
(
T
const
&
what
)
{
{
m_data
[
m_size
++
]
=
what
;
m_data
[
m_size
++
]
=
what
;
}
}
...
...
cppa/util/has_copy_member_fun.hpp
View file @
42db08af
...
@@ -10,13 +10,13 @@ class has_copy_member_fun
...
@@ -10,13 +10,13 @@ class has_copy_member_fun
{
{
template
<
typename
A
>
template
<
typename
A
>
static
bool
hc_help_fun
(
const
A
*
arg0
,
decltype
(
arg0
->
copy
())
=
0
)
static
bool
hc_help_fun
(
A
const
*
arg0
,
decltype
(
arg0
->
copy
())
=
0
)
{
{
return
true
;
return
true
;
}
}
template
<
typename
A
>
template
<
typename
A
>
static
void
hc_help_fun
(
const
A
*
,
void
*
=
0
)
{
}
static
void
hc_help_fun
(
A
const
*
,
void
*
=
0
)
{
}
typedef
decltype
(
hc_help_fun
((
T
*
)
0
,
(
T
*
)
0
))
result_type
;
typedef
decltype
(
hc_help_fun
((
T
*
)
0
,
(
T
*
)
0
))
result_type
;
...
...
cppa/util/is_comparable.hpp
View file @
42db08af
...
@@ -18,14 +18,14 @@ class is_comparable
...
@@ -18,14 +18,14 @@ class is_comparable
// candidate and thus decltype(cmp_help_fun(...)) is void.
// candidate and thus decltype(cmp_help_fun(...)) is void.
template
<
typename
A
,
typename
B
>
template
<
typename
A
,
typename
B
>
static
bool
cmp_help_fun
(
const
A
*
arg0
,
const
B
*
arg1
,
static
bool
cmp_help_fun
(
A
const
*
arg0
,
B
const
*
arg1
,
decltype
(
*
arg0
==
*
arg1
)
*
=
nullptr
)
decltype
(
*
arg0
==
*
arg1
)
*
=
nullptr
)
{
{
return
true
;
return
true
;
}
}
template
<
typename
A
,
typename
B
>
template
<
typename
A
,
typename
B
>
static
void
cmp_help_fun
(
const
A
*
,
const
B
*
,
void
*
=
nullptr
)
{
}
static
void
cmp_help_fun
(
A
const
*
,
B
const
*
,
void
*
=
nullptr
)
{
}
typedef
decltype
(
cmp_help_fun
(
static_cast
<
T1
*>
(
nullptr
),
typedef
decltype
(
cmp_help_fun
(
static_cast
<
T1
*>
(
nullptr
),
static_cast
<
T2
*>
(
nullptr
),
static_cast
<
T2
*>
(
nullptr
),
...
...
cppa/util/is_copyable.hpp
View file @
42db08af
...
@@ -10,13 +10,13 @@ class is_copyable_
...
@@ -10,13 +10,13 @@ class is_copyable_
{
{
template
<
typename
A
>
template
<
typename
A
>
static
bool
cpy_help_fun
(
const
A
*
arg0
,
decltype
(
new
A
(
*
arg0
))
=
nullptr
)
static
bool
cpy_help_fun
(
A
const
*
arg0
,
decltype
(
new
A
(
*
arg0
))
=
nullptr
)
{
{
return
true
;
return
true
;
}
}
template
<
typename
A
>
template
<
typename
A
>
static
void
cpy_help_fun
(
const
A
*
,
void
*
=
nullptr
)
{
}
static
void
cpy_help_fun
(
A
const
*
,
void
*
=
nullptr
)
{
}
typedef
decltype
(
cpy_help_fun
(
static_cast
<
T
*>
(
nullptr
),
typedef
decltype
(
cpy_help_fun
(
static_cast
<
T
*>
(
nullptr
),
static_cast
<
T
*>
(
nullptr
)))
static_cast
<
T
*>
(
nullptr
)))
...
...
cppa/util/is_iterable.hpp
View file @
42db08af
...
@@ -14,7 +14,7 @@ class is_iterable
...
@@ -14,7 +14,7 @@ class is_iterable
template
<
class
C
>
template
<
class
C
>
static
bool
sfinae_fun
static
bool
sfinae_fun
(
(
const
C
*
cc
,
C
const
*
cc
,
// check for 'C::begin()' returning a forward iterator
// check for 'C::begin()' returning a forward iterator
typename
util
::
enable_if
<
util
::
is_forward_iterator
<
decltype
(
cc
->
begin
())
>>::
type
*
=
0
,
typename
util
::
enable_if
<
util
::
is_forward_iterator
<
decltype
(
cc
->
begin
())
>>::
type
*
=
0
,
// check for 'C::end()' returning the same kind of forward iterator
// check for 'C::end()' returning the same kind of forward iterator
...
@@ -27,7 +27,7 @@ class is_iterable
...
@@ -27,7 +27,7 @@ class is_iterable
// SFNINAE default
// SFNINAE default
static
void
sfinae_fun
(...)
{
}
static
void
sfinae_fun
(...)
{
}
typedef
decltype
(
sfinae_fun
(
static_cast
<
const
T
*>
(
nullptr
)))
result_type
;
typedef
decltype
(
sfinae_fun
(
static_cast
<
T
const
*>
(
nullptr
)))
result_type
;
public:
public:
...
...
cppa/util/remove_const_reference.hpp
View file @
42db08af
...
@@ -10,7 +10,7 @@ struct remove_const_reference
...
@@ -10,7 +10,7 @@ struct remove_const_reference
};
};
template
<
typename
T
>
template
<
typename
T
>
struct
remove_const_reference
<
const
T
&>
struct
remove_const_reference
<
T
const
&>
{
{
typedef
T
type
;
typedef
T
type
;
};
};
...
...
cppa/util/ripemd_160.hpp
View file @
42db08af
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
namespace
cppa
{
namespace
util
{
namespace
cppa
{
namespace
util
{
void
ripemd_160
(
std
::
array
<
std
::
uint8_t
,
20
>&
storage
,
const
std
::
string
&
data
);
void
ripemd_160
(
std
::
array
<
std
::
uint8_t
,
20
>&
storage
,
std
::
string
const
&
data
);
}
}
// namespace cppa::util
}
}
// namespace cppa::util
...
...
cppa/util/rm_ref.hpp
View file @
42db08af
...
@@ -11,7 +11,7 @@ template<typename T>
...
@@ -11,7 +11,7 @@ template<typename T>
struct
rm_ref
{
typedef
T
type
;
};
struct
rm_ref
{
typedef
T
type
;
};
template
<
typename
T
>
template
<
typename
T
>
struct
rm_ref
<
const
T
&>
{
typedef
T
type
;
};
struct
rm_ref
<
T
const
&>
{
typedef
T
type
;
};
template
<
typename
T
>
template
<
typename
T
>
struct
rm_ref
<
T
&>
{
typedef
T
type
;
};
struct
rm_ref
<
T
&>
{
typedef
T
type
;
};
...
...
cppa/util/single_reader_queue.hpp
View file @
42db08af
...
@@ -39,7 +39,7 @@ class single_reader_queue
...
@@ -39,7 +39,7 @@ class single_reader_queue
}
}
template
<
typename
TimePoint
>
template
<
typename
TimePoint
>
element_type
*
try_pop
(
const
TimePoin
t
&
abs_time
)
element_type
*
try_pop
(
TimePoint
cons
t
&
abs_time
)
{
{
return
(
timed_wait_for_data
(
abs_time
))
?
take_head
()
:
nullptr
;
return
(
timed_wait_for_data
(
abs_time
))
?
take_head
()
:
nullptr
;
}
}
...
@@ -157,7 +157,7 @@ class single_reader_queue
...
@@ -157,7 +157,7 @@ class single_reader_queue
detail
::
condition_variable
m_cv
;
detail
::
condition_variable
m_cv
;
template
<
typename
TimePoint
>
template
<
typename
TimePoint
>
bool
timed_wait_for_data
(
const
TimePoin
t
&
timeout
)
bool
timed_wait_for_data
(
TimePoint
cons
t
&
timeout
)
{
{
if
(
!
m_head
&&
!
(
m_tail
.
load
()))
if
(
!
m_head
&&
!
(
m_tail
.
load
()))
{
{
...
...
cppa/util/type_list.hpp
View file @
42db08af
...
@@ -9,7 +9,7 @@ namespace cppa {
...
@@ -9,7 +9,7 @@ namespace cppa {
// forward declarations
// forward declarations
class
uniform_type_info
;
class
uniform_type_info
;
const
uniform_type_info
*
uniform_typeid
(
const
std
::
type_info
&
);
uniform_type_info
const
*
uniform_typeid
(
std
::
type_info
const
&
);
}
// namespace cppa
}
// namespace cppa
...
@@ -29,6 +29,8 @@ template<typename Head, typename... Tail>
...
@@ -29,6 +29,8 @@ template<typename Head, typename... Tail>
struct
type_list
<
Head
,
Tail
...
>
struct
type_list
<
Head
,
Tail
...
>
{
{
typedef
uniform_type_info
const
*
uti_ptr
;
typedef
Head
head_type
;
typedef
Head
head_type
;
typedef
type_list
<
Tail
...
>
tail_type
;
typedef
type_list
<
Tail
...
>
tail_type
;
...
@@ -40,13 +42,13 @@ struct type_list<Head, Tail...>
...
@@ -40,13 +42,13 @@ struct type_list<Head, Tail...>
init
<
type_list
>
(
m_arr
);
init
<
type_list
>
(
m_arr
);
}
}
inline
const
uniform_type_info
&
at
(
size_t
pos
)
const
inline
uniform_type_info
const
&
at
(
size_t
pos
)
const
{
{
return
*
m_arr
[
pos
];
return
*
m_arr
[
pos
];
}
}
template
<
typename
TypeList
>
template
<
typename
TypeList
>
static
void
init
(
const
uniform_type_info
*
*
what
)
static
void
init
(
uti_ptr
*
what
)
{
{
what
[
0
]
=
uniform_typeid
(
typeid
(
typename
TypeList
::
head_type
));
what
[
0
]
=
uniform_typeid
(
typeid
(
typename
TypeList
::
head_type
));
if
(
TypeList
::
size
>
1
)
if
(
TypeList
::
size
>
1
)
...
@@ -58,7 +60,7 @@ struct type_list<Head, Tail...>
...
@@ -58,7 +60,7 @@ struct type_list<Head, Tail...>
private:
private:
const
uniform_type_info
*
m_arr
[
size
];
uti_ptr
m_arr
[
size
];
};
};
...
...
cppa/util/void_type.hpp
View file @
42db08af
...
@@ -12,7 +12,7 @@ struct void_type
...
@@ -12,7 +12,7 @@ struct void_type
typedef
type_list
<>
tail_type
;
typedef
type_list
<>
tail_type
;
};
};
inline
bool
operator
==
(
const
void_type
&
,
const
void_type
&
)
{
return
true
;
}
inline
bool
operator
==
(
void_type
const
&
,
void_type
const
&
)
{
return
true
;
}
}
}
// namespace cppa::util
}
}
// namespace cppa::util
...
...
src/cppa.cpp
View file @
42db08af
...
@@ -34,17 +34,18 @@ class observer : public cppa::attachable
...
@@ -34,17 +34,18 @@ class observer : public cppa::attachable
namespace
cppa
{
namespace
cppa
{
local_actor
*
operator
<<
(
local_actor
*
whom
,
const
any_tuple
&
what
)
const
self_type
&
operator
<<
(
const
self_type
&
s
,
const
any_tuple
&
what
)
{
{
if
(
whom
)
whom
->
enqueue
(
self
,
what
);
local_actor
*
sptr
=
s
;
return
whom
;
sptr
->
enqueue
(
sptr
,
what
);
return
s
;
}
}
// matches self << make_tuple(...)
const
self_type
&
operator
<<
(
const
self_type
&
s
,
any_tuple
&&
what
)
local_actor
*
operator
<<
(
local_actor
*
whom
,
any_tuple
&&
what
)
{
{
if
(
whom
)
whom
->
enqueue
(
self
,
std
::
move
(
what
));
local_actor
*
sptr
=
s
;
return
whom
;
sptr
->
enqueue
(
sptr
,
std
::
move
(
what
));
return
s
;
}
}
void
link
(
actor_ptr
&
other
)
void
link
(
actor_ptr
&
other
)
...
...
src/invoke_rules.cpp
View file @
42db08af
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, 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/invoke.hpp"
#include "cppa/invoke.hpp"
#include "cppa/invoke_rules.hpp"
#include "cppa/invoke_rules.hpp"
#include "cppa/util/duration.hpp"
#include "cppa/util/duration.hpp"
...
...
unit_testing/ping_pong.cpp
View file @
42db08af
...
@@ -25,7 +25,7 @@ void ping()
...
@@ -25,7 +25,7 @@ void ping()
{
{
++
s_pongs
;
++
s_pongs
;
get_ref
<
1
>
(
response
)
=
value
+
1
;
get_ref
<
1
>
(
response
)
=
value
+
1
;
reply_tuple
(
response
)
;
last_sender
()
<<
response
;
}
}
);
);
}
}
...
@@ -35,7 +35,7 @@ void pong(actor_ptr ping_actor)
...
@@ -35,7 +35,7 @@ void pong(actor_ptr ping_actor)
link
(
ping_actor
);
link
(
ping_actor
);
auto
pong_tuple
=
make_tuple
(
atom
(
"Pong"
),
0
);
auto
pong_tuple
=
make_tuple
(
atom
(
"Pong"
),
0
);
// kickoff
// kickoff
send_tuple
(
ping_actor
,
pong_tuple
)
;
ping_actor
<<
pong_tuple
;
// invoke rules
// invoke rules
receive_loop
receive_loop
(
(
...
@@ -48,7 +48,7 @@ void pong(actor_ptr ping_actor)
...
@@ -48,7 +48,7 @@ void pong(actor_ptr ping_actor)
on
<
atom
(
"Ping"
),
int
>
()
>>
[
&
](
int
value
)
on
<
atom
(
"Ping"
),
int
>
()
>>
[
&
](
int
value
)
{
{
get_ref
<
1
>
(
pong_tuple
)
=
value
+
1
;
get_ref
<
1
>
(
pong_tuple
)
=
value
+
1
;
reply_tuple
(
pong_tuple
)
;
last_sender
()
<<
pong_tuple
;
}
}
);
);
}
}
...
...
unit_testing/test__pattern.cpp
View file @
42db08af
...
@@ -83,7 +83,7 @@ size_t test__pattern()
...
@@ -83,7 +83,7 @@ size_t test__pattern()
CPPA_CHECK_EQUAL
(
value
,
1
);
CPPA_CHECK_EQUAL
(
value
,
1
);
lambda_invoked
[
4
]
=
true
;
lambda_invoked
[
4
]
=
true
;
},
},
on_arg_match
()
>>
[
&
](
double
v1
,
const
float
&
v2
)
on_arg_match
>>
[
&
](
double
v1
,
const
float
&
v2
)
{
{
CPPA_CHECK_EQUAL
(
v1
,
1.0
);
CPPA_CHECK_EQUAL
(
v1
,
1.0
);
CPPA_CHECK_EQUAL
(
v2
,
2.0
f
);
CPPA_CHECK_EQUAL
(
v2
,
2.0
f
);
...
...
unit_testing/test__spawn.cpp
View file @
42db08af
...
@@ -335,7 +335,6 @@ size_t test__spawn()
...
@@ -335,7 +335,6 @@ size_t test__spawn()
// link(my_link, spawn(new event_testee));
// link(my_link, spawn(new event_testee));
// }
// }
// send(my_link, atom(":Exit"), exit_reason::user_defined);
// send(my_link, atom(":Exit"), exit_reason::user_defined);
return
CPPA_TEST_RESULT
;
return
CPPA_TEST_RESULT
;
...
...
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