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
db48145f
Commit
db48145f
authored
Jun 28, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
maintenance
parent
6cbdec38
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
103 additions
and
140 deletions
+103
-140
cppa/any_tuple.hpp
cppa/any_tuple.hpp
+25
-28
cppa/detail/abstract_tuple.hpp
cppa/detail/abstract_tuple.hpp
+2
-2
cppa/detail/to_uniform_name.hpp
cppa/detail/to_uniform_name.hpp
+3
-0
cppa/detail/uniform_type_info_map.hpp
cppa/detail/uniform_type_info_map.hpp
+0
-2
src/any_tuple.cpp
src/any_tuple.cpp
+7
-12
src/self.cpp
src/self.cpp
+3
-3
src/shared_spinlock.cpp
src/shared_spinlock.cpp
+0
-13
src/string_serialization.cpp
src/string_serialization.cpp
+14
-10
src/uniform_type_info.cpp
src/uniform_type_info.cpp
+49
-70
No files found.
cppa/any_tuple.hpp
View file @
db48145f
...
...
@@ -38,6 +38,7 @@
#include "cppa/cow_tuple.hpp"
#include "cppa/util/rm_ref.hpp"
#include "cppa/util/comparable.hpp"
#include "cppa/util/is_iterable.hpp"
#include "cppa/detail/tuple_view.hpp"
...
...
@@ -55,6 +56,7 @@ class any_tuple {
public:
typedef
cow_ptr
<
detail
::
abstract_tuple
>
value_ptr
;
typedef
detail
::
abstract_tuple
::
const_iterator
const_iterator
;
/**
...
...
@@ -74,8 +76,6 @@ class any_tuple {
template
<
typename
...
Args
>
any_tuple
(
cow_tuple
<
Args
...
>&&
t
)
:
m_vals
(
std
::
move
(
t
.
m_vals
))
{
}
explicit
any_tuple
(
detail
::
abstract_tuple
*
);
/**
* @brief Move constructor.
*/
...
...
@@ -143,9 +143,9 @@ class any_tuple {
inline
const_iterator
end
()
const
{
return
m_vals
->
end
();
}
inline
cow_ptr
<
detail
::
abstract_tuple
>&
vals
()
{
return
m_vals
;
}
inline
const
cow_ptr
<
detail
::
abstract_tuple
>&
vals
()
const
{
return
m_vals
;
}
inline
const
cow_ptr
<
detail
::
abstract_tuple
>
&
cvals
()
const
{
return
m_vals
;
}
inline
value_ptr
&
vals
()
{
return
m_vals
;
}
inline
const
value_ptr
&
vals
()
const
{
return
m_vals
;
}
inline
const
value_ptr
&
cvals
()
const
{
return
m_vals
;
}
inline
const
std
::
type_info
*
type_token
()
const
{
return
m_vals
->
type_token
();
...
...
@@ -179,66 +179,63 @@ class any_tuple {
typedef
typename
detail
::
implicit_conversions
<
vtype
>::
type
converted
;
static_assert
(
util
::
is_legal_tuple_type
<
converted
>::
value
,
"T is not a valid tuple type"
);
typedef
typename
std
::
remove_reference
<
T
>::
type
plain_type
;
static
constexpr
bool
can_optimize
=
std
::
is_same
<
converted
,
vtype
>::
value
&&
std
::
is_reference
<
T
>::
value
&&
!
std
::
is_const
<
typename
std
::
remove_reference
<
T
>::
type
>::
value
;
&&
!
std
::
is_const
<
plain_
type
>::
value
;
std
::
integral_constant
<
bool
,
can_optimize
>
token
;
return
any_tuple
{
simple_view
(
std
::
forward
<
T
>
(
value
),
token
)};
}
void
force_detach
()
{
m_vals
.
detach
();
}
inline
void
force_detach
()
{
m_vals
.
detach
();
}
void
reset
();
explicit
any_tuple
(
detail
::
abstract_tuple
*
);
private:
cow_ptr
<
detail
::
abstract_tuple
>
m_vals
;
value_ptr
m_vals
;
explicit
any_tuple
(
const
cow_ptr
<
detail
::
abstract_tuple
>
&
vals
);
explicit
any_tuple
(
const
value_ptr
&
vals
);
typedef
detail
::
abstract_tuple
*
tup
_ptr
;
typedef
detail
::
abstract_tuple
*
abstract
_ptr
;
template
<
typename
T
>
static
inline
tup_ptr
simple_view
(
T
&
value
,
std
::
integral_constant
<
bool
,
true
>
)
{
static
inline
abstract_ptr
simple_view
(
T
&
value
,
std
::
true_type
)
{
return
new
detail
::
tuple_view
<
T
>
(
&
value
);
}
template
<
typename
First
,
typename
Second
>
static
inline
tup
_ptr
simple_view
(
std
::
pair
<
First
,
Second
>&
p
,
std
::
integral_constant
<
bool
,
true
>
)
{
static
inline
abstract
_ptr
simple_view
(
std
::
pair
<
First
,
Second
>&
p
,
std
::
true_type
)
{
return
new
detail
::
tuple_view
<
First
,
Second
>
(
&
p
.
first
,
&
p
.
second
);
}
template
<
typename
T
>
static
inline
tup_ptr
simple_view
(
T
&&
value
,
std
::
integral_constant
<
bool
,
false
>
)
{
static
inline
abstract_ptr
simple_view
(
T
&&
value
,
std
::
false_type
)
{
typedef
typename
util
::
rm_ref
<
T
>::
type
vtype
;
typedef
typename
detail
::
implicit_conversions
<
vtype
>::
type
converted
;
return
new
detail
::
tuple_vals
<
converted
>
(
std
::
forward
<
T
>
(
value
));
}
template
<
typename
First
,
typename
Second
>
static
inline
any_tuple
view
(
std
::
pair
<
First
,
Second
>
p
,
std
::
integral_constant
<
bool
,
false
>
)
{
static
inline
any_tuple
view
(
std
::
pair
<
First
,
Second
>
p
,
std
::
false_type
)
{
return
new
detail
::
tuple_vals
<
First
,
Second
>
(
std
::
move
(
p
.
first
),
std
::
move
(
p
.
second
));
}
template
<
typename
T
>
static
inline
detail
::
abstract_tuple
*
container_view
(
T
&
value
,
std
::
integral_constant
<
bool
,
true
>
)
{
static
inline
abstract_ptr
container_view
(
T
&
value
,
std
::
true_type
)
{
return
new
detail
::
container_tuple_view
<
T
>
(
&
value
);
}
template
<
typename
T
>
static
inline
detail
::
abstract_tuple
*
container_view
(
T
&&
value
,
std
::
integral_constant
<
bool
,
false
>
)
{
static
inline
abstract_ptr
container_view
(
T
&&
value
,
std
::
false_type
)
{
typedef
typename
util
::
rm_ref
<
T
>::
type
ctype
;
return
new
detail
::
container_tuple_view
<
T
>
(
new
ctype
(
std
::
forward
<
T
>
(
value
)),
true
);
auto
cptr
=
new
ctype
(
std
::
forward
<
T
>
(
value
));
return
new
detail
::
container_tuple_view
<
T
>
(
cptr
,
true
);
}
};
...
...
cppa/detail/abstract_tuple.hpp
View file @
db48145f
cppa/detail/to_uniform_name.hpp
View file @
db48145f
...
...
@@ -39,6 +39,9 @@ namespace cppa { namespace detail {
std
::
string
to_uniform_name
(
const
std
::
string
&
demangled_name
);
std
::
string
to_uniform_name
(
const
std
::
type_info
&
tinfo
);
template
<
class
T
>
inline
std
::
string
to_uniform_name
()
{
return
to_uniform_name
(
typeid
(
T
));
}
}
}
// namespace cppa::detail
#endif // CPPA_TO_UNIFORM_NAME_HPP
cppa/detail/uniform_type_info_map.hpp
View file @
db48145f
...
...
@@ -84,8 +84,6 @@ class uniform_type_info_map {
// maps sizeof(-integer_type-) to { signed-names-set, unsigned-names-set }
int_map
m_ints
;
};
}
}
// namespace cppa::detail
...
...
src/any_tuple.cpp
View file @
db48145f
...
...
@@ -32,28 +32,23 @@
#include "cppa/detail/empty_tuple.hpp"
#include "cppa/detail/singleton_manager.hpp"
namespace
{
namespace
cppa
{
inline
cppa
::
detail
::
empty_tuple
*
s_empty_tuple
()
{
return
cppa
::
detail
::
singleton_manager
::
get_empty_tuple
();
namespace
{
inline
detail
::
empty_tuple
*
s_empty_tuple
()
{
return
detail
::
singleton_manager
::
get_empty_tuple
();
}
}
// namespace <anonymous>
namespace
cppa
{
any_tuple
::
any_tuple
()
:
m_vals
(
s_empty_tuple
())
{
}
any_tuple
::
any_tuple
()
:
m_vals
(
s_empty_tuple
())
{
}
any_tuple
::
any_tuple
(
detail
::
abstract_tuple
*
ptr
)
:
m_vals
(
ptr
)
{
}
any_tuple
::
any_tuple
(
detail
::
abstract_tuple
*
ptr
)
:
m_vals
(
ptr
)
{
}
any_tuple
::
any_tuple
(
any_tuple
&&
other
)
:
m_vals
(
s_empty_tuple
())
{
m_vals
.
swap
(
other
.
m_vals
);
}
any_tuple
::
any_tuple
(
const
cow_ptr
<
detail
::
abstract_tuple
>&
vals
)
:
m_vals
(
vals
)
{
}
any_tuple
::
any_tuple
(
const
value_ptr
&
vals
)
:
m_vals
(
vals
)
{
}
any_tuple
&
any_tuple
::
operator
=
(
any_tuple
&&
other
)
{
m_vals
.
swap
(
other
.
m_vals
);
...
...
src/self.cpp
View file @
db48145f
...
...
@@ -38,14 +38,14 @@
#include "cppa/local_actor.hpp"
#include "cppa/thread_mapped_actor.hpp"
namespace
cppa
{
namespace
{
boost
::
thread_specific_ptr
<
cppa
::
local_actor
>
t_this_actor
(
&
cppa
::
self_type
::
cleanup_fun
);
boost
::
thread_specific_ptr
<
local_actor
>
t_this_actor
(
&
self_type
::
cleanup_fun
);
}
// namespace <anonymous>
namespace
cppa
{
void
self_type
::
cleanup_fun
(
cppa
::
local_actor
*
what
)
{
if
(
what
)
{
auto
ptr
=
dynamic_cast
<
thread_mapped_actor
*>
(
what
);
...
...
src/shared_spinlock.cpp
View file @
db48145f
...
...
@@ -63,19 +63,6 @@ void shared_spinlock::lock() {
void
shared_spinlock
::
lock_upgrade
()
{
unlock_shared
();
lock
();
/*
long v = m_flag.load();
for (;;) {
if (v != 1) {
//std::this_thread::yield();
v = m_flag.load();
}
else if (m_flag.compare_exchange_weak(v, min_long)) {
return;
}
// else: next iteration
}
*/
}
void
shared_spinlock
::
unlock
()
{
...
...
src/string_serialization.cpp
View file @
db48145f
...
...
@@ -136,7 +136,8 @@ class string_serializer : public serializer {
throw
std
::
runtime_error
(
"expected uint64 value after @atom"
);
}
// write atoms as strings instead of integer values
auto
av
=
static_cast
<
atom_value
>
(
get
<
std
::
uint64_t
>
(
value
));
(
pt_writer
(
out
))(
to_string
(
av
));
auto
av
=
static_cast
<
atom_value
>
(
get
<
std
::
uint64_t
>
(
value
));
(
pt_writer
(
out
))(
to_string
(
av
));
}
else
{
value
.
apply
(
pt_writer
(
out
));
...
...
@@ -207,8 +208,12 @@ class string_deserializer : public deserializer {
case
'{'
:
case
'}'
:
case
' '
:
case
','
:
return
true
;
default
:
return
false
;
case
','
:
{
return
true
;
}
default:
{
return
false
;
}
}
});
}
...
...
@@ -284,8 +289,7 @@ class string_deserializer : public deserializer {
size_t
begin_sequence
()
{
integrity_check
();
consume
(
'{'
);
auto
list_end
=
std
::
find
(
m_pos
,
m_str
.
end
(),
'}'
);
return
std
::
count
(
m_pos
,
list_end
,
','
)
+
1
;
return
std
::
count
(
m_pos
,
std
::
find
(
m_pos
,
m_str
.
end
(),
'}'
),
','
)
+
1
;
}
void
end_sequence
()
{
...
...
src/uniform_type_info.cpp
View file @
db48145f
This diff is collapsed.
Click to expand it.
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