| Index: blimp/helium/coded_value_serializer.h
|
| diff --git a/blimp/helium/coded_value_serializer.h b/blimp/helium/coded_value_serializer.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..22e8bf500fc9540d6e82ae43e24c3ff48b0a031d
|
| --- /dev/null
|
| +++ b/blimp/helium/coded_value_serializer.h
|
| @@ -0,0 +1,51 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef BLIMP_HELIUM_CODED_VALUE_SERIALIZER_H_
|
| +#define BLIMP_HELIUM_CODED_VALUE_SERIALIZER_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "blimp/helium/blimp_helium_export.h"
|
| +
|
| +namespace google {
|
| +namespace protobuf {
|
| +namespace io {
|
| +class CodedInputStream;
|
| +class CodedOutputStream;
|
| +} // namespace io
|
| +} // namespace protobuf
|
| +} // namespace google
|
| +
|
| +namespace blimp {
|
| +namespace helium {
|
| +
|
| +class VersionVector;
|
| +
|
| +// Syncable CRDTs need to serialize their data into CodedOutputStreams. This
|
| +// helper class centralizes that logic into two overloaded functions, one for
|
| +// serialization and one for deserialization that can be called for any
|
| +// supported primitive type.
|
| +class BLIMP_HELIUM_EXPORT CodedValueSerializer {
|
| + public:
|
| + static void Serialize(const int32_t& value,
|
| + google::protobuf::io::CodedOutputStream* output_stream);
|
| + static bool Deserialize(google::protobuf::io::CodedInputStream* input_stream,
|
| + int32_t* value);
|
| +
|
| + static void Serialize(const std::string& value,
|
| + google::protobuf::io::CodedOutputStream* output_stream);
|
| + static bool Deserialize(google::protobuf::io::CodedInputStream* input_stream,
|
| + std::string* value);
|
| +
|
| + static void Serialize(const VersionVector& value,
|
| + google::protobuf::io::CodedOutputStream* output_stream);
|
| + static bool Deserialize(google::protobuf::io::CodedInputStream* input_stream,
|
| + VersionVector* value);
|
| +};
|
| +
|
| +} // namespace helium
|
| +} // namespace blimp
|
| +
|
| +#endif // BLIMP_HELIUM_CODED_VALUE_SERIALIZER_H_
|
|
|