19 #ifndef __CONFIG_VALUES_HPP
20 #define __CONFIG_VALUES_HPP
22 #include <ndb_types.h>
23 #include <UtilBuffer.hpp>
46 const char * m_string;
54 Uint32 m_currentSection;
60 bool get(Uint32 key,
Entry *)
const;
62 bool get(Uint32 key, Uint32 * value)
const;
63 bool get(Uint32 key, Uint64 * value)
const;
64 bool get(Uint32 key,
const char ** value)
const;
65 bool getTypeOf(Uint32 key, ValueType *
type)
const;
67 Uint32
get(Uint32 key, Uint32 notFound)
const;
68 Uint64 get64(Uint32 key, Uint64 notFound)
const;
69 const char *
get(Uint32 key,
const char * notFound)
const;
70 ValueType getTypeOf(Uint32 key)
const;
78 m_currentSection = i.m_currentSection;
81 bool set(Uint32 key, Uint32 value);
82 bool set(Uint32 key, Uint64 value);
83 bool set(Uint32 key,
const char * value);
86 Uint32 getPackedSize()
const;
88 Uint32 pack(
void * dst, Uint32 len)
const;
94 bool getByPos(Uint32 pos,
Entry *)
const;
95 Uint64 * get64(Uint32
index)
const;
96 char ** getString(Uint32
index)
const;
100 Uint32 m_stringCount;
108 Uint32 m_currentSection;
110 Uint32 m_sectionCounter;
122 bool openSection(Uint32 key, Uint32 no);
124 bool put(Uint32 key, Uint32 value);
125 bool put64(Uint32 key, Uint64 value);
126 bool put(Uint32 key,
const char * value);
129 void expand(Uint32 freeKeys, Uint32 freeData);
133 bool unpack(
const void * src, Uint32 len);
144 ConfigValues::ConstIterator::get(Uint32 key, Uint32 * value)
const {
146 if(
get(key, &tmp) && tmp.m_type == IntType){
155 ConfigValues::ConstIterator::get(Uint32 key, Uint64 * value)
const {
157 if(
get(key, &tmp) && tmp.m_type == Int64Type){
158 * value = tmp.m_int64;
166 ConfigValues::ConstIterator::get(Uint32 key,
const char ** value)
const {
168 if(
get(key, &tmp) && tmp.m_type == StringType){
169 * value = tmp.m_string;
177 ConfigValues::ConstIterator::getTypeOf(Uint32 key, ValueType *
type)
const{
188 ConfigValues::ConstIterator::get(Uint32 key, Uint32 notFound)
const {
190 if(
get(key, &tmp) && tmp.m_type == IntType){
198 ConfigValues::ConstIterator::get64(Uint32 key, Uint64 notFound)
const {
200 if(
get(key, &tmp) && tmp.m_type == Int64Type){
208 ConfigValues::ConstIterator::get(Uint32 key,
const char * notFound)
const {
210 if(
get(key, &tmp) && tmp.m_type == StringType){
217 ConfigValues::ValueType
218 ConfigValues::ConstIterator::getTypeOf(Uint32 key)
const{
223 return ConfigValues::InvalidType;
228 ConfigValuesFactory::put(Uint32 key, Uint32 val){
231 tmp.m_type = ConfigValues::IntType;
238 ConfigValuesFactory::put64(Uint32 key, Uint64 val){
241 tmp.m_type = ConfigValues::Int64Type;
248 ConfigValuesFactory::put(Uint32 key,
const char * val){
251 tmp.m_type = ConfigValues::StringType;
259 Uint32 len = getPackedSize();
260 void * tmp = buf.append(len);
264 return pack(tmp, len);
269 ConfigValuesFactory::unpack(
const UtilBuffer& buf){
270 return unpack(buf.get_data(), buf.length());