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

Side by Side Diff: blimp/net/helium/syncable_primitive_serializer.h

Issue 2400303002: Add LwwRegister CRDT (Closed)
Patch Set: Refactor Serializer to use overloaded methods and add unit tests. Refactor LwwRegister to not be te… 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BLIMP_NET_HELIUM_SYNCABLE_PRIMITIVE_SERIALIZER_H_
6 #define BLIMP_NET_HELIUM_SYNCABLE_PRIMITIVE_SERIALIZER_H_
7
8 #include <string>
9
10 namespace google {
11 namespace protobuf {
12 namespace io {
13 class CodedInputStream;
14 class CodedOutputStream;
15 } // namespace io
16 } // namespace protobuf
17 } // namespace google
18
19 namespace blimp {
20
21 // Syncable CRDTs need to serialize their data into CodedOutputStreams. This
22 // helper class centralizes that logic into two overloaded functions, one for
23 // serialization and one for deserialization that can be called for any
24 // primitive type.
25 class SyncablePrimitiveSerializer {
26 public:
27 static void Serialize(const int32_t& value,
28 google::protobuf::io::CodedOutputStream* output_stream);
29 static bool Deserialize(google::protobuf::io::CodedInputStream* input_stream,
30 int32_t* value);
31
32 static void Serialize(const std::string& value,
33 google::protobuf::io::CodedOutputStream* output_stream);
34 static bool Deserialize(google::protobuf::io::CodedInputStream* input_stream,
35 std::string* value);
36 };
37
38 } // namespace blimp
39
40 #endif // BLIMP_NET_HELIUM_SYNCABLE_PRIMITIVE_SERIALIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698