天佐.乾坤袋  tianzuo.Qiankun
NoSql数据库 NoSql database
Loading...
Searching...
No Matches
tianzuo.Qiankun.h
Go to the documentation of this file.
1
2// *@file tianzuo.Qiankun.h
3// *@brief 天佐.乾坤袋 (tianzuo.Qiankun)
4// *@version 1.0
5// *@section LICENSE Copyright © 2003-2103 郑天佐 Corporation
6// *@author 郑天佐 (zhengtianzuo)
7// *@date 2013-4-3
8#pragma once
9#include <iostream>
10#include <utility>
11#include <vector>
12#include <string>
13#include <map>
14
15const unsigned int Qiankun_file_name_size = 48;
16
25
45
51
58
77
80typedef unsigned(*Qiankun_callback_data)(int m_function, void *context, void *user_data, int user_size, void *return_data, int return_size);
81typedef unsigned(*Qiankun_callback_bytes)(int m_function, void *context, void *&user_data, int *user_size, void *return_data, int return_size);
82typedef void(Qiankun_callback)(void *&, void *);
83
86static void Qiankun_data2string(void *&user_data, void *return_data) {
87 *reinterpret_cast<std::string*>(user_data) = *reinterpret_cast<std::string*>(return_data);
88}
89
90static void Qiankun_data2vshort(void *&user_data, void *return_data) {
91 *reinterpret_cast<std::vector<int16_t>*>(user_data) = *reinterpret_cast<std::vector<int16_t>*>(return_data);
92}
93
94static void Qiankun_data2vint(void *&user_data, void *return_data) {
95 *reinterpret_cast<std::vector<int>*>(user_data) = *reinterpret_cast<std::vector<int>*>(return_data);
96}
97
98static void Qiankun_data2vfloat(void *&user_data, void *return_data) {
99 *reinterpret_cast<std::vector<float>*>(user_data) = *reinterpret_cast<std::vector<float>*>(return_data);
100}
101
102static void Qiankun_data2vdouble(void *&user_data, void *return_data) {
103 *reinterpret_cast<std::vector<double>*>(user_data) = *reinterpret_cast<std::vector<double>*>(return_data);
104}
105
106static void Qiankun_data2vstring(void *&user_data, void *return_data) {
107 *reinterpret_cast<std::vector<std::string>*>(user_data) = *reinterpret_cast<std::vector<std::string>*>(return_data);
108}
109
116
119static const Qiankun_command_struct Qiankun_command_info[] = {
120 { Qiankun_data_type_string, &Qiankun_data2string },
121 { Qiankun_data_type_short_array, &Qiankun_data2vshort },
122 { Qiankun_data_type_integer_array, &Qiankun_data2vint },
123 { Qiankun_get_index_list, &Qiankun_data2vint },
124 { Qiankun_get_size_list, &Qiankun_data2vint },
125 { Qiankun_get_type_list, &Qiankun_data2vint },
126 { Qiankun_get_type_total_number_list, &Qiankun_data2vint },
127 { Qiankun_data_type_float_array, &Qiankun_data2vfloat },
128 { Qiankun_data_type_double_array, &Qiankun_data2vdouble },
129 { Qiankun_data_type_currency_array, &Qiankun_data2vdouble },
130 { Qiankun_data_type_date_array, &Qiankun_data2vdouble },
131 { Qiankun_data_type_string_array, &Qiankun_data2vstring },
132 { Qiankun_get_name_list, &Qiankun_data2vstring },
133};
134
137static std::map<int, Qiankun_command_struct> Qiankun_command_map;
138static void Qiankun_command_init() {
139 for (unsigned int i = 0; i < sizeof(Qiankun_command_info) / sizeof(Qiankun_command_struct); ++i) {
140 (void)Qiankun_command_map.insert(std::make_pair(Qiankun_command_info[i].m_function, Qiankun_command_info[i]));
141 }
142}
数据回调命令
Definition tianzuo.Qiankun.h:112
Qiankun_callback * m_callback
Definition tianzuo.Qiankun.h:114
int m_function
Definition tianzuo.Qiankun.h:113
Qiankun_name_type
Definition tianzuo.Qiankun.h:47
@ Qiankun_name_type_name
数据名称 (data name)
Definition tianzuo.Qiankun.h:48
@ Qiankun_name_type_remark
数据备注 (data remark)
Definition tianzuo.Qiankun.h:49
Qiankun_data_type
Definition tianzuo.Qiankun.h:27
@ Qiankun_data_type_file
文件型
Definition tianzuo.Qiankun.h:35
@ Qiankun_data_type_short
短整型
Definition tianzuo.Qiankun.h:28
@ Qiankun_data_type_integer
整型
Definition tianzuo.Qiankun.h:29
@ Qiankun_data_type_currency_array
货币型数组
Definition tianzuo.Qiankun.h:41
@ Qiankun_data_type_date_array
日期型数组
Definition tianzuo.Qiankun.h:42
@ Qiankun_data_type_currency
货币型
Definition tianzuo.Qiankun.h:32
@ Qiankun_data_type_string
字符串型
Definition tianzuo.Qiankun.h:34
@ Qiankun_data_type_short_array
短整型数组
Definition tianzuo.Qiankun.h:37
@ Qiankun_data_type_byte_array
字节数组
Definition tianzuo.Qiankun.h:36
@ Qiankun_data_type_integer_array
整型数组
Definition tianzuo.Qiankun.h:38
@ Qiankun_data_type_float_array
单精度浮点型数组
Definition tianzuo.Qiankun.h:39
@ Qiankun_data_type_string_array
字符串型数组
Definition tianzuo.Qiankun.h:43
@ Qiankun_data_type_double
双精度浮点型
Definition tianzuo.Qiankun.h:31
@ Qiankun_data_type_float
单精度浮点型
Definition tianzuo.Qiankun.h:30
@ Qiankun_data_type_date
日期型
Definition tianzuo.Qiankun.h:33
@ Qiankun_data_type_double_array
双精度浮点型数组
Definition tianzuo.Qiankun.h:40
void() Qiankun_callback(void *&, void *)
Definition tianzuo.Qiankun.h:82
Qiankun_error_code
Definition tianzuo.Qiankun.h:60
@ Qiankun_errorcode_io
IO错误 (io error)
Definition tianzuo.Qiankun.h:75
@ Qiankun_errorcode_handle
句柄错误 (error handle)
Definition tianzuo.Qiankun.h:74
@ Qiankun_errorcode_get_array
数组错误 (arrary error)
Definition tianzuo.Qiankun.h:72
@ Qiankun_errorcode_db_not_exist
数据库文件不存在 (The database file does not exist)
Definition tianzuo.Qiankun.h:65
@ Qiankun_errorcode_out_of_memory
内存溢出 (memory overflow)
Definition tianzuo.Qiankun.h:73
@ Qiankun_errorcode_compress
压缩错误 (compression error)
Definition tianzuo.Qiankun.h:71
@ Qiankun_errorcode_not_exist
数据不存在 (Data does not exist)
Definition tianzuo.Qiankun.h:67
@ Qiankun_errorcode_param
参数错误 (parameter error)
Definition tianzuo.Qiankun.h:70
@ Qiankun_errorcode_no_rights
数据库密码效验未通过 (The database password verification failed)
Definition tianzuo.Qiankun.h:64
@ Qiankun_errorcode_type
类型不符 (wrong type)
Definition tianzuo.Qiankun.h:69
@ Qiankun_errorcode_success
正确的值
Definition tianzuo.Qiankun.h:61
@ Qiankun_errorcode_normal
错误的值
Definition tianzuo.Qiankun.h:62
@ Qiankun_errorcode_exist
数据已存在 (Data already exists)
Definition tianzuo.Qiankun.h:66
@ Qiankun_errorcode_differ
数据库文件数效验未通过 (The number of database files fails to be verified)
Definition tianzuo.Qiankun.h:63
@ Qiankun_errorcode_out_of_range
超出范围 (out of range)
Definition tianzuo.Qiankun.h:68
unsigned(* Qiankun_callback_data)(int m_function, void *context, void *user_data, int user_size, void *return_data, int return_size)
数据回调函数
Definition tianzuo.Qiankun.h:80
const unsigned int Qiankun_file_name_size
文件名长度 (Filename length)
Definition tianzuo.Qiankun.h:15
unsigned(* Qiankun_callback_bytes)(int m_function, void *context, void *&user_data, int *user_size, void *return_data, int return_size)
Definition tianzuo.Qiankun.h:81
Qiankun_data_operation
Definition tianzuo.Qiankun.h:18
@ Qiankun_get_name_list
获取数据名称列表 (Gets a list of data names)
Definition tianzuo.Qiankun.h:22
@ Qiankun_get_index_list
获取数据序号列表 (Gets a list of data ordinals)
Definition tianzuo.Qiankun.h:19
@ Qiankun_get_size_list
获取数据大小列表 (Gets a list of data sizes)
Definition tianzuo.Qiankun.h:23
@ Qiankun_get_type_list
获取数据类型列表 (Gets a list of data types)
Definition tianzuo.Qiankun.h:20
@ Qiankun_get_type_total_number_list
获取数据各类型总数列表 (Gets a list of total types of data)
Definition tianzuo.Qiankun.h:21
struct Qiankun_command * Qiankun_command_pointer
Qiankun_size_type
Definition tianzuo.Qiankun.h:53
@ Qiankun_size_type_data_delete_size
删除的数据大小 (The size of the deleted data)
Definition tianzuo.Qiankun.h:55
@ Qiankun_size_type_data_all_size
总数据大小 (Total data size)
Definition tianzuo.Qiankun.h:54
@ Qiankun_size_type_data_size
数据实际大小 (Actual data size)
Definition tianzuo.Qiankun.h:56
struct Qiankun_command Qiankun_command_struct