0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SystemVariable.h
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 
28 #ifndef Hypertable_Lib_SystemvVriable_h
29 #define Hypertable_Lib_SystemvVriable_h
30 
31 #include <Common/Serializable.h>
32 #include <Common/String.h>
33 
34 #include <vector>
35 
36 namespace Hypertable {
37 
40 
41  namespace SystemVariable {
42 
45  enum Code {
46  READONLY = 0,
47  COUNT = 1
48  };
49 
51  struct Spec : public Serializable {
52 
54  int32_t code;
55 
57  bool value;
58 
61  uint8_t encoding_version() const override;
62 
66  size_t encoded_length_internal() const override;
67 
70  void encode_internal(uint8_t **bufp) const override;
71 
78  void decode_internal(uint8_t version, const uint8_t **bufp,
79  size_t *remainp) override;
80 
81  };
82 
87  const char *code_to_string(int var_code);
88 
94  int string_to_code(const std::string &var_string);
95 
100  bool default_value(int var_code);
101 
106  std::string specs_to_string(const std::vector<Spec> &specs);
107 
112  size_t encoded_length_specs(const std::vector<Spec> &specs);
113 
126  void encode_specs(const std::vector<Spec> &specs, uint8_t **bufp);
127 
134  void decode_specs(std::vector<Spec> &specs,
135  const uint8_t **bufp, size_t *remainp);
136 
137  }
138 
140 
141 }
142 
143 #endif // Hypertable_Lib_SystemvVriable_h
int32_t code
Variable code.
bool default_value(int var_code)
Returns default value for given variable.
std::string specs_to_string(const std::vector< Spec > &specs)
Returns a textual representation of variable specifications.
int string_to_code(const std::string &var_string)
Converts variable string to variable code.
void decode_specs(std::vector< Spec > &specs, const uint8_t **bufp, size_t *remainp)
Decodes a vector of variable specs.
void encode_specs(const std::vector< Spec > &specs, uint8_t **bufp)
Encodes a vector of variable specs.
size_t encoded_length_internal() const override
Returns internal serialized length.
Holds a variable code and boolean value.
Declarations for Serializable.
Hypertable definitions
void encode_internal(uint8_t **bufp) const override
Writes serialized representation of object to a buffer.
Mixin class that provides a standard serialization interface.
Definition: Serializable.h:65
void decode_internal(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Reads serialized representation of object from a buffer.
uint8_t encoding_version() const override
Returns encoding version.
Code
Enumeration for variable codes.
A String class based on std::string.
size_t encoded_length_specs(const std::vector< Spec > &specs)
Returns encoded length of variable specs vector.
const char * code_to_string(int var_code)
Converts variable code to variable string.