MIDAS
|
Classes | |
struct | db_err_msg_struct |
struct | print_key_info_buf |
struct | UPDATE_OPEN_RECORDS |
Macros | |
#define | CHECK_OPEN_RECORD 1 |
#define | HAVE_DB_GET_VALUE_STRING_CREATE_STRING_LENGTH 1 |
Typedefs | |
typedef struct db_err_msg_struct | db_err_msg |
Functions | |
INT | db_save_xml_key (HNDLE hDB, HNDLE hKey, INT level, MXML_WRITER *writer) |
static void | db_msg (db_err_msg **msg, INT message_type, const char *filename, INT line, const char *routine, const char *format,...) MATTRPRINTF(6 |
static void static void | db_print_msg (const db_err_msg *msg) |
static void | db_flush_msg (db_err_msg **msg) |
static INT | db_find_key_locked (const DATABASE_HEADER *pheader, HNDLE hKey, const char *key_name, HNDLE *subhKey, db_err_msg **msg) |
static const KEY * | db_find_pkey_locked (const DATABASE_HEADER *pheader, const KEY *pkey, const char *key_name, int *pstatus, db_err_msg **msg) |
static std::string | db_get_path_locked (const DATABASE_HEADER *pheader, HNDLE hKey) |
static std::string | db_get_path_locked (const DATABASE_HEADER *pheader, const KEY *pkey) |
static int | db_scan_tree_locked (const DATABASE_HEADER *pheader, const KEY *pkey, int level, int(*callback)(const DATABASE_HEADER *, const KEY *, int, void *, db_err_msg **), void *info, db_err_msg **msg) |
static int | db_set_mode_wlocked (DATABASE_HEADER *, KEY *, WORD mode, int recurse, db_err_msg **) |
static const KEY * | db_resolve_link_locked (const DATABASE_HEADER *, const KEY *, int *pstatus, db_err_msg **) |
static int | db_notify_clients_locked (const DATABASE_HEADER *pheader, HNDLE hDB, HNDLE hKeyMod, int index, BOOL bWalk, db_err_msg **msg) |
static int | db_create_key_wlocked (DATABASE_HEADER *pheader, KEY *parentKey, const char *key_name, DWORD type, KEY **pnewkey, db_err_msg **msg) |
static int | db_set_value_wlocked (DATABASE_HEADER *pheader, HNDLE hDB, KEY *pkey_root, const char *key_name, const void *data, INT data_size, INT num_values, DWORD type, db_err_msg **msg) |
static INT | db_get_data_locked (DATABASE_HEADER *pheader, const KEY *pkey, int idx, void *data, INT *buf_size, DWORD type, db_err_msg **msg) |
static INT | db_set_data_wlocked (DATABASE_HEADER *pheader, KEY *pkey, const void *data, INT data_size, INT num_values, DWORD type, const char *caller, db_err_msg **msg) |
static INT | db_set_data_index_wlocked (DATABASE_HEADER *pheader, KEY *pkey, int idx, const void *data, INT data_size, DWORD type, const char *caller, db_err_msg **msg) |
static INT | db_check_set_data_locked (DATABASE_HEADER *pheader, const KEY *pkey, const void *data, INT data_size, INT num_values, DWORD type, const char *caller, db_err_msg **msg) |
static INT | db_check_set_data_index_locked (DATABASE_HEADER *pheader, const KEY *pkey, int idx, const void *data, INT data_size, DWORD type, const char *caller, db_err_msg **msg) |
static int | db_remove_open_record_wlocked (DATABASE *pdb, DATABASE_HEADER *pheader, HNDLE hKey) |
static bool | db_validate_key_offset (const DATABASE_HEADER *pheader, int offset) |
static void * | malloc_key (DATABASE_HEADER *pheader, INT size, const char *caller) |
static void | free_key (DATABASE_HEADER *pheader, void *address, INT size) |
static int | validate_free_data (DATABASE_HEADER *pheader, int free_data) |
static void * | malloc_data (DATABASE_HEADER *pheader, INT size) |
static int | free_data (DATABASE_HEADER *pheader, void *address, INT size, const char *caller) |
static void * | realloc_data (DATABASE_HEADER *pheader, void *address, INT old_size, INT new_size, const char *caller) |
char * | strcomb (const char **list) |
std::string | strcomb1 (const char **list) |
static void | add_to_buf (struct print_key_info_buf *buf, const char *s) |
static INT | print_key_info (HNDLE hDB, HNDLE hKey, KEY *pkey, INT level, void *info) |
static bool | db_validate_data_offset (const DATABASE_HEADER *pheader, int offset) |
INT | db_show_mem (HNDLE hDB, char **result, BOOL verbose) |
INT | db_get_free_mem (HNDLE hDB, INT *key_size, INT *data_size) |
static bool | is_utf8 (const char *string) |
static int | db_validate_name (const char *name, int maybe_path, const char *caller_name, db_err_msg **msg) |
static bool | db_validate_hkey (const DATABASE_HEADER *pheader, HNDLE hKey) |
static const KEY * | db_get_pkey (const DATABASE_HEADER *pheader, HNDLE hKey, int *pstatus, const char *caller, db_err_msg **msg) |
static const KEYLIST * | db_get_pkeylist (const DATABASE_HEADER *pheader, HNDLE hKey, const KEY *pkey, const char *caller, db_err_msg **msg, bool kludge_repair=false) |
static HNDLE | db_pkey_to_hkey (const DATABASE_HEADER *pheader, const KEY *pkey) |
static const KEY * | db_get_parent (const DATABASE_HEADER *pheader, const KEY *pkey, int *pstatus, const char *caller, db_err_msg **msg) |
static const KEY * | db_enum_first_locked (const DATABASE_HEADER *pheader, const KEY *pkey, db_err_msg **msg) |
static const KEY * | db_enum_next_locked (const DATABASE_HEADER *pheader, const KEY *pdir, const KEY *pkey, db_err_msg **msg) |
static bool | db_validate_and_repair_key_wlocked (DATABASE_HEADER *pheader, int recurse, const char *path, HNDLE parenthkeylist, HNDLE hkey, KEY *pkey, db_err_msg **msg) |
DATABASE_CLIENT * | db_get_my_client_locked (DATABASE *pdb) |
static void | db_validate_sizes () |
static int | db_update_open_record_wlocked (const DATABASE_HEADER *xpheader, const KEY *xpkey, int level, void *voidp, db_err_msg **msg) |
static int | db_validate_open_records_wlocked (DATABASE_HEADER *pheader, db_err_msg **msg) |
static bool | db_validate_and_repair_db_wlocked (DATABASE_HEADER *pheader, db_err_msg **msg) |
INT | db_open_database (const char *xdatabase_name, INT database_size, HNDLE *hDB, const char *client_name) |
INT | db_close_database (HNDLE hDB) |
INT | db_flush_database (HNDLE hDB) |
INT | db_close_all_databases (void) |
INT | db_set_client_name (HNDLE hDB, const char *client_name) |
INT | db_lock_database (HNDLE hDB) |
INT | db_allow_write_locked (DATABASE *p, const char *caller_name) |
INT | db_unlock_database (HNDLE hDB) |
INT | db_set_lock_timeout (HNDLE hDB, int timeout_millisec) |
INT | db_update_last_activity (DWORD millitime) |
static void | db_delete_client_wlocked (DATABASE_HEADER *pheader, int jclient, db_err_msg **msg) |
static int | db_delete_client_info_wlocked (HNDLE hDB, DATABASE_HEADER *pheader, int pid, db_err_msg **msg) |
int | db_delete_client_info (HNDLE hDB, int pid) |
void | db_cleanup (const char *who, DWORD actual_time, BOOL wrong_interval) |
void | db_cleanup2 (const char *client_name, int ignore_timeout, DWORD actual_time, const char *who) |
void | db_set_watchdog_params (DWORD timeout) |
INT | db_get_watchdog_info (HNDLE hDB, const char *client_name, DWORD *timeout, DWORD *last) |
INT | db_check_client (HNDLE hDB, HNDLE hKeyClient) |
INT | db_protect_database (HNDLE hDB) |
const char * | extract_key (const char *key_list, char *key_name, int key_name_length) |
BOOL | equal_ustring (const char *str1, const char *str2) |
BOOL | ends_with_ustring (const char *str, const char *suffix) |
BOOL | strmatch (char *pattern, char *str) |
void | strarrayindex (char *odbpath, int *index1, int *index2) |
INT | db_create_key (HNDLE hDB, HNDLE hKey, const char *key_name, DWORD type) |
INT | db_create_link (HNDLE hDB, HNDLE hKey, const char *link_name, const char *destination) |
INT | db_delete_key1 (HNDLE hDB, HNDLE hKey, INT level, BOOL follow_links) |
INT | db_delete_key (HNDLE hDB, HNDLE hKey, BOOL follow_links) |
INT | db_find_key (HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey) |
INT | db_find_key1 (HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey) |
INT | db_find_link (HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey) |
INT | db_find_link1 (HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey) |
INT | db_find_keys (HNDLE hDB, HNDLE hKeyRoot, char *odbpath, std::vector< HNDLE > &hKeyVector) |
INT | db_get_parent (HNDLE hDB, HNDLE hKey, HNDLE *parenthKey) |
INT | db_scan_tree (HNDLE hDB, HNDLE hKey, INT level, INT(*callback)(HNDLE, HNDLE, KEY *, INT, void *), void *info) |
int | db_scan_tree_locked (const DATABASE_HEADER *pheader, const KEY *pkey, int level, int(*callback)(const DATABASE_HEADER *pheader, const KEY *, int, void *, db_err_msg **msg), void *info, db_err_msg **msg) |
INT | db_scan_tree_link (HNDLE hDB, HNDLE hKey, INT level, void(*callback)(HNDLE, HNDLE, KEY *, INT, void *), void *info) |
INT | db_get_path (HNDLE hDB, HNDLE hKey, char *path, INT buf_size) |
std::string | db_get_path (HNDLE hDB, HNDLE hKey) |
static int | db_find_open_records (HNDLE hDB, HNDLE hKey, KEY *key, INT level, void *xresult) |
static int | db_fix_open_records (HNDLE hDB, HNDLE hKey, KEY *key, INT level, void *xresult) |
INT | db_get_open_records (HNDLE hDB, HNDLE hKey, char *str, INT buf_size, BOOL fix) |
INT | db_set_value (HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT num_values, DWORD type) |
INT | db_set_value_index (HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT idx, DWORD type, BOOL trunc) |
INT | db_get_value (HNDLE hDB, HNDLE hKeyRoot, const char *key_name, void *data, INT *buf_size, DWORD type, BOOL create) |
INT | db_enum_key (HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle) |
INT | db_enum_link (HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle) |
INT | db_get_next_link (HNDLE hDB, HNDLE hKey, HNDLE *subkey_handle) |
static INT | db_get_key_locked (const DATABASE_HEADER *pheader, HNDLE hKey, KEY *key, db_err_msg **msg) |
INT | db_get_key (HNDLE hDB, HNDLE hKey, KEY *key) |
INT | db_get_link (HNDLE hDB, HNDLE hKey, KEY *key) |
INT | db_get_key_time (HNDLE hDB, HNDLE hKey, DWORD *delta) |
INT | db_get_key_info (HNDLE hDB, HNDLE hKey, char *name, INT name_size, INT *type, INT *num_values, INT *item_size) |
INT | db_rename_key (HNDLE hDB, HNDLE hKey, const char *name) |
INT | db_reorder_key (HNDLE hDB, HNDLE hKey, INT idx) |
INT | db_get_data (HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type) |
INT | db_get_link_data (HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type) |
INT | db_get_data1 (HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type, INT *num_values) |
INT | db_get_data_index (HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, INT idx, DWORD type) |
INT | db_set_data (HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type) |
INT | db_set_data1 (HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type) |
INT | db_set_link_data (HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type) |
INT | db_set_num_values (HNDLE hDB, HNDLE hKey, INT num_values) |
INT | db_set_data_index (HNDLE hDB, HNDLE hKey, const void *data, INT data_size, INT idx, DWORD type) |
INT | db_set_link_data_index (HNDLE hDB, HNDLE hKey, const void *data, INT data_size, INT idx, DWORD type) |
INT | db_set_data_index1 (HNDLE hDB, HNDLE hKey, const void *data, INT data_size, INT idx, DWORD type, BOOL bNotify) |
INT | db_merge_data (HNDLE hDB, HNDLE hKeyRoot, const char *name, void *data, INT data_size, INT num_values, INT type) |
INT | db_set_mode (HNDLE hDB, HNDLE hKey, WORD mode, BOOL recurse) |
INT | db_load (HNDLE hDB, HNDLE hKeyRoot, const char *filename, BOOL bRemote) |
INT | db_copy (HNDLE hDB, HNDLE hKey, char *buffer, INT *buffer_size, const char *path) |
INT | db_paste (HNDLE hDB, HNDLE hKeyRoot, const char *buffer) |
static int | db_paste_node (HNDLE hDB, HNDLE hKeyRoot, PMXML_NODE node) |
INT | db_paste_xml (HNDLE hDB, HNDLE hKeyRoot, const char *buffer) |
INT | db_copy_xml (HNDLE hDB, HNDLE hKey, char *buffer, int *buffer_size, bool header) |
void | name2c (char *str) |
static void | db_save_tree_struct (HNDLE hDB, HNDLE hKey, int hfile, INT level) |
INT | db_save (HNDLE hDB, HNDLE hKey, const char *filename, BOOL bRemote) |
void | xml_encode (char *src, int size) |
INT | db_save_xml (HNDLE hDB, HNDLE hKey, const char *filename) |
void | json_write (char **buffer, int *buffer_size, int *buffer_end, int level, const char *s, int quoted) |
static void | json_ensure_decimal_dot (char *str) |
static void | json_write_data (char **buffer, int *buffer_size, int *buffer_end, int level, const KEY *key, const char *p) |
static void | json_write_key (HNDLE hDB, HNDLE hKey, const KEY *key, const char *link_path, char **buffer, int *buffer_size, int *buffer_end) |
static int | db_save_json_key_obsolete (HNDLE hDB, HNDLE hKey, INT level, char **buffer, int *buffer_size, int *buffer_end, int save_keys, int follow_links, int recurse) |
INT | db_copy_json_array (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end) |
INT | db_copy_json_index (HNDLE hDB, HNDLE hKey, int index, char **buffer, int *buffer_size, int *buffer_end) |
static int | json_write_bare_key (HNDLE hDB, HNDLE hLink, const KEY &link, char **buffer, int *buffer_size, int *buffer_end, int level, int flags, time_t timestamp, bool need_comma) |
int | json_write_bare_subdir (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end, int level, int flags, time_t timestamp) |
int EXPRT | json_write_anything (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end, int level, int must_be_subdir, int flags, time_t timestamp) |
INT | db_copy_json_ls (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end) |
INT | db_copy_json_values (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end, int omit_names, int omit_last_written, time_t omit_old_timestamp, int preserve_case) |
INT | db_copy_json_save (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end) |
INT | db_copy_json_obsolete (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end, int save_keys, int follow_links, int recurse) |
INT | db_save_json (HNDLE hDB, HNDLE hKey, const char *filename, int flags) |
INT | db_save_struct (HNDLE hDB, HNDLE hKey, const char *file_name, const char *struct_name, BOOL append) |
INT | db_save_string (HNDLE hDB, HNDLE hKey, const char *file_name, const char *string_name, BOOL append) |
INT | db_sprintf (char *string, const void *data, INT data_size, INT idx, DWORD type) |
INT | db_sprintff (char *string, const char *format, const void *data, INT data_size, INT idx, DWORD type) |
INT | db_sprintfh (char *string, const void *data, INT data_size, INT idx, DWORD type) |
std::string | db_sprintf (const void *data, INT data_size, INT idx, DWORD type) |
std::string | db_sprintff (const char *format, const void *data, INT data_size, INT idx, DWORD type) |
std::string | db_sprintfh (const void *data, INT data_size, INT idx, DWORD type) |
INT | db_sscanf (const char *data_str, void *data, INT *data_size, INT i, DWORD tid) |
static void | db_recurse_record_tree_locked (HNDLE hDB, const DATABASE_HEADER *pheader, const KEY *pkey, void **data, INT *total_size, INT base_align, INT *max_align, BOOL bSet, INT convert_flags, db_err_msg **msg) |
static void | db_recurse_record_tree_locked (HNDLE hDB, HNDLE hKey, void **data, INT *total_size, INT base_align, INT *max_align, BOOL bSet, INT convert_flags, db_err_msg **msg) |
INT | db_get_record_size (HNDLE hDB, HNDLE hKey, INT align, INT *buf_size) |
INT | db_get_record (HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, INT align) |
INT | db_get_record1 (HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, INT align, const char *rec_str) |
static int | db_parse_record (const char *rec_str, const char **out_rec_str, char *title, int title_size, char *key_name, int key_name_size, int *tid, int *n_data, int *string_length) |
static int | db_get_record2_read_element (HNDLE hDB, HNDLE hKey, const char *key_name, int tid, int n_data, int string_length, char *buf_start, char **buf_ptr, int *buf_remain, BOOL correct) |
INT | db_get_record2 (HNDLE hDB, HNDLE hKey, void *data, INT *xbuf_size, INT align, const char *rec_str, BOOL correct) |
INT | db_set_record (HNDLE hDB, HNDLE hKey, void *data, INT buf_size, INT align) |
INT | db_add_open_record (HNDLE hDB, HNDLE hKey, WORD access_mode) |
INT | db_remove_open_record (HNDLE hDB, HNDLE hKey, BOOL lock) |
INT | db_notify_clients (HNDLE hDB, HNDLE hKeyMod, int index, BOOL bWalk) |
INT | db_notify_clients_array (HNDLE hDB, HNDLE hKeys[], INT size) |
static void | merge_records (HNDLE hDB, HNDLE hKey, KEY *pkey, INT level, void *info) |
static void | check_open_keys (HNDLE hDB, HNDLE hKey, KEY *pkey, INT level, void *info) |
INT | db_create_record (HNDLE hDB, HNDLE hKey, const char *orig_key_name, const char *init_str) |
INT | db_check_record (HNDLE hDB, HNDLE hKey, const char *keyname, const char *rec_str, BOOL correct) |
INT | db_open_record (HNDLE hDB, HNDLE hKey, void *ptr, INT rec_size, WORD access_mode, void(*dispatcher)(INT, INT, void *), void *info) |
INT | db_open_record1 (HNDLE hDB, HNDLE hKey, void *ptr, INT rec_size, WORD access_mode, void(*dispatcher)(INT, INT, void *), void *info, const char *rec_str) |
INT | db_close_record (HNDLE hDB, HNDLE hKey) |
INT | db_close_all_records () |
INT | db_update_record_local (INT hDB, INT hKeyRoot, INT hKey, int index) |
INT | db_update_record_mserver (INT hDB, INT hKeyRoot, INT hKey, int index, int client_socket) |
INT | db_send_changed_records () |
INT | db_watch (HNDLE hDB, HNDLE hKey, void(*dispatcher)(INT, INT, INT, void *), void *info) |
INT | db_unwatch (HNDLE hDB, HNDLE hKey) |
INT | db_unwatch_all () |
INT EXPRT | db_get_value_string (HNDLE hdb, HNDLE hKeyRoot, const char *key_name, int index, std::string *s, BOOL create, int create_string_length) |
INT EXPRT | db_set_value_string (HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const std::string *s) |
INT EXPRT | db_resize_string (HNDLE hdb, HNDLE hKeyRoot, const char *key_name, int num_values, int max_string_length) |
MJsonNode * | db_scl (HNDLE hDB) |
MJsonNode * | db_sor (HNDLE hDB, const char *root_path) |
INT EXPRT | db_set_record2 (HNDLE hdb, HNDLE hKey, void *data, INT buf_size, INT align, const char *rec_str) |
INT EXPRT | db_watch (HNDLE hDB, HNDLE hKey, void(*dispatcher)(INT, INT, INT, void *info), void *info) |
INT EXPRT | db_load_json (HNDLE hdb, HNDLE key_handle, const char *filename) |
INT EXPRT | db_paste_json (HNDLE hDB, HNDLE hKey, const char *buffer) |
INT EXPRT | db_paste_json_node (HNDLE hDB, HNDLE hKey, int index, const MJsonNode *json_node) |
Variables | |
static DATABASE * | _database |
static INT | _database_entries = 0 |
static RECORD_LIST * | _record_list |
static INT | _record_list_entries = 0 |
static WATCH_LIST * | _watch_list |
static INT | _watch_list_entries = 0 |
static db_err_msg * | _last_error_message = NULL |
static int | _global_open_count |
dox
typedef struct db_err_msg_struct db_err_msg |
|
static |
dox
Definition at line 12367 of file odb.cxx.
Definition at line 2537 of file odb.cxx.
Check if a client with a /system/client/xxx entry has a valid entry in the ODB client table. If not, remove that client from the /system/client tree.
hDB | Handle to online database |
hKeyClient | Handle to client key |
Definition at line 3049 of file odb.cxx.
INT EXPRT db_check_record | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
const char * | keyname, | ||
const char * | rec_str, | ||
BOOL | correct | ||
) |
This function ensures that a certain ODB subtree matches a given C structure, by comparing the init_str with the current ODB structure. If the record does not exist at all, it is created with the default values in init_str. If it does exist but does not match the variables in init_str, the function returns an error if correct=FALSE or calls db_create_record() if correct=TRUE.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
keyname | Name of key to search, can contain directories. |
rec_str | ASCII representation of ODB record in the format |
correct | If TRUE, correct ODB record if necessary |
Definition at line 12975 of file odb.cxx.
|
static |
Definition at line 7142 of file odb.cxx.
|
static |
Definition at line 7095 of file odb.cxx.
Definition at line 2817 of file odb.cxx.
void db_cleanup2 | ( | const char * | client_name, |
int | ignore_timeout, | ||
DWORD | actual_time, | ||
const char * | who | ||
) |
Definition at line 2887 of file odb.cxx.
INT db_close_all_records | ( | void | ) |
Release local memory for open records. This routines is called by db_close_all_databases() and cm_disconnect_experiment()
Definition at line 13518 of file odb.cxx.
Close a database
hDB | ODB handle obtained via cm_get_experiment_database(). |
Definition at line 2143 of file odb.cxx.
Close a record previously opend with db_open_record.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
Definition at line 13477 of file odb.cxx.
Copy an ODB subtree in ASCII format to a buffer
This function converts the binary ODB contents to an ASCII. The function db_paste() can be used to convert the ASCII representation back to binary ODB contents. The functions db_load() and db_save() internally use db_copy() and db_paste(). This function converts the binary ODB contents to an ASCII representation of the form:
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
buffer | ASCII buffer which receives ODB contents. |
buffer_size | Size of buffer, returns remaining space in buffer. |
path | Internal use only, must be empty (""). |
Definition at line 8211 of file odb.cxx.
INT EXPRT db_copy_json_array | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
char ** | buffer, | ||
int * | buffer_size, | ||
int * | buffer_end | ||
) |
Copy an ODB array in JSON format to a buffer
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key |
buffer | returns pointer to ASCII buffer with ODB contents |
buffer_size | returns size of ASCII buffer |
buffer_end | returns number of bytes contained in buffer |
Definition at line 10154 of file odb.cxx.
INT EXPRT db_copy_json_index | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
int | index, | ||
char ** | buffer, | ||
int * | buffer_size, | ||
int * | buffer_end | ||
) |
Copy an ODB array element in JSON format to a buffer
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key |
index | Array index |
buffer | returns pointer to ASCII buffer with ODB contents |
buffer_size | returns size of ASCII buffer |
buffer_end | returns number of bytes contained in buffer |
Definition at line 10223 of file odb.cxx.
INT EXPRT db_copy_json_ls | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
char ** | buffer, | ||
int * | buffer_size, | ||
int * | buffer_end | ||
) |
Definition at line 10425 of file odb.cxx.
INT EXPRT db_copy_json_obsolete | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
char ** | buffer, | ||
int * | buffer_size, | ||
int * | buffer_end, | ||
int | save_keys, | ||
int | follow_links, | ||
int | recurse | ||
) |
Copy an ODB subtree in JSON format to a buffer
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
buffer | returns pointer to ASCII buffer with ODB contents |
buffer_size | returns size of ASCII buffer |
buffer_end | returns number of bytes contained in buffer |
Definition at line 10512 of file odb.cxx.
INT EXPRT db_copy_json_save | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
char ** | buffer, | ||
int * | buffer_size, | ||
int * | buffer_end | ||
) |
Definition at line 10479 of file odb.cxx.
INT EXPRT db_copy_json_values | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
char ** | buffer, | ||
int * | buffer_size, | ||
int * | buffer_end, | ||
int | omit_names, | ||
int | omit_last_written, | ||
time_t | omit_old_timestamp, | ||
int | preserve_case | ||
) |
Definition at line 10447 of file odb.cxx.
Copy an ODB subtree in XML format to a buffer
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
buffer | ASCII buffer which receives ODB contents. |
buffer_size | Size of buffer, returns remaining space in buffer. |
Definition at line 9037 of file odb.cxx.
Create a new key in a database
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Key handle to start with, 0 for root |
key_name | Name of key in the form "/key/key/key" |
type | Type of key, one of TID_xxx (see Midas_Data_Types) |
Definition at line 3298 of file odb.cxx.
|
static |
Definition at line 3354 of file odb.cxx.
INT EXPRT db_create_link | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
const char * | link_name, | ||
const char * | destination | ||
) |
Create a link to a key or set the destination of and existing link.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Key handle to start with, 0 for root |
link_name | Name of key in the form "/key/key/key" |
destination | Destination of link in the form "/key/key/key" |
Definition at line 3591 of file odb.cxx.
INT EXPRT db_create_record | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
const char * | orig_key_name, | ||
const char * | init_str | ||
) |
dox Create a record. If a part of the record exists alreay, merge it with the init_str (use values from the init_str only when they are not in the existing record).
This functions creates a ODB sub-tree according to an ASCII representation of that tree. See db_copy() for a description. It can be used to create a sub-tree which exactly matches a C structure. The sub-tree can then later mapped to the C structure ("hot-link") via the function db_open_record().
If a sub-tree exists already which exactly matches the ASCII representation, it is not modified. If part of the tree exists, it is merged with the ASCII representation where the ODB values have priority, only values not present in the ODB are created with the default values of the ASCII representation. It is therefore recommended that before creating an ODB hot-link the function db_create_record() is called to insure that the ODB tree and the C structure contain exactly the same values in the same order.
Following example creates a record under /Equipment/Trigger/Settings, opens a hot-link between that record and a local C structure trigger_settings and registers a callback function trigger_update() which gets called each time the record is changed.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
orig_key_name | Name of key to search, can contain directories. |
init_str | Initialization string in the format of the db_copy/db_save functions. |
Definition at line 12803 of file odb.cxx.
|
static |
Definition at line 2750 of file odb.cxx.
|
static |
Delete a subtree in a database starting from a key (including this key).
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | for key where search starts, zero for root. |
follow_links | Follow links when TRUE. |
Definition at line 3846 of file odb.cxx.
Delete a subtree, using level information (only called internally by db_delete_key())
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Key handle to start with, 0 for root |
level | Recursion level, must be zero when |
follow_links | Follow links when TRUE called from a user routine |
Definition at line 3659 of file odb.cxx.
|
static |
Enumerate subkeys from a key, follow links.
hkey must correspond to a valid ODB directory. The index is usually incremented in a loop until the last key is reached. Information about the sub-keys can be obtained with db_get_key(). If a returned key is of type TID_KEY, it contains itself sub-keys. To scan a whole ODB sub-tree, the function db_scan_tree() can be used.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
idx | Subkey index, sould be initially 0, then incremented in each call until subhKey becomes zero and the function returns DB_NO_MORE_SUBKEYS |
subkey_handle | Handle of subkey which can be used in db_get_key() and db_get_data() |
Definition at line 5576 of file odb.cxx.
|
static |
Returns key handle for a key with a specific name.
Keys can be accessed by their name including the directory or by a handle. A key handle is an internal offset to the shared memory where the ODB lives and allows a much faster access to a key than via its name.
The function db_find_key() must be used to convert a key name to a handle. Most other database functions use this key handle in various operations.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
key_name | Name of key to search, can contain directories. |
subhKey | Returned handle of key, zero if key cannot be found. |
Definition at line 4069 of file odb.cxx.
dox
Definition at line 4115 of file odb.cxx.
|
static |
INT EXPRT db_find_keys | ( | HNDLE | hDB, |
HNDLE | hKeyRoot, | ||
char * | odbpath, | ||
std::vector< HNDLE > & | hKeyVector | ||
) |
Definition at line 4576 of file odb.cxx.
Definition at line 4264 of file odb.cxx.
|
static |
|
static |
Definition at line 3855 of file odb.cxx.
|
static |
dox
Definition at line 2259 of file odb.cxx.
|
static |
dox Get key data from a handle
The function returns single values or whole arrays which are contained in an ODB key. Since the data buffer is of type void, no type checking can be performed by the compiler. Therefore the type has to be explicitly supplied, which is checked against the type stored in the ODB.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
data | Pointer to the return data. |
buf_size | Size of data buffer. |
type | Type of key, one of TID_xxx (see Midas_Data_Types). |
Definition at line 6529 of file odb.cxx.
INT EXPRT db_get_data1 | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
void * | data, | ||
INT * | buf_size, | ||
DWORD | type, | ||
INT * | num_values | ||
) |
dox
Definition at line 6747 of file odb.cxx.
INT EXPRT db_get_data_index | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
void * | data, | ||
INT * | buf_size, | ||
INT | idx, | ||
DWORD | type | ||
) |
dox returns a single value of keys containing arrays of values.
The function returns a single value of keys containing arrays of values.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
data | Size of data buffer. |
buf_size | Return size of the record. |
idx | Index of array [0..n-1]. |
type | Type of key, one of TID_xxx (see Midas_Data_Types). |
Definition at line 6885 of file odb.cxx.
|
static |
Definition at line 5496 of file odb.cxx.
Definition at line 789 of file odb.cxx.
Get key structure from a handle.
KEY structure has following format:
Most of these values are used for internal purposes, the values which are of public interest are type, name, num_values, item_size and total_size. For keys which contain a single value, num_values equals to one and total_size equals to item_size. For keys which contain an array of strings (TID_STRING), item_size equals to the length of one string.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. If Key is a link to an array element, this link is resolved. In this case function returns the key of the link destination and num_values is set to 1. |
key | Pointer to KEY stucture. |
Definition at line 6009 of file odb.cxx.
INT EXPRT db_get_key_info | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
char * | name, | ||
INT | name_size, | ||
INT * | type, | ||
INT * | num_values, | ||
INT * | item_size | ||
) |
Get key info (separate values instead of structure)
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle of key to operate on |
name | Key name |
name_size | Size of the give name (done with sizeof()) |
type | Key type (see Midas_Data_Types). |
num_values | Number of values in key. |
item_size | Size of individual key value (used for strings) |
Definition at line 6181 of file odb.cxx.
|
static |
Get time when key was last modified
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle of key to operate on |
delta | Seconds since last update |
Definition at line 6122 of file odb.cxx.
Same as db_get_key, but it does not follow links
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
key | Pointer to KEY stucture. |
Definition at line 6062 of file odb.cxx.
Same as db_get_data, but do not follow a link to an array index
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
data | Pointer to the return data. |
buf_size | Size of data buffer. |
type | Type of key, one of TID_xxx (see Midas_Data_Types). |
Definition at line 6646 of file odb.cxx.
DATABASE_CLIENT* db_get_my_client_locked | ( | DATABASE * | pdb | ) |
Definition at line 1368 of file odb.cxx.
Definition at line 5178 of file odb.cxx.
|
static |
Definition at line 1033 of file odb.cxx.
|
static |
|
static |
|
static |
Definition at line 933 of file odb.cxx.
|
static |
Definition at line 985 of file odb.cxx.
Copy a set of keys to local memory.
An ODB sub-tree can be mapped to a C structure automatically via a hot-link using the function db_open_record() or manually with this function. Problems might occur if the ODB sub-tree contains values which don't match the C structure. Although the structure size is checked against the sub-tree size, no checking can be done if the type and order of the values in the structure are the same than those in the ODB sub-tree. Therefore it is recommended to use the function db_create_record() before db_get_record() is used which ensures that both are equivalent.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
data | Pointer to the retrieved data. |
buf_size | Size of data structure, must be obtained via sizeof(RECORD-NAME). |
align | Byte alignment calculated by the stub and passed to the rpc side to align data according to local machine. Must be zero when called from user level. |
Definition at line 11713 of file odb.cxx.
INT EXPRT db_get_record1 | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
void * | data, | ||
INT * | buf_size, | ||
INT | align, | ||
const char * | rec_str | ||
) |
Same as db_get_record() but if there is a record mismatch between ODB structure and C record, it is automatically corrected by calling db_check_record()
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
data | Pointer to the retrieved data. |
buf_size | Size of data structure, must be obtained via sizeof(RECORD-NAME). |
align | Byte alignment calculated by the stub and passed to the rpc side to align data according to local machine. Must be zero when called from user level. |
rec_str | ASCII representation of ODB record in the format |
Definition at line 11809 of file odb.cxx.
INT EXPRT db_get_record2 | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
void * | data, | ||
INT * | xbuf_size, | ||
INT | align, | ||
const char * | rec_str, | ||
BOOL | correct | ||
) |
Copy a set of keys to local memory.
An ODB sub-tree can be mapped to a C structure automatically via a hot-link using the function db_open_record1() or manually with this function. For correct operation, the description string must match the C data structure. If the contents of ODB sub-tree does not exactly match the description string, db_get_record2() will try to read as much as it can and return DB_TRUNCATED to inform the user that there was a mismatch somewhere. To ensure that the ODB sub-tree matches the desciption string, call db_create_record() or db_check_record() before calling db_get_record2(). Unlike db_get_record() and db_get_record1(), this function will not complain about data strucure mismatches. It will ignore all extra entries in the ODB sub-tree and it will set to zero the C-structure data fields that do not have corresponding ODB entries.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
data | Pointer to the retrieved data. |
buf_size | Size of data structure, must be obtained via sizeof(data). |
align | Byte alignment calculated by the stub and passed to the rpc side to align data according to local machine. Must be zero when called from user level. |
rec_str | Description of the data structure, see db_create_record() |
correct | Must be set to zero |
Definition at line 12173 of file odb.cxx.
|
static |
Definition at line 12053 of file odb.cxx.
dox Calculates the size of a record.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
align | Byte alignment calculated by the stub and passed to the rpc side to align data according to local machine. Must be zero when called from user level |
buf_size | Size of record structure |
Definition at line 11619 of file odb.cxx.
INT EXPRT db_get_value | ( | HNDLE | hDB, |
HNDLE | hKeyRoot, | ||
const char * | key_name, | ||
void * | data, | ||
INT * | buf_size, | ||
DWORD | type, | ||
BOOL | create | ||
) |
Get value of a single key.
The function returns single values or whole arrays which are contained in an ODB key. Since the data buffer is of type void, no type checking can be performed by the compiler. Therefore the type has to be explicitly supplied, which is checked against the type stored in the ODB. key_name can contain the full path of a key (like: "/Equipment/Trigger/Settings/Level1") while hkey is zero which refers to the root, or hkey can refer to a sub-directory (like: /Equipment/Trigger) and key_name is interpreted relative to that directory like "Settings/Level1".
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKeyRoot | Handle for key where search starts, zero for root. |
key_name | Name of key to search, can contain directories. |
data | Address of data. |
buf_size | Maximum buffer size on input, number of written bytes on return. |
type | Type of key, one of TID_xxx (see Midas_Data_Types) |
create | If TRUE, create key if not existing |
Definition at line 5405 of file odb.cxx.
INT EXPRT db_get_value_string | ( | HNDLE | hdb, |
HNDLE | hKeyRoot, | ||
const char * | key_name, | ||
int | index, | ||
std::string * | s, | ||
BOOL | create, | ||
int | create_string_length | ||
) |
Definition at line 13937 of file odb.cxx.
Return watchdog information about specific client
hDB | ODB handle |
client_name | ODB client name |
timeout | Timeout for this application in seconds |
last | Last time watchdog was called in msec |
Definition at line 3004 of file odb.cxx.
dox Load a branch of a database from an .ODB file.
This function is used by the ODBEdit command load. For a description of the ASCII format, see db_copy(). Data can be loaded relative to the root of the ODB (hkey equal zero) or relative to a certain key.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKeyRoot | Handle for key where search starts, zero for root. |
filename | Filename of .ODB file. |
bRemote | If TRUE, the file is loaded by the server process on the back-end, if FALSE, it is loaded from the current process |
Definition at line 8120 of file odb.cxx.
Definition at line 18 of file json_paste.cxx.
dox Lock a database for exclusive access via system semaphore calls.
hDB | Handle to the database to lock |
Definition at line 2446 of file odb.cxx.
INT EXPRT db_merge_data | ( | HNDLE | hDB, |
HNDLE | hKeyRoot, | ||
const char * | name, | ||
void * | data, | ||
INT | data_size, | ||
INT | num_values, | ||
INT | type | ||
) |
Definition at line 7922 of file odb.cxx.
|
static |
Definition at line 12598 of file odb.cxx.
|
static |
INT EXPRT db_open_database | ( | const char * | xdatabase_name, |
INT | database_size, | ||
HNDLE * | hDB, | ||
const char * | client_name | ||
) |
dox Open an online database
database_name | Database name. |
database_size | Initial size of database if not existing |
client_name | Name of this application |
hDB | ODB handle obtained via cm_get_experiment_database(). |
Definition at line 1778 of file odb.cxx.
INT EXPRT db_open_record | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
void * | ptr, | ||
INT | rec_size, | ||
WORD | access_mode, | ||
void(*)(INT, INT, void *) | dispatcher, | ||
void * | info | ||
) |
Open a record. Create a local copy and maintain an automatic update.
This function opens a hot-link between an ODB sub-tree and a local structure. The sub-tree is copied to the structure automatically every time it is modified by someone else. Additionally, a callback function can be declared which is called after the structure has been updated. The callback function receives the database handle and the key handle as parameters.
Problems might occur if the ODB sub-tree contains values which don't match the C structure. Although the structure size is checked against the sub-tree size, no checking can be done if the type and order of the values in the structure are the same than those in the ODB sub-tree. Therefore it is recommended to use the function db_create_record() before db_open_record() is used which ensures that both are equivalent.
The access mode might either be MODE_READ or MODE_WRITE. In read mode, the ODB sub-tree is automatically copied to the local structure when modified by other clients. In write mode, the local structure is copied to the ODB sub-tree if it has been modified locally. This update has to be manually scheduled by calling db_send_changed_records() periodically in the main loop. The system keeps a copy of the local structure to determine if its contents has been changed.
If MODE_ALLOC is or'ed with the access mode, the memory for the structure is allocated internally. The structure pointer must contain a pointer to a pointer to the structure. The internal memory is released when db_close_record() is called.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
ptr | If access_mode includes MODE_ALLOC: Address of pointer which points to the record data after the call if access_mode includes not MODE_ALLOC: Address of record if ptr==NULL, only the dispatcher is called. |
rec_size | Record size in bytes |
access_mode | Mode for opening record, either MODE_READ or MODE_WRITE. May be or'ed with MODE_ALLOC to let db_open_record allocate the memory for the record. |
(*dispatcher) | Function which gets called when record is updated.The argument list composed of: HNDLE hDB, HNDLE hKey, void *info |
info | Additional info passed to the dispatcher. |
Definition at line 13294 of file odb.cxx.
INT EXPRT db_open_record1 | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
void * | ptr, | ||
INT | rec_size, | ||
WORD | access_mode, | ||
void(*)(INT, INT, void *) | dispatcher, | ||
void * | info, | ||
const char * | rec_str | ||
) |
Open a record. Create a local copy and maintain an automatic update.
This function is same as db_open_record(), except that it calls db_check_record(), db_get_record1() and db_create_record() to ensure that the ODB structure matches
Parameters are the same as for db_open_record():
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
ptr | If access_mode includes MODE_ALLOC: Address of pointer which points to the record data after the call if access_mode includes not MODE_ALLOC: Address of record if ptr==NULL, only the dispatcher is called. |
rec_size | Record size in bytes |
access_mode | Mode for opening record, either MODE_READ or MODE_WRITE. May be or'ed with MODE_ALLOC to let db_open_record allocate the memory for the record. |
(*dispatcher) | Function which gets called when record is updated.The argument list composed of: HNDLE hDB, HNDLE hKey, void *info |
info | Additional info passed to the dispatcher. |
rec_str | ASCII representation of ODB record in the format |
Definition at line 13445 of file odb.cxx.
|
static |
Copy an ODB subtree in ASCII format from a buffer
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKeyRoot | Handle for key where search starts, zero for root. |
buffer | NULL-terminated buffer |
Definition at line 8487 of file odb.cxx.
Definition at line 691 of file json_paste.cxx.
Definition at line 707 of file json_paste.cxx.
Definition at line 8780 of file odb.cxx.
Paste an ODB subtree in XML format from a buffer
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKeyRoot | Handle for key where search starts, zero for root. |
buffer | NULL-terminated buffer |
Definition at line 8998 of file odb.cxx.
|
static |
|
static |
Protect a database for read/write access outside of the db_xxx functions
hDB | ODB handle obtained via cm_get_experiment_database(). |
Definition at line 3157 of file odb.cxx.
|
static |
Definition at line 11443 of file odb.cxx.
|
static |
Definition at line 11579 of file odb.cxx.
|
static |
Definition at line 12456 of file odb.cxx.
INT EXPRT db_resize_string | ( | HNDLE | hdb, |
HNDLE | hKeyRoot, | ||
const char * | key_name, | ||
int | num_values, | ||
int | max_string_length | ||
) |
Change size of string arrays.
This function can change the number of elements and the string element length of an array of strings.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
key_name | Odb key name, if NULL, will resize ODB entry pointed to by hKey |
num_values | New number of array elements, if 0, remains unchanged |
max_string_length | New max string length for array elements, if 0, remains unchanged |
Definition at line 14028 of file odb.cxx.
|
static |
dox Save a branch of a database to an .ODB file
This function is used by the ODBEdit command save. For a description of the ASCII format, see db_copy(). Data of the whole ODB can be saved (hkey equal zero) or only a sub-tree.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
filename | Filename of .ODB file. |
bRemote | Flag for saving database on remote server. |
Definition at line 9246 of file odb.cxx.
Save a branch of a database to an .json file
This function is used by the ODBEdit command save to write the contents of the ODB into a JSON file. Data of the whole ODB can be saved (hkey equal zero) or only a sub-tree.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
filename | Filename of .json file. |
Definition at line 10531 of file odb.cxx.
|
static |
Definition at line 9812 of file odb.cxx.
INT EXPRT db_save_string | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
const char * | file_name, | ||
const char * | string_name, | ||
BOOL | append | ||
) |
dox
Definition at line 10691 of file odb.cxx.
INT EXPRT db_save_struct | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
const char * | file_name, | ||
const char * | struct_name, | ||
BOOL | append | ||
) |
Save a branch of a database to a C structure .H file
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
file_name | Filename of .ODB file. |
struct_name | Name of structure. If struct_name == NULL, the name of the key is used. |
append | If TRUE, append to end of existing file |
Definition at line 10630 of file odb.cxx.
Save a branch of a database to an .xml file
This function is used by the ODBEdit command save to write the contents of the ODB into a XML file. Data of the whole ODB can be saved (hkey equal zero) or only a sub-tree.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
filename | Filename of .XML file. |
Definition at line 9483 of file odb.cxx.
Definition at line 9347 of file odb.cxx.
INT EXPRT db_scan_tree | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
INT | level, | ||
INT(*)(HNDLE, HNDLE, KEY *, INT, void *) | callback, | ||
void * | info | ||
) |
INT EXPRT db_scan_tree_link | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
INT | level, | ||
void(*)(HNDLE, HNDLE, KEY *, INT, void *) | callback, | ||
void * | info | ||
) |
|
static |
int db_scan_tree_locked | ( | const DATABASE_HEADER * | pheader, |
const KEY * | pkey, | ||
int | level, | ||
int(*)(const DATABASE_HEADER *pheader, const KEY *, int, void *, db_err_msg **msg) | callback, | ||
void * | info, | ||
db_err_msg ** | msg | ||
) |
Definition at line 14114 of file odb.cxx.
Send all records to the ODB which were changed locally since the last call to this function.
This function is valid if used in conjunction with db_open_record() under the condition the record is open as MODE_WRITE access code.
Definition at line 13781 of file odb.cxx.
INT EXPRT db_set_data | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
const void * | data, | ||
INT | buf_size, | ||
INT | num_values, | ||
DWORD | type | ||
) |
Set key data from a handle. Adjust number of values if previous data has different size.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
data | Buffer from which data gets copied to. |
buf_size | Size of data buffer. |
num_values | Number of data values (for arrays). |
type | Type of key, one of TID_xxx (see Midas_Data_Types). |
Definition at line 7209 of file odb.cxx.
INT EXPRT db_set_data1 | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
const void * | data, | ||
INT | buf_size, | ||
INT | num_values, | ||
DWORD | type | ||
) |
Definition at line 7307 of file odb.cxx.
INT EXPRT db_set_data_index | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
const void * | data, | ||
INT | data_size, | ||
INT | idx, | ||
DWORD | type | ||
) |
dox Set key data for a key which contains an array of values.
This function sets individual values of a key containing an array. If the index is larger than the array size, the array is extended and the intermediate values are set to zero.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
data | Pointer to single value of data. |
data_size | |
idx | Size of single data element. |
type | Type of key, one of TID_xxx (see Midas_Data_Types). |
Definition at line 7642 of file odb.cxx.
INT EXPRT db_set_data_index1 | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
const void * | data, | ||
INT | data_size, | ||
INT | idx, | ||
DWORD | type, | ||
BOOL | bNotify | ||
) |
dox
Definition at line 7822 of file odb.cxx.
|
static |
Definition at line 7051 of file odb.cxx.
|
static |
Set key data, adjust number of values if previous data has different size.
pkey | Key to change |
idx | Data index to change, "-1" means the whole array of data |
data | Buffer from which data gets copied to. |
data_size | Size of data buffer. |
num_values | Number of data values (for arrays). |
type | Type of key, one of TID_xxx (see Midas_Data_Types). |
Definition at line 7008 of file odb.cxx.
INT EXPRT db_set_link_data | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
const void * | data, | ||
INT | buf_size, | ||
INT | num_values, | ||
DWORD | type | ||
) |
Same as db_set_data, but it does not follow a link to an array index
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
data | Buffer from which data gets copied to. |
buf_size | Size of data buffer. |
num_values | Number of data values (for arrays). |
type | Type of key, one of TID_xxx (see Midas_Data_Types). |
Definition at line 7419 of file odb.cxx.
INT EXPRT db_set_link_data_index | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
const void * | data, | ||
INT | data_size, | ||
INT | idx, | ||
DWORD | type | ||
) |
Same as db_set_data_index, but does not follow links.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
data | Pointer to single value of data. |
data_size | |
idx | Size of single data element. |
type | Type of key, one of TID_xxx (see Midas_Data_Types). |
Definition at line 7748 of file odb.cxx.
|
static |
dox
Definition at line 7496 of file odb.cxx.
Copy a set of keys from local memory to the database.
An ODB sub-tree can be mapped to a C structure automatically via a hot-link using the function db_open_record() or manually with this function. Problems might occur if the ODB sub-tree contains values which don't match the C structure. Although the structure size is checked against the sub-tree size, no checking can be done if the type and order of the values in the structure are the same than those in the ODB sub-tree. Therefore it is recommended to use the function db_create_record() before using this function.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key where search starts, zero for root. |
data | Pointer where data is stored. |
buf_size | Size of data structure, must be obtained via sizeof(RECORD-NAME). |
align | Byte alignment calculated by the stub and passed to the rpc side to align data according to local machine. Must be zero when called from user level. |
Definition at line 12295 of file odb.cxx.
INT EXPRT db_set_record2 | ( | HNDLE | hdb, |
HNDLE | hKey, | ||
void * | data, | ||
INT | buf_size, | ||
INT | align, | ||
const char * | rec_str | ||
) |
INT EXPRT db_set_value | ( | HNDLE | hDB, |
HNDLE | hKeyRoot, | ||
const char * | key_name, | ||
const void * | data, | ||
INT | data_size, | ||
INT | num_values, | ||
DWORD | type | ||
) |
dox Set value of a single key.
The function sets a single value or a whole array to a ODB key. Since the data buffer is of type void, no type checking can be performed by the compiler. Therefore the type has to be explicitly supplied, which is checked against the type stored in the ODB. key_name can contain the full path of a key (like: "/Equipment/Trigger/Settings/Level1") while hkey is zero which refers to the root, or hkey can refer to a sub-directory (like /Equipment/Trigger) and key_name is interpreted relative to that directory like "Settings/Level1".
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKeyRoot | Handle for key where search starts, zero for root. |
key_name | Name of key to search, can contain directories. |
data | Address of data. |
data_size | Size of data (in bytes). |
num_values | Number of data elements. |
type | Type of key, one of TID_xxx (see Midas_Data_Types) |
Definition at line 5251 of file odb.cxx.
INT EXPRT db_set_value_index | ( | HNDLE | hDB, |
HNDLE | hKeyRoot, | ||
const char * | key_name, | ||
const void * | data, | ||
INT | data_size, | ||
INT | idx, | ||
DWORD | type, | ||
BOOL | trunc | ||
) |
Set single value of an array.
The function sets a single value of an ODB key which is an array. key_name can contain the full path of a key (like: "/Equipment/Trigger/Settings/Level1") while hkey is zero which refers to the root, or hkey can refer to a sub-directory (like /Equipment/Trigger) and key_name is interpreted relative to that directory like "Settings/Level1".
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKeyRoot | Handle for key where search starts, zero for root. |
key_name | Name of key to search, can contain directories. |
data | Address of data. |
data_size | Size of data (in bytes). |
index | Array index of value. |
type | Type of key, one of TID_xxx (see Midas_Data_Types) |
truncate | Truncate array to current index if TRUE |
Definition at line 5355 of file odb.cxx.
INT EXPRT db_set_value_string | ( | HNDLE | hDB, |
HNDLE | hKeyRoot, | ||
const char * | key_name, | ||
const std::string * | s | ||
) |
|
static |
Definition at line 5290 of file odb.cxx.
void db_set_watchdog_params | ( | DWORD | timeout | ) |
Definition at line 673 of file odb.cxx.
dox Convert a database value to a string according to its type.
This function is a convenient way to convert a binary ODB value into a string depending on its type if is not known at compile time. If it is known, the normal sprintf() function can be used.
string | output ASCII string of data. must be at least MAX_STRING_LENGTH bytes long. |
data | Value data. |
data_size | Size of single data element. |
idx | Index for array data. |
type | Type of key, one of TID_xxx (see Midas_Data_Types). |
Definition at line 10847 of file odb.cxx.
Convert a database value to a string according to its type.
This function is a convenient way to convert a binary ODB value into a string depending on its type if is not known at compile time. If it is known, the normal sprintf() function can be used.
data | Value data. |
data_size | Size of single data element. |
idx | Index for array data. |
type | Type of key, one of TID_xxx (see Midas_Data_Types). |
Definition at line 11091 of file odb.cxx.
INT EXPRT db_sprintff | ( | char * | string, |
const char * | format, | ||
const void * | data, | ||
INT | data_size, | ||
INT | idx, | ||
DWORD | type | ||
) |
Same as db_sprintf, but with additional format parameter
string | output ASCII string of data. |
format | Format specifier passed to sprintf() |
data | Value data. |
data_size | Size of single data element. |
idx | Index for array data. |
type | Type of key, one of TID_xxx (see Midas_Data_Types). |
Definition at line 10923 of file odb.cxx.
std::string EXPRT db_sprintff | ( | const char * | format, |
const void * | data, | ||
INT | data_size, | ||
INT | idx, | ||
DWORD | type | ||
) |
Same as db_sprintf, but with additional format parameter
string | output ASCII string of data. |
format | Format specifier passed to sprintf() |
data | Value data. |
data_size | Size of single data element. |
idx | Index for array data. |
type | Type of key, one of TID_xxx (see Midas_Data_Types). |
Definition at line 11167 of file odb.cxx.
Unlock a database via system semaphore calls.
hDB | Handle to the database to unlock |
Definition at line 2565 of file odb.cxx.
Remove watch callback from a key previously watched with db_watch.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key, zero for root. |
Definition at line 13890 of file odb.cxx.
Closes all watched variables. This routines is called by db_close_all_databases() and cm_disconnect_experiment()
Definition at line 13920 of file odb.cxx.
Update last activity time
Definition at line 2682 of file odb.cxx.
|
static |
Definition at line 1510 of file odb.cxx.
db_open_record() and db_watch() event handler
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key which changed. |
index | Index for array keys. |
Definition at line 13556 of file odb.cxx.
Relay db_open_record() and db_watch() notification to the remote client.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key which changed. |
index | Index for array keys. |
s | client socket. |
Definition at line 13603 of file odb.cxx.
|
static |
Definition at line 1650 of file odb.cxx.
|
static |
Definition at line 1148 of file odb.cxx.
|
static |
|
static |
|
static |
|
static |
Definition at line 836 of file odb.cxx.
|
static |
Definition at line 1587 of file odb.cxx.
|
static |
Definition at line 1402 of file odb.cxx.
Watch an ODB subtree. The callback function gets called whenever a key in the watched subtree changes. The callback function receives the database handle and the key handle as parameters.
hDB | ODB handle obtained via cm_get_experiment_database(). |
hKey | Handle for key at top of subtree to watch, zero for root. |
(*dispatcher) | Function which gets called when record is updated.The argument list composed of: HNDLE hDB, HNDLE hKey |
Definition at line 13815 of file odb.cxx.
INT EXPRT db_watch | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
void(*)(INT, INT, INT, void *info) | dispatcher, | ||
void * | info | ||
) |
BOOL ends_with_ustring | ( | const char * | str, |
const char * | suffix | ||
) |
BOOL equal_ustring | ( | const char * | str1, |
const char * | str2 | ||
) |
const char* extract_key | ( | const char * | key_list, |
char * | key_name, | ||
int | key_name_length | ||
) |
|
static |
Definition at line 451 of file odb.cxx.
|
static |
|
static |
|
static |
void EXPRT json_write | ( | char ** | buffer, |
int * | buffer_size, | ||
int * | buffer_end, | ||
int | level, | ||
const char * | s, | ||
int | quoted | ||
) |
int EXPRT json_write_anything | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
char ** | buffer, | ||
int * | buffer_size, | ||
int * | buffer_end, | ||
int | level, | ||
int | must_be_subdir, | ||
int | flags, | ||
time_t | timestamp | ||
) |
Definition at line 10388 of file odb.cxx.
|
static |
Definition at line 10254 of file odb.cxx.
int json_write_bare_subdir | ( | HNDLE | hDB, |
HNDLE | hKey, | ||
char ** | buffer, | ||
int * | buffer_size, | ||
int * | buffer_end, | ||
int | level, | ||
int | flags, | ||
time_t | timestamp | ||
) |
Definition at line 10356 of file odb.cxx.
|
static |
Definition at line 9643 of file odb.cxx.
|
static |
|
static |
Definition at line 363 of file odb.cxx.
|
static |
Definition at line 12663 of file odb.cxx.
void name2c | ( | char * | str | ) |
|
static |
void strarrayindex | ( | char * | odbpath, |
int * | index1, | ||
int * | index2 | ||
) |
char EXPRT * strcomb | ( | const char ** | list | ) |
std::string EXPRT strcomb1 | ( | const char ** | list | ) |
BOOL strmatch | ( | char * | pattern, |
char * | str | ||
) |
|
static |
Definition at line 339 of file odb.cxx.
void xml_encode | ( | char * | src, |
int | size | ||
) |
|
static |
|
static |
|
static |