Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1068)

Unified Diff: blimp/helium/coded_value_serializer.h

Issue 2400303002: Add LwwRegister CRDT (Closed)
Patch Set: Add comment on max string length constant Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/helium/BUILD.gn ('k') | blimp/helium/coded_value_serializer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « blimp/helium/BUILD.gn ('k') | blimp/helium/coded_value_serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698