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
999369cd
Commit
999369cd
authored
Jul 07, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
write_raw & read_raw
parent
e35c957a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
2 deletions
+37
-2
cppa/binary_deserializer.hpp
cppa/binary_deserializer.hpp
+1
-2
cppa/binary_serializer.hpp
cppa/binary_serializer.hpp
+2
-0
cppa/deserializer.hpp
cppa/deserializer.hpp
+5
-0
cppa/serializer.hpp
cppa/serializer.hpp
+7
-0
src/binary_deserializer.cpp
src/binary_deserializer.cpp
+6
-0
src/binary_serializer.cpp
src/binary_serializer.cpp
+6
-0
src/string_serialization.cpp
src/string_serialization.cpp
+10
-0
No files found.
cppa/binary_deserializer.hpp
View file @
999369cd
...
...
@@ -44,8 +44,6 @@ class binary_deserializer : public deserializer {
const
char
*
pos
;
const
char
*
end
;
void
range_check
(
size_t
read_size
);
public:
binary_deserializer
(
const
char
*
buf
,
size_t
buf_size
);
...
...
@@ -61,6 +59,7 @@ class binary_deserializer : public deserializer {
void
read_tuple
(
size_t
size
,
const
primitive_type
*
ptypes
,
primitive_variant
*
storage
);
void
read_raw
(
size_t
num_bytes
,
void
*
storage
);
};
...
...
cppa/binary_serializer.hpp
View file @
999369cd
...
...
@@ -71,6 +71,8 @@ class binary_serializer : public serializer {
void
write_tuple
(
size_t
size
,
const
primitive_variant
*
values
);
void
write_raw
(
size_t
num_bytes
,
const
void
*
data
);
/**
* @brief Returns the number of written bytes.
*/
...
...
cppa/deserializer.hpp
View file @
999369cd
...
...
@@ -108,6 +108,11 @@ class deserializer {
const
primitive_type
*
ptypes
,
primitive_variant
*
storage
)
=
0
;
/**
* @brief Reads a raw memory block.
*/
virtual
void
read_raw
(
size_t
num_bytes
,
void
*
storage
)
=
0
;
};
/**
...
...
cppa/serializer.hpp
View file @
999369cd
...
...
@@ -85,6 +85,13 @@ class serializer {
*/
virtual
void
write_value
(
const
primitive_variant
&
value
)
=
0
;
/**
* @brief Writes a raw block of data.
* @param num_bytes The size of @p data in bytes.
* @param data Raw data.
*/
virtual
void
write_raw
(
size_t
num_bytes
,
const
void
*
data
)
=
0
;
/**
* @brief Writes @p num values as a tuple to the data sink.
* @param num Size of the array @p values.
...
...
src/binary_deserializer.cpp
View file @
999369cd
...
...
@@ -172,4 +172,10 @@ void binary_deserializer::read_tuple(size_t size,
}
}
void
binary_deserializer
::
read_raw
(
size_t
num_bytes
,
void
*
storage
)
{
range_check
(
pos
,
end
,
num_bytes
);
memcpy
(
&
storage
,
pos
,
num_bytes
);
pos
+=
num_bytes
;
}
}
// namespace cppa
src/binary_serializer.cpp
View file @
999369cd
...
...
@@ -171,6 +171,12 @@ void binary_serializer::write_value(const primitive_variant& value) {
value
.
apply
(
detail
::
binary_writer
(
this
));
}
void
binary_serializer
::
write_raw
(
size_t
num_bytes
,
const
void
*
data
)
{
acquire
(
num_bytes
);
memcpy
(
m_wr_pos
,
data
,
num_bytes
);
m_wr_pos
+=
num_bytes
;
}
void
binary_serializer
::
write_tuple
(
size_t
size
,
const
primitive_variant
*
values
)
{
const
primitive_variant
*
end
=
values
+
size
;
...
...
src/string_serialization.cpp
View file @
999369cd
...
...
@@ -155,6 +155,11 @@ class string_serializer : public serializer {
out
<<
(
m_after_value
?
" }"
:
"}"
);
}
void
write_raw
(
size_t
,
const
void
*
)
{
throw
std
::
runtime_error
(
"string_serializer::write_raw: "
"not implemented yet"
);
}
};
class
string_deserializer
:
public
deserializer
{
...
...
@@ -417,6 +422,11 @@ class string_deserializer : public deserializer {
consume
(
'}'
);
}
void
read_raw
(
size_t
,
void
*
)
{
throw
std
::
runtime_error
(
"string_deserializer::read_raw: "
"not implemented yet"
);
}
};
}
// namespace <anonymous>
...
...
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