Use the same templated implementation for all different serialize_XXX(...).
The chosen implementation is based on the std::copy_n(char*, size, OutputIterator),
which is heavily optimized and will be using memcpy/memmove where possible.
This patch also removes the not needed specializations that accept signed integer
values since we were casting them to unsigned value anyway.
The std::ostream based specifications are also removed since they are not used
anywhere except for a test-serialization.cc and adjusting the ostream to the iterator
is a single-liner.
Signed-off-by: Vlad Zolotarov <vladz@scylladb.com>
Add a test (using the Boost unit-test framework) for the functions of
util/serealization.hh for serializing and de-serializing primitive types
like integers and strings.
The test checks that the round-trip is correct, i.e., taking an original
data, serializing it and de-serializing it back, gets the same data back.
Moreover, it compares the result of serialization to pre-computed expected
results (which were produced by a Java program), to confirm that our code
generates the same serialization as Java.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>