0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SetState.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; either version 3
9  * of the 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 
26 
27 #include <Common/Compat.h>
28 
29 #include "SetState.h"
30 
32 
33 #include <Common/Logger.h>
34 #include <Common/Serialization.h>
35 
36 using namespace Hypertable;
38 
39 uint8_t SetState::encoding_version() const {
40  return 1;
41 }
42 
44  size_t length = 4;
45  for (auto & spec : m_specs)
46  length += spec.encoded_length();
47  return length;
48 }
49 
69 void SetState::encode_internal(uint8_t **bufp) const {
70  Serialization::encode_i32(bufp, m_specs.size());
71  for (auto & spec : m_specs)
72  spec.encode(bufp);
73 }
74 
75 void SetState::decode_internal(uint8_t version, const uint8_t **bufp,
76  size_t *remainp) {
77  int32_t count = Serialization::decode_i32(bufp, remainp);
78  for (int32_t i=0; i<count; i++) {
80  spec.decode(bufp, remainp);
81  m_specs.push_back(spec);
82  }
83 }
84 
85 
86 
void encode_internal(uint8_t **bufp) const override
Writes serialized representation of object to a buffer.
Definition: SetState.cc:69
Declarations for Canonicalize.
uint32_t decode_i32(const uint8_t **bufp, size_t *remainp)
Decode a 32-bit integer in little-endian order.
uint8_t encoding_version() const override
Returns encoding version.
Definition: SetState.cc:39
Logging routines and macros.
void encode_i32(uint8_t **bufp, uint32_t val)
Encode a 32-bit integer in little-endian order.
Compatibility Macros for C/C++.
std::vector< SystemVariable::Spec > m_specs
System variable specifications
Definition: SetState.h:91
Functions to serialize/deserialize primitives to/from a memory buffer.
Holds a variable code and boolean value.
virtual void decode(const uint8_t **bufp, size_t *remainp)
Reads serialized representation of object from a buffer.
Definition: Serializable.cc:70
Hypertable definitions
size_t encoded_length_internal() const override
Returns internal serialized length.
Definition: SetState.cc:43
Declarations for SetState request parameters.
void decode_internal(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Reads serialized representation of object from a buffer.
Definition: SetState.cc:75