|
MIDAS
|
Classes | |
| struct | db_err_msg_struct |
| 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 bool | db_validate_key_offset (const DATABASE_HEADER *pheader, int offset) |
| static bool | db_validate_data_offset (const DATABASE_HEADER *pheader, int offset) |
| static HNDLE | db_pkey_to_hkey (const DATABASE_HEADER *pheader, const KEY *pkey) |
| static const KEY * | db_get_pkey (const DATABASE_HEADER *pheader, HNDLE hKey, int *pstatus, const char *caller, db_err_msg **msg) |
| static const KEY * | db_get_parent (const DATABASE_HEADER *pheader, const KEY *pkey, int *pstatus, const char *caller, db_err_msg **msg) |
| static const KEYLIST * | db_get_pkeylist (const DATABASE_HEADER *pheader, const KEY *pkey, const char *caller, db_err_msg **msg, bool kludge_repair=false) |
| static INT | db_find_key_locked (const DATABASE_HEADER *pheader, HNDLE hKey, const char *key_name, bool follow_links, HNDLE *subhKey, db_err_msg **msg) |
| static const KEY * | db_find_pkey_locked (const DATABASE_HEADER *pheader, const KEY *pkey, const char *key_name, bool follow_links, 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_pkey (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 *pdb, 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_delete_key_locked (DATABASE *pdb, const KEY *pkey, int level, db_err_msg **msg) |
| static int | db_set_value_wlocked (DATABASE *pdb, 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 DATABASE * | db_lock_database (HNDLE hDB, int *pstatus, const char *caller, bool check_attached=true) |
| static void | db_unlock_database (DATABASE *pdb, const char *caller) |
| 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 INT | print_key_info_locked (const DATABASE_HEADER *pheader, const KEY *pkey, INT level, void *info, db_err_msg **msg) |
| std::string | db_show_mem (HNDLE hDB, 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_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 void | db_print_pkey (const DATABASE_HEADER *pheader, const KEY *pkey, int recurse=0, const char *path=NULL, HNDLE parenthkeylist=0) |
| static void | db_print_hkey (const DATABASE_HEADER *pheader, HNDLE hkey, int recurse=0, const char *path=NULL, HNDLE parenthkeylist=0) |
| 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 (DATABASE *pdb, 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) |
| static int | db_check_open_record (const DATABASE_HEADER *pheader, const KEY *pkey, db_err_msg **msg) |
| INT | db_delete_key (HNDLE hDB, HNDLE hKey, BOOL follow_links) |
| INT | db_delete_key (HNDLE hDB, HNDLE hKey) |
| INT | db_delete (HNDLE hDB, HNDLE hKeyRoot, const char *odb_path) |
| INT | db_find_key (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_keys (HNDLE hDB, HNDLE hKeyRoot, const 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 (const DATABASE *pdb, 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 (const DATABASE *pdb, 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 |
Definition at line 12512 of file odb.cxx.

dox
Definition at line 12140 of file odb.cxx.


Definition at line 2619 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 3143 of file odb.cxx.


|
static |
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 | Not used |
Definition at line 3758 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 12750 of file odb.cxx.


|
static |
Definition at line 6919 of file odb.cxx.


|
static |
Definition at line 6872 of file odb.cxx.


Definition at line 2911 of file odb.cxx.


| void db_cleanup2 | ( | const char * | client_name, |
| int | ignore_timeout, | ||
| DWORD | actual_time, | ||
| const char * | who | ||
| ) |
Definition at line 2981 of file odb.cxx.


Definition at line 2398 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 13293 of file odb.cxx.

Close a database
| hDB | ODB handle obtained via cm_get_experiment_database(). |
Definition at line 2190 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 13252 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 7977 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 9920 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 9989 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 10189 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 10276 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 10243 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 10211 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 8802 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 3392 of file odb.cxx.


|
static |
Definition at line 3449 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 3688 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 12578 of file odb.cxx.


Definition at line 3999 of file odb.cxx.


Delete client info from database
| hDB | Database handle |
| pid | PID of entry to delete, zero for this process. |
Definition at line 2876 of file odb.cxx.


|
static |
Definition at line 2844 of file odb.cxx.


|
static |
Definition at line 2809 of file odb.cxx.


Definition at line 3966 of file odb.cxx.

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 3933 of file odb.cxx.


|
static |
Definition at line 3782 of file odb.cxx.


|
static |
Definition at line 1083 of file odb.cxx.


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 5357 of file odb.cxx.

dox
Definition at line 5496 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 4256 of file odb.cxx.

|
static |
Definition at line 4208 of file odb.cxx.


| INT EXPRT db_find_keys | ( | HNDLE | hDB, |
| HNDLE | hKeyRoot, | ||
| const char * | odbpath, | ||
| std::vector< HNDLE > & | hKeyVector | ||
| ) |
Definition at line 4352 of file odb.cxx.


dox
Definition at line 4293 of file odb.cxx.


|
static |
Definition at line 4871 of file odb.cxx.


|
static |
Definition at line 4042 of file odb.cxx.


|
static |
Definition at line 4913 of file odb.cxx.


dox
Definition at line 2306 of file odb.cxx.


|
static |
Definition at line 193 of file odb.cxx.


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 6310 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 6527 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 6664 of file odb.cxx.


|
static |
Definition at line 5277 of file odb.cxx.


Definition at line 811 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 5790 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 5962 of file odb.cxx.


|
static |
dox
Definition at line 5713 of file odb.cxx.


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 5903 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 5843 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 6427 of file odb.cxx.


| DATABASE_CLIENT * db_get_my_client_locked | ( | DATABASE * | pdb | ) |
Definition at line 1398 of file odb.cxx.


Definition at line 5587 of file odb.cxx.


Definition at line 4955 of file odb.cxx.


|
static |
Definition at line 1057 of file odb.cxx.


Definition at line 4476 of file odb.cxx.

Definition at line 4825 of file odb.cxx.

Definition at line 4775 of file odb.cxx.


|
static |
Definition at line 4747 of file odb.cxx.


|
static |
Definition at line 4682 of file odb.cxx.


|
static |
Definition at line 959 of file odb.cxx.


|
static |
Definition at line 1011 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 11483 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 11581 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 11944 of file odb.cxx.


|
static |
Definition at line 11825 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 11387 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 5185 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 13714 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 3098 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 7886 of file odb.cxx.


Definition at line 15 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 2493 of file odb.cxx.

|
static |
Definition at line 2508 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 7688 of file odb.cxx.

|
static |
Definition at line 142 of file odb.cxx.

Definition at line 12372 of file odb.cxx.

Definition at line 12401 of file odb.cxx.


|
static |
Definition at line 12316 of file odb.cxx.


| 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 1820 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 13069 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 13220 of file odb.cxx.


|
static |
Definition at line 11642 of file odb.cxx.


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 8252 of file odb.cxx.


Definition at line 687 of file json_paste.cxx.


Definition at line 700 of file json_paste.cxx.


Definition at line 8545 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 8763 of file odb.cxx.


|
static |
|
static |
Definition at line 1162 of file odb.cxx.

|
static |
Definition at line 134 of file odb.cxx.

|
static |
Definition at line 1138 of file odb.cxx.


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 3251 of file odb.cxx.


|
static |
Definition at line 11208 of file odb.cxx.


|
static |
Definition at line 11348 of file odb.cxx.

|
static |
Definition at line 12229 of file odb.cxx.


dox
Definition at line 6032 of file odb.cxx.


Definition at line 6132 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 13805 of file odb.cxx.


|
static |
Definition at line 1119 of file odb.cxx.


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 9010 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 10295 of file odb.cxx.


|
static |
Definition at line 9581 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 10456 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 10395 of file odb.cxx.


Definition at line 8883 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 9250 of file odb.cxx.


Definition at line 9111 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 4600 of file odb.cxx.

Definition at line 13891 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 13556 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 6986 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 7084 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 7415 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 7591 of file odb.cxx.


|
static |
Definition at line 6828 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 6785 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 7196 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 7520 of file odb.cxx.


Definition at line 2748 of file odb.cxx.


Definition at line 7787 of file odb.cxx.


|
static |
Definition at line 7739 of file odb.cxx.


dox
Definition at line 7270 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 12067 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 5028 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 5135 of file odb.cxx.


| INT EXPRT db_set_value_string | ( | HNDLE | hDB, |
| HNDLE | hKeyRoot, | ||
| const char * | key_name, | ||
| const std::string * | s | ||
| ) |
Definition at line 13785 of file odb.cxx.


|
static |
Definition at line 5068 of file odb.cxx.


| void db_set_watchdog_params | ( | DWORD | timeout | ) |
Definition at line 3060 of file odb.cxx.


Definition at line 704 of file odb.cxx.


Definition at line 13941 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 10612 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 10856 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 10688 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 10932 of file odb.cxx.

Definition at line 10752 of file odb.cxx.


dox
Definition at line 10999 of file odb.cxx.

Definition at line 11083 of file odb.cxx.


|
static |
Definition at line 2670 of file odb.cxx.

Unlock a database via system semaphore calls.
| hDB | Handle to the database to unlock |
Definition at line 2648 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 13667 of file odb.cxx.


Closes all watched variables. This routines is called by db_close_all_databases() and cm_disconnect_experiment()
Definition at line 13697 of file odb.cxx.


Update last activity time
Definition at line 2776 of file odb.cxx.


|
static |
Definition at line 1552 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 13331 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 13378 of file odb.cxx.


|
static |
Definition at line 1692 of file odb.cxx.


|
static |
Definition at line 1173 of file odb.cxx.


|
static |
|
static |
|
static |
|
static |
Definition at line 862 of file odb.cxx.


|
static |
Definition at line 1629 of file odb.cxx.


|
static |
Definition at line 1444 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 4 parameters: the database handle, the key handle of the entry that changed (could be a child if you're watching a directory), the index that changed (if it was part of an array), a user-specified 'info' parameter.
| 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, INT idx, void* info |
Definition at line 13592 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 | ||
| ) |
Definition at line 3285 of file odb.cxx.
| const char * extract_key | ( | const char * | key_list, |
| char * | key_name, | ||
| int | key_name_length | ||
| ) |
|
static |
Definition at line 516 of file odb.cxx.


|
static |
Definition at line 345 of file odb.cxx.


|
static |
|
static |
Definition at line 9397 of file odb.cxx.


| void EXPRT json_write | ( | char ** | buffer, |
| int * | buffer_size, | ||
| int * | buffer_end, | ||
| int | level, | ||
| const char * | s, | ||
| int | quoted | ||
| ) |
Definition at line 9297 of file odb.cxx.

| 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 10152 of file odb.cxx.


|
static |
Definition at line 10020 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 10122 of file odb.cxx.


|
static |
Definition at line 9412 of file odb.cxx.


|
static |
Definition at line 9529 of file odb.cxx.


|
static |
Definition at line 428 of file odb.cxx.


|
static |
Definition at line 226 of file odb.cxx.


Definition at line 12437 of file odb.cxx.


| void name2c | ( | char * | str | ) |
|
static |
|
static |
Definition at line 597 of file odb.cxx.


| void strarrayindex | ( | char * | odbpath, |
| int * | index1, | ||
| int * | index2 | ||
| ) |
Definition at line 3357 of file odb.cxx.

| char EXPRT * strcomb | ( | const char ** | list | ) |
| std::string EXPRT strcomb1 | ( | const char ** | list | ) |
| BOOL strmatch | ( | char * | pattern, |
| char * | str | ||
| ) |
Definition at line 3319 of file odb.cxx.


|
static |
Definition at line 404 of file odb.cxx.


| void xml_encode | ( | char * | src, |
| int | size | ||
| ) |
Definition at line 9068 of file odb.cxx.
|
static |
|
static |
|
static |