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
b875a772
Unverified
Commit
b875a772
authored
Aug 04, 2021
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include review feedback
parent
86cdab59
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
37 additions
and
21 deletions
+37
-21
libcaf_core/caf/binary_deserializer.hpp
libcaf_core/caf/binary_deserializer.hpp
+2
-2
libcaf_core/caf/byte.hpp
libcaf_core/caf/byte.hpp
+16
-1
libcaf_core/caf/deserializer.hpp
libcaf_core/caf/deserializer.hpp
+3
-3
libcaf_core/caf/detail/message_builder_element.hpp
libcaf_core/caf/detail/message_builder_element.hpp
+2
-2
libcaf_core/caf/serializer.hpp
libcaf_core/caf/serializer.hpp
+3
-3
libcaf_core/src/json_reader.cpp
libcaf_core/src/json_reader.cpp
+1
-1
libcaf_core/src/json_writer.cpp
libcaf_core/src/json_writer.cpp
+1
-1
libcaf_core/src/uuid.cpp
libcaf_core/src/uuid.cpp
+6
-5
libcaf_core/test/uuid.cpp
libcaf_core/test/uuid.cpp
+1
-1
libcaf_io/caf/io/abstract_broker.hpp
libcaf_io/caf/io/abstract_broker.hpp
+1
-1
libcaf_io/src/io/network/test_multiplexer.cpp
libcaf_io/src/io/network/test_multiplexer.cpp
+1
-1
No files found.
libcaf_core/caf/binary_deserializer.hpp
View file @
b875a772
...
...
@@ -64,7 +64,7 @@ public:
return
static_cast
<
size_t
>
(
end_
-
current_
);
}
/// Returns the remaining
std::
bytes.
/// Returns the remaining bytes.
span
<
const
std
::
byte
>
remainder
()
const
noexcept
{
return
make_span
(
current_
,
end_
);
}
...
...
@@ -203,7 +203,7 @@ public:
private:
explicit
binary_deserializer
(
actor_system
&
sys
)
noexcept
;
/// Checks whether we can read `read_size` more
std::
bytes.
/// Checks whether we can read `read_size` more bytes.
bool
range_check
(
size_t
read_size
)
const
noexcept
{
return
current_
+
read_size
<=
end_
;
}
...
...
libcaf_core/caf/byte.hpp
View file @
b875a772
// Deprecated include. The next CAF release won't include this header.
#include <cstddef>
#include <type_traits>
#pragma once
namespace
caf
{
template
<
class
IntegerType
,
class
=
std
::
enable_if_t
<
std
::
is_integral
<
IntegerType
>
::
value
>>
constexpr
IntegerType
to_integer
(
std
::
byte
x
)
noexcept
{
return
static_cast
<
IntegerType
>
(
x
);
}
}
// namespace caf
libcaf_core/caf/deserializer.hpp
View file @
b875a772
...
...
@@ -184,8 +184,8 @@ public:
/// @copydoc value
virtual
bool
value
(
std
::
u32string
&
)
=
0
;
/// Reads a
std::
byte sequence from the input.
/// @param x The
std::
byte sequence.
/// Reads a byte sequence from the input.
/// @param x The byte sequence.
/// @returns A non-zero error code on failure, `sec::success` otherwise.
virtual
bool
value
(
span
<
std
::
byte
>
x
)
=
0
;
...
...
@@ -193,7 +193,7 @@ public:
/// Adds each boolean in `xs` to the output. Derived classes can override this
/// member function to pack the booleans, for example to avoid using one
///
std::
byte for each value in a binary output format.
/// byte for each value in a binary output format.
virtual
bool
list
(
std
::
vector
<
bool
>&
xs
);
protected:
...
...
libcaf_core/caf/detail/message_builder_element.hpp
View file @
b875a772
...
...
@@ -21,13 +21,13 @@ public:
/// Uses placement new to create a copy of the wrapped value at given memory
/// region.
/// @returns the past-the-end pointer of the object, i.e., the first
std::
byte
/// @returns the past-the-end pointer of the object, i.e., the first byte
/// for
/// the *next* object.
virtual
std
::
byte
*
copy_init
(
std
::
byte
*
storage
)
const
=
0
;
/// Uses placement new to move the wrapped value to given memory region.
/// @returns the past-the-end pointer of the object, i.e., the first
std::
byte
/// @returns the past-the-end pointer of the object, i.e., the first byte
/// for
/// the *next* object.
virtual
std
::
byte
*
move_init
(
std
::
byte
*
storage
)
=
0
;
...
...
libcaf_core/caf/serializer.hpp
View file @
b875a772
...
...
@@ -156,8 +156,8 @@ public:
/// @copydoc value
virtual
bool
value
(
const
std
::
u32string
&
x
)
=
0
;
/// Adds `x` as raw
std::
byte block to the output.
/// @param x The
std::
byte sequence.
/// Adds `x` as raw byte block to the output.
/// @param x The byte sequence.
/// @returns A non-zero error code on failure, `sec::success` otherwise.
virtual
bool
value
(
span
<
const
std
::
byte
>
x
)
=
0
;
...
...
@@ -165,7 +165,7 @@ public:
/// Adds each boolean in `xs` to the output. Derived classes can override this
/// member function to pack the booleans, for example to avoid using one
///
std::
byte for each value in a binary output format.
/// byte for each value in a binary output format.
virtual
bool
list
(
const
std
::
vector
<
bool
>&
xs
);
protected:
...
...
libcaf_core/src/json_reader.cpp
View file @
b875a772
...
...
@@ -603,7 +603,7 @@ bool json_reader::value(std::u32string&) {
bool
json_reader
::
value
(
span
<
std
::
byte
>
)
{
emplace_error
(
sec
::
runtime_error
,
class_name
,
__func__
,
"
std::
byte span support not implemented yet"
);
"byte span support not implemented yet"
);
return
false
;
}
...
...
libcaf_core/src/json_writer.cpp
View file @
b875a772
...
...
@@ -289,7 +289,7 @@ bool json_writer::end_associative_array() {
}
bool
json_writer
::
value
(
std
::
byte
x
)
{
return
number
(
st
atic_cast
<
uint8_t
>
(
x
));
return
number
(
st
d
::
to_integer
<
uint8_t
>
(
x
));
}
bool
json_writer
::
value
(
bool
x
)
{
...
...
libcaf_core/src/uuid.cpp
View file @
b875a772
...
...
@@ -67,11 +67,11 @@ uuid::variant_field variant_table[] = {
}
// namespace
uuid
::
variant_field
uuid
::
variant
()
const
noexcept
{
return
variant_table
[
st
atic_cast
<
size_t
>
(
bytes_
[
8
])
>>
5
];
return
variant_table
[
st
d
::
to_integer
<
size_t
>
(
bytes_
[
8
])
>>
5
];
}
uuid
::
version_field
uuid
::
version
()
const
noexcept
{
return
static_cast
<
version_field
>
(
st
atic_cast
<
int
>
(
bytes_
[
6
])
>>
4
);
return
static_cast
<
version_field
>
(
st
d
::
to_integer
<
int
>
(
bytes_
[
6
])
>>
4
);
}
uint64_t
uuid
::
timestamp
()
const
noexcept
{
...
...
@@ -84,7 +84,7 @@ uint64_t uuid::timestamp() const noexcept {
ts
[
0
]
&=
std
::
byte
{
0x0F
};
uint64_t
result
;
memcpy
(
&
result
,
ts
,
8
);
// UUIDs are stored in network
std::
byte order.
// UUIDs are stored in network byte order.
return
detail
::
from_network_order
(
result
);
}
...
...
@@ -95,7 +95,7 @@ uint16_t uuid::clock_sequence() const noexcept {
cs
[
0
]
&=
std
::
byte
{
0x3F
};
uint16_t
result
;
memcpy
(
&
result
,
cs
,
2
);
// UUIDs are stored in network
std::
byte order.
// UUIDs are stored in network byte order.
return
detail
::
from_network_order
(
result
);
}
...
...
@@ -153,7 +153,8 @@ parse_result parse_impl(string_parser_state& ps, uuid::array_type& x) noexcept {
// Check whether the bytes form a valid UUID.
if
(
memcmp
(
x
.
data
(),
nil_bytes
,
16
)
==
0
)
return
valid_uuid
;
if
(
auto
subtype
=
static_cast
<
long
>
(
x
[
6
])
>>
4
;
subtype
==
0
||
subtype
>
5
)
if
(
auto
subtype
=
std
::
to_integer
<
long
>
(
x
[
6
])
>>
4
;
subtype
==
0
||
subtype
>
5
)
return
invalid_version
;
return
valid_uuid
;
}
...
...
libcaf_core/test/uuid.cpp
View file @
b875a772
...
...
@@ -59,7 +59,7 @@ CAF_TEST_FIXTURE_SCOPE(uuid_tests, fixture)
CAF_TEST
(
default
generated
UUIDs
have
all
128
bits
set
to
zero
)
{
uuid
nil
;
CAF_CHECK
(
!
nil
);
auto
zero
=
[](
std
::
byte
x
)
{
return
st
atic_cast
<
int
>
(
x
)
==
0
;
};
auto
zero
=
[](
std
::
byte
x
)
{
return
st
d
::
to_integer
<
int
>
(
x
)
==
0
;
};
CAF_CHECK
(
std
::
all_of
(
nil
.
bytes
().
begin
(),
nil
.
bytes
().
end
(),
zero
));
CAF_CHECK
(
nil
==
uuid
::
nil
());
}
...
...
libcaf_io/caf/io/abstract_broker.hpp
View file @
b875a772
...
...
@@ -38,7 +38,7 @@ class middleman;
///
/// Brokers do *not* operate on sockets or other platform-dependent
/// communication primitives. Instead, brokers use a `connection_handle`
/// to identify a reliable, end-to-end
std::
byte stream (e.g. a TCP connection)
/// to identify a reliable, end-to-end byte stream (e.g. a TCP connection)
/// and `accept_handle` to identify a communication endpoint others can
/// connect to via its port.
///
...
...
libcaf_io/src/io/network/test_multiplexer.cpp
View file @
b875a772
...
...
@@ -889,7 +889,7 @@ bool test_multiplexer::read_data(datagram_handle hdl) {
CAF_ASSERT
(
to
.
second
.
capacity
()
>
from
.
second
.
size
());
to
.
second
.
resize
(
from
.
second
.
size
());
std
::
transform
(
from
.
second
.
begin
(),
from
.
second
.
end
(),
to
.
second
.
begin
(),
[](
std
::
byte
x
)
{
return
st
atic_cast
<
char
>
(
x
);
});
[](
std
::
byte
x
)
{
return
st
d
::
to_integer
<
char
>
(
x
);
});
data
->
vn_buf
.
pop_front
();
auto
sitr
=
datagram_data_
.
find
(
data
->
rd_buf
.
first
);
if
(
sitr
==
datagram_data_
.
end
())
{
...
...
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