You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AQuery/server/libaquery.h

80 lines
1.5 KiB

2 years ago
#ifndef _AQUERY_H
#define _AQUERY_H
#include "table.h"
#include <unordered_map>
enum Log_level {
LOG_INFO,
LOG_ERROR,
LOG_SILENT
};
enum Backend_Type {
BACKEND_AQuery,
BACKEND_MonetDB,
BACKEND_MariaDB
};
2 years ago
struct Config{
int running, new_query, server_mode,
backend_type, has_dll, n_buffers;
2 years ago
int buffer_sizes[];
};
struct Session{
struct Statistic{
size_t total_active;
size_t cnt_object;
size_t total_alloc;
} stats;
void* memory_map;
};
2 years ago
struct Context{
typedef int (*printf_type) (const char *format, ...);
2 years ago
void* module_function_maps = 0;
2 years ago
Config* cfg;
int n_buffers, *sz_bufs;
void **buffers;
void* alt_server;
Log_level log_level = LOG_INFO;
Session current;
#ifdef THREADING
void* thread_pool;
#endif
2 years ago
printf_type print = printf;
Context();
virtual ~Context();
2 years ago
template <class ...Types>
void log(Types... args) {
if (log_level == LOG_INFO)
print(args...);
}
template <class ...Types>
void err(Types... args) {
if (log_level <= LOG_ERROR)
print(args...);
}
void init_session();
void end_session();
2 years ago
void* get_module_function(const char*);
std::unordered_map<const char*, void*> tables;
std::unordered_map<const char*, uColRef *> cols;
2 years ago
};
#ifdef _WIN32
#define __DLLEXPORT__ __declspec(dllexport) __stdcall
2 years ago
#else
#define __DLLEXPORT__
#endif
#define __AQEXPORT__(_Ty) extern "C" _Ty __DLLEXPORT__
typedef void (*deallocator_t) (void*);
#endif