ARB
AW_rename.hxx
Go to the documentation of this file.
1 // =============================================================== //
2 // //
3 // File : AW_rename.hxx //
4 // Purpose : //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // =============================================================== //
10 
11 #ifndef AW_RENAME_HXX
12 #define AW_RENAME_HXX
13 
14 #ifndef AW_BASE_HXX
15 #include <aw_base.hxx>
16 #endif
17 #ifndef ARBDBT_H
18 #include <arbdbt.h>
19 #endif
20 
21 #define AWAR_NAMESERVER_ADDID "nt/nameserver_addid"
22 
23 // --------------------------------------------------------------------------------
24 #ifndef AW_RENAME_SKIP_GUI
25 
28 
31 
33 
34 #endif // AW_RENAME_SKIP_GUI
35 // --------------------------------------------------------------------------------
36 
37 char *AWTC_create_numbered_suffix(GB_HASH *species_name_hash, const char *shortname, GB_ERROR& warning);
38 GB_ERROR AWTC_pars_names(GBDATA *gb_main, bool *isWarning);
39 GB_ERROR AWTC_generate_one_name(GBDATA *gb_main, const char *full_name, const char *acc, const char *addid, char*& new_name);
41 
42 // return name of additional field used for species identification
43 // (-> para 'addid' in AWTC_generate_one_name)
45 
46 GB_ERROR AW_test_nameserver(GBDATA *gb_main); // create a test link to the nameserver
47 
49  // Note: If you add new items to the DB while one instance of this class exists,
50  // you have to call add_name() for these new species!
51 
52  GB_HASH *hash;
53 public:
54  UniqueNameDetector(GBDATA *gb_item_data, long additionalEntries = 0);
56 
57  bool name_known(const char *name) { return GBS_read_hash(hash, name) == 1; }
58  void add_name(const char *name) { GBS_write_hash(hash, name, 1); }
59 };
60 
61 char *AWTC_makeUniqueShortName(const char *prefix, UniqueNameDetector& existingNames);
62 char *AWTC_generate_random_name(UniqueNameDetector& existingNames);
63 
65  // create a PersistentNameServerConnection instance while calling AWTC_generate_one_name
66  // to avoid repeated re-connections to name server
67  bool dummy;
70 };
71 
72 int AWTC_name_quality(const char *short_name);
73 
74 #else
75 #error AW_rename.hxx included twice
76 #endif // AW_RENAME_HXX
bool name_known(const char *name)
Definition: AW_rename.hxx:57
const char * GB_ERROR
Definition: arb_core.h:25
long GBS_write_hash(GB_HASH *hs, const char *key, long val)
Definition: adhash.cxx:457
char * AWTC_create_numbered_suffix(GB_HASH *species_name_hash, const char *shortname, GB_ERROR &warning)
Definition: AW_rename.cxx:440
GB_ERROR AWTC_pars_names(GBDATA *gb_main, bool *isWarning)
Definition: AW_rename.cxx:459
void warning(int warning_num, const char *warning_message)
Definition: util.cxx:61
GB_ERROR AWTC_generate_one_name(GBDATA *gb_main, const char *full_name, const char *acc, const char *addid, char *&new_name)
Definition: AW_rename.cxx:317
AW_window * AWTC_create_rename_window(AW_root *root, GBDATA *gb_main)
Definition: AW_rename.cxx:562
AW_window * AW_create_namesadmin_window(AW_root *root, GBDATA *gb_main)
GB_ERROR AWTC_recreate_name(GBDATA *gb_main)
Definition: AW_rename.cxx:366
GB_ERROR AW_test_nameserver(GBDATA *gb_main)
Definition: AW_rename.cxx:311
void AW_create_namesadmin_awars(AW_root *aw_root, GBDATA *gb_main)
UniqueNameDetector(GBDATA *gb_item_data, long additionalEntries=0)
Definition: AW_rename.cxx:584
char * AWTC_makeUniqueShortName(const char *prefix, UniqueNameDetector &existingNames)
Definition: AW_rename.cxx:633
const char * AW_get_nameserver_addid(GBDATA *gb_main)
Definition: AW_rename.cxx:39
void AWTC_create_rename_awars(AW_root *root, AW_default db1)
GB_ERROR AW_select_nameserver(GBDATA *gb_main, GBDATA *gb_other_main)
Definition: AW_rename.cxx:49
int AWTC_name_quality(const char *short_name)
Definition: AW_rename.cxx:692
void add_name(const char *name)
Definition: AW_rename.hxx:58
char * AWTC_generate_random_name(UniqueNameDetector &existingNames)
Definition: AW_rename.cxx:664
GBDATA * gb_main
Definition: adname.cxx:33
long GBS_read_hash(const GB_HASH *hs, const char *key)
Definition: adhash.cxx:395