ARB
|
#include "gb_data.h"
#include "gb_main.h"
#include <arb_sort.h>
#include <arb_file.h>
#include <arb_sleep.h>
#include <arb_str.h>
#include <arb_strarray.h>
#include <ad_cb.h>
#include <algorithm>
#include "ad_remote.h"
Go to the source code of this file.
Classes | |
struct | GB_DbScanner |
struct | scan_db_insert |
Macros | |
#define | GBT_SUM_LEN 4096 |
#define | IF_DUMP_HANDSHAKE(cmd) |
Functions | |
GBDATA * | GBT_create (GBDATA *father, const char *key, long delete_level) |
GBDATA * | GBT_find_or_create (GBDATA *father, const char *key, long delete_level) |
char * | GBT_get_default_helix (GBDATA *) |
char * | GBT_get_default_helix_nr (GBDATA *) |
char * | GBT_get_default_ref (GBDATA *) |
static void | gbt_scan_db_rek (GBDATA *gbd, char *prefix, GB_DbScanner *scanner) |
static void | gbt_scan_db_start (GBDATA *gbd, GB_DbScanner *scanner) |
static void | gbs_scan_db_insert (const char *key, long, void *cd_insert_data) |
static int | gbs_scan_db_compare (const void *left, const void *right, void *) |
void | GBT_scan_db (StrArray &fieldNames, GBDATA *gbd, const char *datapath) |
static void | new_gbt_message_created_cb (GBDATA *gb_pending_messages) |
GBDATA * | find_or_create_error_container (GBDATA *gb_main) |
void | GBT_install_message_handler (GBDATA *gb_main) |
void | GBT_message (GBDATA *gb_main, const char *msg) |
char * | GBT_read_string (GBDATA *gb_container, const char *fieldpath) |
char * | GBT_read_as_string (GBDATA *gb_container, const char *fieldpath) |
const char * | GBT_read_char_pntr (GBDATA *gb_container, const char *fieldpath) |
NOT4PERL long * | GBT_read_int (GBDATA *gb_container, const char *fieldpath) |
NOT4PERL float * | GBT_read_float (GBDATA *gb_container, const char *fieldpath) |
char * | GBT_readOrCreate_string (GBDATA *gb_container, const char *fieldpath, const char *default_value) |
const char * | GBT_readOrCreate_char_pntr (GBDATA *gb_container, const char *fieldpath, const char *default_value) |
NOT4PERL long * | GBT_readOrCreate_int (GBDATA *gb_container, const char *fieldpath, long default_value) |
NOT4PERL float * | GBT_readOrCreate_float (GBDATA *gb_container, const char *fieldpath, float default_value) |
GB_ERROR | GBT_write_string (GBDATA *gb_container, const char *fieldpath, const char *content) |
GB_ERROR | GBT_write_int (GBDATA *gb_container, const char *fieldpath, long content) |
GB_ERROR | GBT_write_byte (GBDATA *gb_container, const char *fieldpath, unsigned char content) |
GB_ERROR | GBT_write_float (GBDATA *gb_container, const char *fieldpath, float content) |
GBDATA * | GBT_open (const char *path, const char *opent) |
static GBDATA * | wait_for_dbentry (GBDATA *gb_main, const char *entry, const ARB_timeout *timeout, bool verbose) |
static GB_ERROR | gbt_wait_for_remote_action (GBDATA *gb_main, GBDATA *gb_action, const char *awar_read) |
static void | mark_as_macro_executor (GBDATA *gb_main, bool mark) |
GB_ERROR | set_intEntry_to (GBDATA *gb_main, const char *path, int value) |
GB_ERROR | GB_set_macro_error (GBDATA *gb_main, const char *curr_error) |
GB_ERROR | GB_get_macro_error (GBDATA *gb_main) |
GB_ERROR | GB_clear_macro_error (GBDATA *gb_main) |
static GB_ERROR | start_remote_command_for_application (GBDATA *gb_main, const remote_awars &remote, const ARB_timeout *timeout, bool verbose) |
NOT4PERL GB_ERROR | GBT_remote_action_with_timeout (GBDATA *gb_main, const char *application, const char *action_name, const class ARB_timeout *timeout, bool verbose) |
GB_ERROR | GBT_remote_action (GBDATA *gb_main, const char *application, const char *action_name) |
GB_ERROR | GBT_remote_awar (GBDATA *gb_main, const char *application, const char *awar_name, const char *value) |
GB_ERROR | GBT_remote_read_awar (GBDATA *gb_main, const char *application, const char *awar_name) |
char * | find_macro_in (const char *dir, const char *macroname) |
static char * | fullMacroname (const char *macro_name) |
const char * | relative_inside (const char *dir, const char *fullpath) |
const char * | GBT_relativeMacroname (const char *macro_name) |
GB_ERROR | GBT_macro_execute (const char *macro_name, bool loop_marked, bool run_async) |
#define GBT_SUM_LEN 4096 |
Definition at line 72 of file adtools.cxx.
Referenced by GB_DbScanner::GB_DbScanner().
#define IF_DUMP_HANDSHAKE | ( | cmd | ) |
Definition at line 667 of file adtools.cxx.
Referenced by start_remote_command_for_application().
Definition at line 26 of file adtools.cxx.
References error(), gb_assert, GB_create_container(), GB_export_error(), GB_have_error(), GB_write_security_delete(), and NULp.
Referenced by ARB_main(), and GBT_find_or_create().
Definition at line 42 of file adtools.cxx.
References gb_assert, GB_entry(), GB_have_error(), and GBT_create().
Referenced by AliApplicable::apply_to_alignment(), GBT_get_presets(), GBT_get_SAI_data(), GBT_get_species_data(), GBT_get_tree_data(), get_DB_state(), and set_DB_state().
Definition at line 64 of file adtools.cxx.
References ARB_strdup().
Referenced by get_helix_string(), BI_helix::init(), and NT_del_mark_move_REF().
Definition at line 66 of file adtools.cxx.
References ARB_strdup().
Referenced by BI_ecoli_ref::init(), and PT_init_input_data().
|
static |
Definition at line 93 of file adtools.cxx.
References gb_assert, GB_check_hkey(), GB_child(), GB_DB, GB_nextChild(), GB_read_key_pntr(), GB_read_type(), GBS_incr_hash(), GB_DbScanner::hash_table, and type.
Referenced by gbt_scan_db_start().
|
static |
Definition at line 114 of file adtools.cxx.
References GB_DbScanner::buffer, gb_assert, GB_child(), GB_DB, GB_nextChild(), GB_read_type(), gbt_scan_db_rek(), and type.
Referenced by GBT_scan_db().
Definition at line 134 of file adtools.cxx.
References ARB_strBeginsWith(), ARB_strdup(), scan_db_insert::datapath, gb_assert, implicated, NULp, GB_DbScanner::result, and scan_db_insert::scanner.
Referenced by GBT_scan_db().
|
static |
Definition at line 157 of file adtools.cxx.
Referenced by GBT_scan_db().
scan CONTAINER for existing sub-keys
recurses completely downwards the DB tree
fieldNames | gets filled with result strings
|
gbd | node where search starts |
datapath | if not NULp -> only keys with prefix datapath are scanned and the prefix is removed from the resulting key_names. |
Note: this function is incredibly slow when called from clients
Warning: avoid to add new callers for this function: the interface is really weird
Definition at line 162 of file adtools.cxx.
References GBS_hash_do_const_loop(), gbs_scan_db_compare(), gbs_scan_db_insert(), gbt_scan_db_start(), GB_DbScanner::hash_table, and NULp.
Referenced by experiment_field_selection_list_rescan(), gene_field_selection_list_rescan(), and species_field_selection_list_rescan().
|
static |
Definition at line 193 of file adtools.cxx.
References GB_delete(), GB_entry(), GB_nextEntry(), GB_pop_transaction(), GB_push_transaction(), GB_read_char_pntr(), and GB_warning().
Referenced by GBT_install_message_handler().
Definition at line 219 of file adtools.cxx.
References ERROR_CONTAINER_PATH, GB_CREATE_CONTAINER, and GB_search().
Referenced by GBT_install_message_handler(), and GBT_message().
void GBT_install_message_handler | ( | GBDATA * | gb_main | ) |
Definition at line 223 of file adtools.cxx.
References find_or_create_error_container(), GB_add_callback(), gb_assert, GB_CB_SON_CREATED, GB_get_root(), GB_pop_transaction(), GB_push_transaction(), GBS_global_string(), GBT_message(), and new_gbt_message_created_cb().
Referenced by GB_login().
When called in client(or server) this causes the DB server to show the message. Message is shown via GB_warning (which uses aw_message in GUIs)
Note: The message is not shown before the transaction ends. If the transaction is aborted, the message is never shown!
see also : GB_warning()
Definition at line 238 of file adtools.cxx.
References error(), find_or_create_error_container(), gb_assert, GB_await_error(), GB_create(), GB_end_transaction(), GB_push_transaction(), GB_STRING, GB_write_string(), and NULp.
Referenced by ARB_main(), CON_insertSequences(), GBT_commit_rename_session(), GBT_install_message_handler(), gbt_read_tree_rek(), DI_MATRIX::load(), main(), mark_as_macro_executor(), nt_add(), nt_add_partial(), GroupSearch::perform_search(), read_tree_and_size_internal(), GBT_config::saveAsOver(), set_marks_of(), show_message(), transform_gbd_to_leaf(), and TREE_load_to_db().
Read value from database field (of type GB_STRING)
gb_container | where to start search for field |
fieldpath | relative path from gb_container |
other functions return a pointer to a temporary variable (invalidated by next call)
Definition at line 267 of file adtools.cxx.
References GB_FIND, GB_pop_transaction(), GB_push_transaction(), GB_read_string(), GB_search(), NULp, and result.
Referenced by ARB_main(), collectKeysRegisteredInDatabase(), concatenateFieldsCreateNewSpecies(), DI_ENTRY::DI_ENTRY(), ED4_get_and_jump_to_current(), ED4_jump_to_current_species(), ED4_selected_SAI_changed_cb(), ED4_selected_species_changed_cb(), edit_SAI_description(), ALI_selection::fill(), GBT_check_alignment(), GBT_config::GBT_config(), GBT_get_alignment_type_string(), GBT_load_colorset(), get_default_alignment(), getArbFilter(), PHDATA::load(), MG_merge_tagged_field_cb(), nt_build_conf_marked(), NT_suggestValidNames(), pars_generate_aliview(), and relink_pseudo_species_to_organisms().
like GBT_read_string()
but
Definition at line 290 of file adtools.cxx.
References GB_FIND, GB_pop_transaction(), GB_push_transaction(), GB_read_as_string(), GB_search(), NULp, and result.
Referenced by compare_hits(), QUERY::DbQuery_update_list(), and gbl_readdb().
like GBT_read_string()
but
Note: Under no circumstances you may modify the result!
Definition at line 307 of file adtools.cxx.
References GB_FIND, GB_pop_transaction(), GB_push_transaction(), GB_read_char_pntr(), GB_search(), NULp, and result.
Referenced by compare_hits(), delete_unused_changekeys(), export_format_multiple(), GBT_get_configuration_names(), GBT_get_name_or_description(), GBT_log_to_tree_remark(), gen_extract_gene_2_pseudoSpecies(), get_SAI_group(), get_SAI_groups(), set_field_of_queried_cb(), set_SAI_group(), and XML_recursive().
similar to GBT_read_string()
but
Definition at line 327 of file adtools.cxx.
References GB_FIND, GB_pop_transaction(), GB_push_transaction(), GB_read_int(), GB_search(), NULp, and result.
Referenced by ALI_translate_marked(), collectKeysRegisteredInDatabase(), compare_hits(), delete_unused_changekeys(), Itemfield_Selection::fill(), find_largest_tree(), GBT_add_new_changekey_to_keypath(), GBT_convert_changekey(), GBT_get_alignment_len(), GBT_get_type_of_changekey(), RegFieldSelection::get_keytype(), and NodeTextBuilder::init().
similar to GBT_read_string()
but
Definition at line 349 of file adtools.cxx.
References GB_FIND, GB_pop_transaction(), GB_push_transaction(), GB_read_float(), GB_search(), NULp, and result.
Referenced by compare_hits().
char* GBT_readOrCreate_string | ( | GBDATA * | gb_container, |
const char * | fieldpath, | ||
const char * | default_value | ||
) |
like GBT_read_string(),
but if field does not exist, it will be created and initialized with 'default_value'
Definition at line 371 of file adtools.cxx.
References GB_pop_transaction(), GB_push_transaction(), GB_read_string(), GB_searchOrCreate_string(), NULp, and result.
Referenced by check_for_remote_command(), MG_merge_tagged_field_cb(), and nt_add().
const char* GBT_readOrCreate_char_pntr | ( | GBDATA * | gb_container, |
const char * | fieldpath, | ||
const char * | default_value | ||
) |
like GBT_read_char_pntr(),
but if field does not exist, it will be created and initialized with 'default_value'
Definition at line 386 of file adtools.cxx.
References GB_pop_transaction(), GB_push_transaction(), GB_read_char_pntr(), GB_searchOrCreate_string(), NULp, and result.
Referenced by awt_create_select_filter_window_gb_cb(), and ArbImporter::read_data().
NOT4PERL long* GBT_readOrCreate_int | ( | GBDATA * | gb_container, |
const char * | fieldpath, | ||
long | default_value | ||
) |
like GBT_read_int(),
but if field does not exist, it will be created and initialized with 'default_value'
Definition at line 402 of file adtools.cxx.
References GB_pop_transaction(), GB_push_transaction(), GB_read_int(), GB_searchOrCreate_int(), NULp, and result.
Referenced by check_for_remote_command(), gb_load_single_key_data(), get_DB_state(), NodeTextBuilder::init(), AWT_graphic_tree::show_ruler(), and tree_vars_callback().
NOT4PERL float* GBT_readOrCreate_float | ( | GBDATA * | gb_container, |
const char * | fieldpath, | ||
float | default_value | ||
) |
like GBT_read_float(),
but if field does not exist, it will be created and initialized with 'default_value'
Definition at line 422 of file adtools.cxx.
References gb_assert, GB_pop_transaction(), GB_push_transaction(), GB_read_float(), GB_searchOrCreate_float(), NULp, and result.
Referenced by AWT_graphic_tree::show_ruler().
Write content to database field of type GB_STRING
if field exists, it will be overwritten. if field does not exist, it will be created.
The field should be unique, i.e. it should not exist twice or more in it's parent container
Definition at line 451 of file adtools.cxx.
References error(), gb_assert, GB_await_error(), GB_end_transaction(), GB_nextEntry(), GB_push_transaction(), GB_search(), GB_STRING, and GB_write_string().
Referenced by alignToNextRelative(), ARB_main(), check_for_remote_command(), checkAndMergeFields(), CON_export(), concatenateFieldsCreateNewSpecies(), config_comment_changed_cb(), copy_move_del_alignment(), copy_SAI_cb(), copy_SAI_to_species_cb(), create_data_entry(), create_new_species(), create_split_gene(), edit_SAI_description(), experiment_copy_handler(), extended_rename_handler(), findOrCreate_configuration(), GBT_add_new_changekey_to_keypath(), GBT_check_alignment(), GBT_check_data(), GBT_find_or_create_item_rel_item_data(), GBT_gen_accession_number(), GBT_get_configuration_names(), GBT_remote_awar(), GBT_remote_read_awar(), GBT_save_colorset(), GBT_set_default_alignment(), gbt_write_tree(), GEN_create_nonexisting_gene_rel_gene_data(), GEN_find_or_create_gene_rel_gene_data(), gene_copy_handler(), InsertDatainGDE(), MERGE_sequences_simple(), mg_check_field_cb(), MG_export_fields(), MG_merge_tagged_field_cb(), NT_create_sai_from_pfold(), NT_importValidNames(), NT_suggestValidNames(), remove_redundant_translation(), rename_SAI_cb(), AP_pos_var::save_aliEntry_to_SAI(), GBT_config::saveAsOver(), selectValidNameFromList(), set_addid(), set_SAI_group(), species_copy_cb(), trace_termChange_in_global_awar(), transfer_field_of_listed_cb(), translate_getInfo(), translate_saveInfo(), write_tree_remark(), and writeHistory().
like GBT_write_string(),
but for fields of type GB_INT
Definition at line 471 of file adtools.cxx.
References error(), gb_assert, GB_await_error(), GB_end_transaction(), GB_INT, GB_nextEntry(), GB_push_transaction(), GB_search(), and GB_write_int().
Referenced by create_gene_species(), Itemfield_Selection::fill(), GBT_add_new_changekey_to_keypath(), GBT_check_alignment(), GBT_is_partial(), GBT_set_alignment_len(), GBT_set_color_group(), gbt_set_type_of_changekey(), gbt_write_tree(), gbt_write_tree_nodes(), hide_field_cb(), NT_format_all_alignments(), and GroupBuilder::update_group().
like GBT_write_string(),
but for fields of type GB_BYTE
Definition at line 486 of file adtools.cxx.
References error(), gb_assert, GB_await_error(), GB_BYTE, GB_end_transaction(), GB_nextEntry(), GB_push_transaction(), GB_search(), and GB_write_byte().
Referenced by remove_redundant_translation().
like GBT_write_string(),
but for fields of type GB_FLOAT
Definition at line 502 of file adtools.cxx.
References error(), gb_assert, GB_await_error(), GB_end_transaction(), GB_FLOAT, GB_nextEntry(), GB_push_transaction(), GB_search(), and GB_write_float().
Referenced by tree_write_float().
Open a database (as GB_open does) Additionally:
path | filename of the DB |
opent | see GB_login() |
Definition at line 524 of file adtools.cxx.
References error(), gb_assert, GB_close(), GB_create_index(), GB_disable_path(), GB_export_error(), GB_FIND, GB_have_error(), GB_IGNORE_CASE, GB_number_of_subentries(), GB_open(), GB_path_in_ARBLIB(), GB_search(), GBT_get_SAI_data(), GBT_SAI_INDEX_SIZE, GBT_SPECIES_INDEX_SIZE, hash_size(), max, NULp, and ta.
Referenced by ARB_main(), load_and_startup_main_window(), main(), and SelectedDatabase::open_db_for_merge().
|
static |
Definition at line 579 of file adtools.cxx.
References GB_begin_transaction(), GB_commit_transaction(), GB_FIND, GB_search(), GB_warningf(), ARB_timeout::passed(), ARB_inc_sleep::sleep(), and start.
Referenced by GBT_remote_action_with_timeout(), GBT_remote_awar(), GBT_remote_read_awar(), and start_remote_command_for_application().
|
static |
Definition at line 601 of file adtools.cxx.
References error(), GB_begin_transaction(), GB_end_transaction(), GB_read_char_pntr(), GB_read_string(), GB_search(), GB_STRING, NULp, and ARB_inc_sleep::sleep().
Referenced by GBT_remote_action_with_timeout(), GBT_remote_awar(), and GBT_remote_read_awar().
|
static |
Definition at line 624 of file adtools.cxx.
References GB_transaction::close(), error(), gb_assert, GB_atclose_callback(), GB_FIND, GB_read_int(), GB_search(), GB_write_int(), GBT_message(), MACRO_TRIGGER_TERMINATED, NULp, and ta.
Referenced by GBT_remote_action(), GBT_remote_awar(), and GBT_remote_read_awar().
Definition at line 655 of file adtools.cxx.
References GB_await_error(), GB_searchOrCreate_int(), and GB_write_int().
Referenced by start_remote_command_for_application().
Definition at line 670 of file adtools.cxx.
References error(), GB_read_char_pntr(), GB_searchOrCreate_string(), GB_write_string(), GBS_global_string(), MACRO_TRIGGER_ERROR, NULp, and ta.
Referenced by check_for_remote_command(), and BoundActionTracker::set_recording().
Definition at line 687 of file adtools.cxx.
References error(), GB_await_error(), GB_FIND, GB_read_char_pntr(), GB_search(), GBS_global_string(), MACRO_TRIGGER_ERROR, NULp, and ta.
Referenced by check_for_remote_command(), macro_terminated(), and start_remote_command_for_application().
Definition at line 699 of file adtools.cxx.
References error(), GB_FIND, GB_search(), GB_write_string(), MACRO_TRIGGER_ERROR, NULp, and ta.
Referenced by check_for_remote_command(), and macro_terminated().
|
static |
Definition at line 707 of file adtools.cxx.
References remote_awars::authAck(), remote_awars::authReq(), error(), gb_assert, GB_await_error(), GB_begin_transaction(), GB_end_transaction(), GB_get_macro_error(), GB_read_int(), GB_searchOrCreate_int(), GB_write_int(), remote_awars::granted(), IF_DUMP_HANDSHAKE, ARB_timeout::passed(), set_intEntry_to(), ARB_inc_sleep::sleep(), start, verbose, and wait_for_dbentry().
Referenced by GBT_remote_action_with_timeout(), GBT_remote_awar(), and GBT_remote_read_awar().
NOT4PERL GB_ERROR GBT_remote_action_with_timeout | ( | GBDATA * | gb_main, |
const char * | application, | ||
const char * | action_name, | ||
const class ARB_timeout * | timeout, | ||
bool | verbose | ||
) |
Definition at line 792 of file adtools.cxx.
References remote_awars::action(), error(), GB_begin_transaction(), GB_end_transaction(), GB_write_string(), gbt_wait_for_remote_action(), NULp, remote_awars::result(), start_remote_command_for_application(), and wait_for_dbentry().
Referenced by AWT_trigger_remote_action(), and GBT_remote_action().
Definition at line 809 of file adtools.cxx.
References GBT_remote_action_with_timeout(), mark_as_macro_executor(), and NULp.
GB_ERROR GBT_remote_awar | ( | GBDATA * | gb_main, |
const char * | application, | ||
const char * | awar_name, | ||
const char * | value | ||
) |
Definition at line 815 of file adtools.cxx.
References remote_awars::awar(), error(), GB_begin_transaction(), GB_end_transaction(), GB_write_string(), gbt_wait_for_remote_action(), GBT_write_string(), mark_as_macro_executor(), NULp, remote_awars::result(), start_remote_command_for_application(), remote_awars::value(), and wait_for_dbentry().
GB_ERROR GBT_remote_read_awar | ( | GBDATA * | gb_main, |
const char * | application, | ||
const char * | awar_name | ||
) |
Definition at line 834 of file adtools.cxx.
References remote_awars::action(), remote_awars::awar(), error(), GB_begin_transaction(), GB_end_transaction(), GB_write_string(), gbt_wait_for_remote_action(), GBT_write_string(), mark_as_macro_executor(), NULp, start_remote_command_for_application(), remote_awars::value(), and wait_for_dbentry().
Definition at line 853 of file adtools.cxx.
References GB_is_readablefile(), and GBS_global_string_copy().
Referenced by fullMacroname().
detect full path of 'macro_name'
macro_name | full path or path relative to ARBMACRO or ARBMACROHOME |
Definition at line 862 of file adtools.cxx.
References ARB_strdup(), find_macro_in(), gb_assert, GB_export_errorf(), GB_getenvARBMACRO(), GB_getenvARBMACROHOME(), GB_have_error(), GB_is_readablefile(), NULp, and result.
Referenced by GBT_macro_execute().
Definition at line 899 of file adtools.cxx.
References ARB_strBeginsWith(), NULp, and result.
Referenced by GBT_relativeMacroname().
make macro_name relative if it is located in or below ARBMACROHOME or ARBMACRO. Inverse function of fullMacroname()
Definition at line 907 of file adtools.cxx.
References GB_getenvARBMACRO(), GB_getenvARBMACROHOME(), macro_name, relative_inside(), and result.
Referenced by RecordingMacro::write_action().
simply execute a macro
In doubt: do not use this function, instead use ../SL/MACROS/macros.hxx
macro_name | contains the macro filename (either with full path or relative to directories pointed to by ARBMACRO or ARBMACROHOME) |
loop_marked | if true -> call macro once for each marked species |
run_async | if true -> run perl asynchronously (will not detect perl failure in that case!) |
Definition at line 919 of file adtools.cxx.
References error(), fullMacroname(), GB_await_error(), GB_path_in_ARBHOME(), GBK_singlequote(), GBK_system(), GBS_global_string_copy(), and NULp.
Referenced by MacroRecorder::execute().