0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
FragmentReplayPlan.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 2 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
27 
28 #include <Common/Compat.h>
29 
30 #include "FragmentReplayPlan.h"
31 
32 #include <Common/Serialization.h>
33 
35 using namespace std;
36 
38  return 1;
39 }
40 
42  return Serialization::encoded_length_vstr(location) + 4;
43 }
44 
61 void FragmentReplayPlan::encode_internal(uint8_t **bufp) const {
62  Serialization::encode_vstr(bufp, location);
63  Serialization::encode_i32(bufp, fragment);
64 }
65 
66 void FragmentReplayPlan::decode_internal(uint8_t version, const uint8_t **bufp,
67  size_t *remainp) {
68  location = Serialization::decode_vstr(bufp, remainp);
69  fragment = Serialization::decode_i32(bufp, remainp);
70 }
char * decode_vstr(const uint8_t **bufp, size_t *remainp)
Decode a vstr (vint64, data, null).
size_t encoded_length_internal() const override
Returns internal serialized length.
void encode_internal(uint8_t **bufp) const override
Writes serialized representation of object to a buffer.
STL namespace.
void decode_internal(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Reads serialized representation of object from a buffer.
size_t encoded_length_vstr(size_t len)
Computes the encoded length of vstr (vint64, data, null)
uint32_t decode_i32(const uint8_t **bufp, size_t *remainp)
Decode a 32-bit integer in little-endian order.
void encode_i32(uint8_t **bufp, uint32_t val)
Encode a 32-bit integer in little-endian order.
Compatibility Macros for C/C++.
Functions to serialize/deserialize primitives to/from a memory buffer.
void encode_vstr(uint8_t **bufp, const void *buf, size_t len)
Encode a buffer as variable length string (vint64, data, null)
Declarations for FragmentReplayPlan.
uint8_t encoding_version() const override
Returns encoding version.