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
ae804711
Commit
ae804711
authored
Nov 18, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dead code
parent
075992dc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
146 deletions
+0
-146
libcaf_core/src/detail/serialized_size.cpp
libcaf_core/src/detail/serialized_size.cpp
+0
-146
No files found.
libcaf_core/src/detail/serialized_size.cpp
deleted
100644 → 0
View file @
075992dc
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2019 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/serialized_size.hpp"
#include <iomanip>
#include <sstream>
namespace
caf
::
detail
{
error
serialized_size_inspector
::
begin_object
(
uint16_t
&
nr
,
std
::
string
&
name
)
{
if
(
nr
!=
0
)
return
apply
(
nr
);
if
(
auto
err
=
apply
(
nr
))
return
err
;
return
apply
(
name
);
}
error
serialized_size_inspector
::
end_object
()
{
return
none
;
}
error
serialized_size_inspector
::
begin_sequence
(
size_t
&
list_size
)
{
// Use varbyte encoding to compress sequence size on the wire.
// For 64-bit values, the encoded representation cannot get larger than 10
// bytes. A scratch space of 16 bytes suffices as upper bound.
uint8_t
buf
[
16
];
auto
i
=
buf
;
auto
x
=
static_cast
<
uint32_t
>
(
list_size
);
while
(
x
>
0x7f
)
{
*
i
++
=
(
static_cast
<
uint8_t
>
(
x
)
&
0x7f
)
|
0x80
;
x
>>=
7
;
}
*
i
++
=
static_cast
<
uint8_t
>
(
x
)
&
0x7f
;
apply_raw
(
static_cast
<
size_t
>
(
i
-
buf
),
buf
);
return
none
;
}
error
serialized_size_inspector
::
end_sequence
()
{
return
none
;
}
error
serialized_size_inspector
::
apply_raw
(
size_t
num_bytes
,
void
*
)
{
result_
+=
num_bytes
;
return
none
;
}
error
serialized_size_inspector
::
apply_impl
(
int8_t
&
x
)
{
result_
+=
sizeof
(
x
);
return
none
;
}
error
serialized_size_inspector
::
apply_impl
(
uint8_t
&
x
)
{
result_
+=
sizeof
(
x
);
return
none
;
}
error
serialized_size_inspector
::
apply_impl
(
int16_t
&
x
)
{
result_
+=
sizeof
(
x
);
return
none
;
}
error
serialized_size_inspector
::
apply_impl
(
uint16_t
&
x
)
{
result_
+=
sizeof
(
x
);
return
none
;
}
error
serialized_size_inspector
::
apply_impl
(
int32_t
&
x
)
{
result_
+=
sizeof
(
x
);
return
none
;
}
error
serialized_size_inspector
::
apply_impl
(
uint32_t
&
x
)
{
result_
+=
sizeof
(
x
);
return
none
;
}
error
serialized_size_inspector
::
apply_impl
(
int64_t
&
x
)
{
result_
+=
sizeof
(
x
);
return
none
;
}
error
serialized_size_inspector
::
apply_impl
(
uint64_t
&
x
)
{
result_
+=
sizeof
(
x
);
return
none
;
}
error
serialized_size_inspector
::
apply_impl
(
float
&
x
)
{
result_
+=
sizeof
(
x
);
return
none
;
}
error
serialized_size_inspector
::
apply_impl
(
double
&
x
)
{
result_
+=
sizeof
(
x
);
return
none
;
}
error
serialized_size_inspector
::
apply_impl
(
long
double
&
x
)
{
// The IEEE-754 conversion does not work for long double
// => fall back to string serialization (event though it sucks).
std
::
ostringstream
oss
;
oss
<<
std
::
setprecision
(
std
::
numeric_limits
<
long
double
>::
digits
)
<<
x
;
auto
tmp
=
oss
.
str
();
return
apply_impl
(
tmp
);
}
error
serialized_size_inspector
::
apply_impl
(
std
::
string
&
x
)
{
size_t
str_size
=
x
.
size
();
begin_sequence
(
str_size
);
result_
+=
x
.
size
();
end_sequence
();
return
none
;
}
error
serialized_size_inspector
::
apply_impl
(
std
::
u16string
&
x
)
{
size_t
str_size
=
x
.
size
();
begin_sequence
(
str_size
);
result_
+=
x
.
size
()
*
sizeof
(
uint16_t
);
end_sequence
();
return
none
;
}
error
serialized_size_inspector
::
apply_impl
(
std
::
u32string
&
x
)
{
size_t
str_size
=
x
.
size
();
begin_sequence
(
str_size
);
result_
+=
x
.
size
()
*
sizeof
(
uint32_t
);
end_sequence
();
return
none
;
}
}
// 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