0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TableParts.cc
Go to the documentation of this file.
1 /* -*- c++ -*-
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 3 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 
26 
27 #include <Common/Compat.h>
28 
29 #include "TableParts.h"
30 
31 #include <Common/Serialization.h>
32 
33 using namespace Hypertable;
34 using namespace std;
35 
37  return 1;
38 }
39 
41  return 1;
42 }
43 
53 void TableParts::encode_internal(uint8_t **bufp) const {
54  Serialization::encode_i8(bufp, (uint8_t)m_parts);
55 }
56 
57 void TableParts::decode_internal(uint8_t version, const uint8_t **bufp,
58  size_t *remainp) {
59  (void)version;
60  m_parts = Serialization::decode_i8(bufp, remainp);
61 }
62 
63 const std::string TableParts::to_string() const {
64  std::string str;
65  if (m_parts == TableParts::ALL)
66  str = "ALL";
67  else {
68  if (m_parts & PRIMARY)
69  str = "PRIMARY";
70  if (m_parts & VALUE_INDEX) {
71  if (!str.empty())
72  str += "|";
73  str += "VALUE_INDEX";
74  }
75  if (m_parts & QUALIFIER_INDEX) {
76  if (!str.empty())
77  str += "|";
78  str += "QUALIFIER_INDEX";
79  }
80  }
81  return str;
82 }
size_t encoded_length_internal() const override
Returns internal serialized length.
Definition: TableParts.cc:40
Po::typed_value< String > * str(String *v=0)
Definition: Properties.h:166
STL namespace.
void decode_internal(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Reads serialized representation of object from a buffer.
Definition: TableParts.cc:57
uint8_t decode_i8(const uint8_t **bufp, size_t *remainp)
Decode a 8-bit integer (a byte/character)
Definition: Serialization.h:60
Compatibility Macros for C/C++.
Functions to serialize/deserialize primitives to/from a memory buffer.
uint8_t encoding_version() const override
Returns encoding version.
Definition: TableParts.cc:36
Hypertable definitions
void encode_internal(uint8_t **bufp) const override
Serialized format is as follows:
Definition: TableParts.cc:53
const std::string to_string() const
Returns human readable string describing table parts.
Definition: TableParts.cc:63
void encode_i8(uint8_t **bufp, uint8_t val)
Encodes a byte into the given buffer.
Definition: Serialization.h:49
Declarations for TableParts.