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
8ef9851e
Commit
8ef9851e
authored
Jun 26, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build on CentOS 3.10, close #705
parent
f793d7ed
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
82 additions
and
30 deletions
+82
-30
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+1
-0
libcaf_core/caf/detail/append_hex.hpp
libcaf_core/caf/detail/append_hex.hpp
+29
-0
libcaf_core/caf/detail/stringification_inspector.hpp
libcaf_core/caf/detail/stringification_inspector.hpp
+4
-4
libcaf_core/caf/intrusive_ptr.hpp
libcaf_core/caf/intrusive_ptr.hpp
+6
-8
libcaf_core/src/append_hex.cpp
libcaf_core/src/append_hex.cpp
+40
-0
libcaf_core/src/node_id.cpp
libcaf_core/src/node_id.cpp
+2
-3
libcaf_core/src/stringification_inspector.cpp
libcaf_core/src/stringification_inspector.cpp
+0
-15
No files found.
libcaf_core/CMakeLists.txt
View file @
8ef9851e
...
@@ -28,6 +28,7 @@ set(LIBCAF_CORE_SRCS
...
@@ -28,6 +28,7 @@ set(LIBCAF_CORE_SRCS
src/actor_registry.cpp
src/actor_registry.cpp
src/actor_system.cpp
src/actor_system.cpp
src/actor_system_config.cpp
src/actor_system_config.cpp
src/append_hex.cpp
src/atom.cpp
src/atom.cpp
src/attachable.cpp
src/attachable.cpp
src/behavior.cpp
src/behavior.cpp
...
...
libcaf_core/caf/detail/append_hex.hpp
0 → 100644
View file @
8ef9851e
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#pragma once
#include <string>
namespace
caf
{
namespace
detail
{
void
append_hex
(
std
::
string
&
result
,
const
uint8_t
*
xs
,
size_t
n
);
}
// namespace detail
}
// namespace caf
libcaf_core/caf/detail/stringification_inspector.hpp
View file @
8ef9851e
...
@@ -35,8 +35,9 @@
...
@@ -35,8 +35,9 @@
#include "caf/meta/omittable_if_none.hpp"
#include "caf/meta/omittable_if_none.hpp"
#include "caf/meta/omittable_if_empty.hpp"
#include "caf/meta/omittable_if_empty.hpp"
#include "caf/detail/
int_list
.hpp"
#include "caf/detail/
append_hex
.hpp"
#include "caf/detail/apply_args.hpp"
#include "caf/detail/apply_args.hpp"
#include "caf/detail/int_list.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/detail/type_traits.hpp"
namespace
caf
{
namespace
caf
{
...
@@ -74,8 +75,6 @@ public:
...
@@ -74,8 +75,6 @@ public:
void
consume
(
const
char
*
cstr
);
void
consume
(
const
char
*
cstr
);
void
consume_hex
(
const
uint8_t
*
xs
,
size_t
n
);
inline
void
consume
(
bool
&
x
)
{
inline
void
consume
(
bool
&
x
)
{
result_
+=
x
?
"true"
:
"false"
;
result_
+=
x
?
"true"
:
"false"
;
}
}
...
@@ -252,7 +251,8 @@ public:
...
@@ -252,7 +251,8 @@ public:
template
<
class
T
,
class
...
Ts
>
template
<
class
T
,
class
...
Ts
>
void
traverse
(
meta
::
hex_formatted_t
,
T
&
x
,
Ts
&&
...
xs
)
{
void
traverse
(
meta
::
hex_formatted_t
,
T
&
x
,
Ts
&&
...
xs
)
{
sep
();
sep
();
consume_hex
(
reinterpret_cast
<
uint8_t
*>
(
deconst
(
x
).
data
()),
x
.
size
());
append_hex
(
result_
,
reinterpret_cast
<
uint8_t
*>
(
deconst
(
x
).
data
()),
x
.
size
());
traverse
(
std
::
forward
<
Ts
>
(
xs
)...);
traverse
(
std
::
forward
<
Ts
>
(
xs
)...);
}
}
...
...
libcaf_core/caf/intrusive_ptr.hpp
View file @
8ef9851e
...
@@ -18,13 +18,13 @@
...
@@ -18,13 +18,13 @@
#pragma once
#pragma once
#include <string>
#include <cstddef>
#include <cinttypes>
#include <algorithm>
#include <algorithm>
#include <cstddef>
#include <stdexcept>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <type_traits>
#include "caf/detail/append_hex.hpp"
#include "caf/detail/comparable.hpp"
#include "caf/detail/comparable.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/detail/type_traits.hpp"
...
@@ -246,12 +246,10 @@ bool operator<(const T* x, const intrusive_ptr<T>& y) {
...
@@ -246,12 +246,10 @@ bool operator<(const T* x, const intrusive_ptr<T>& y) {
template
<
class
T
>
template
<
class
T
>
std
::
string
to_string
(
const
intrusive_ptr
<
T
>&
x
)
{
std
::
string
to_string
(
const
intrusive_ptr
<
T
>&
x
)
{
std
::
string
result
;
auto
v
=
reinterpret_cast
<
uintptr_t
>
(
x
.
get
());
auto
v
=
reinterpret_cast
<
uintptr_t
>
(
x
.
get
());
// we convert to hex representation, i.e.,
detail
::
append_hex
(
result
,
reinterpret_cast
<
uint8_t
*>
(
&
v
),
sizeof
(
v
));
// one byte takes two characters + null terminator + "0x" prefix
return
result
;
char
buf
[
sizeof
(
v
)
*
2
+
3
];
sprintf
(
buf
,
"%"
PRIxPTR
,
v
);
return
buf
;
}
}
}
// namespace caf
}
// namespace caf
...
...
libcaf_core/src/append_hex.cpp
0 → 100644
View file @
8ef9851e
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/detail/stringification_inspector.hpp"
namespace
caf
{
namespace
detail
{
void
append_hex
(
std
::
string
&
result
,
const
uint8_t
*
xs
,
size_t
n
)
{
if
(
n
==
0
)
{
result
+=
"00"
;
return
;
}
auto
tbl
=
"0123456789ABCDEF"
;
char
buf
[
3
]
=
{
0
,
0
,
0
};
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
auto
c
=
xs
[
i
];
buf
[
0
]
=
tbl
[
c
>>
4
];
buf
[
1
]
=
tbl
[
c
&
0x0F
];
result
+=
buf
;
}
}
}
// namespace detail
}
// namespace caf
libcaf_core/src/node_id.cpp
View file @
8ef9851e
...
@@ -188,9 +188,8 @@ void append_to_string(std::string& x, const node_id& y) {
...
@@ -188,9 +188,8 @@ void append_to_string(std::string& x, const node_id& y) {
x
+=
"invalid-node"
;
x
+=
"invalid-node"
;
return
;
return
;
}
}
detail
::
stringification_inspector
si
{
x
};
detail
::
append_hex
(
x
,
reinterpret_cast
<
const
uint8_t
*>
(
y
.
host_id
().
data
()),
si
.
consume_hex
(
reinterpret_cast
<
const
uint8_t
*>
(
y
.
host_id
().
data
()),
y
.
host_id
().
size
());
y
.
host_id
().
size
());
x
+=
'#'
;
x
+=
'#'
;
x
+=
std
::
to_string
(
y
.
process_id
());
x
+=
std
::
to_string
(
y
.
process_id
());
}
}
...
...
libcaf_core/src/stringification_inspector.cpp
View file @
8ef9851e
...
@@ -70,20 +70,5 @@ void stringification_inspector::consume(const char* cstr) {
...
@@ -70,20 +70,5 @@ void stringification_inspector::consume(const char* cstr) {
result_
+=
'"'
;
result_
+=
'"'
;
}
}
void
stringification_inspector
::
consume_hex
(
const
uint8_t
*
xs
,
size_t
n
)
{
if
(
n
==
0
)
{
result_
+=
"00"
;
return
;
}
auto
tbl
=
"0123456789ABCDEF"
;
char
buf
[
3
]
=
{
0
,
0
,
0
};
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
auto
c
=
xs
[
i
];
buf
[
0
]
=
tbl
[
c
>>
4
];
buf
[
1
]
=
tbl
[
c
&
0x0F
];
result_
+=
buf
;
}
}
}
// namespace detail
}
// namespace detail
}
// namespace caf
}
// namespace caf
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