source: branches/nameserver/SL/AW_NAME/AW_rename.hxx

Last change on this file was 17595, checked in by westram, 6 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
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
26void       AWTC_create_rename_awars(AW_root *root, AW_default db1);
27AW_window *AWTC_create_rename_window(AW_root *root, GBDATA *gb_main);
28
29void       AW_create_namesadmin_awars(AW_root *aw_root, GBDATA *gb_main);
30AW_window *AW_create_namesadmin_window(AW_root *root, GBDATA *gb_main);
31
32GB_ERROR AW_select_nameserver(GBDATA *gb_main, GBDATA *gb_other_main);
33
34#endif // AW_RENAME_SKIP_GUI
35// --------------------------------------------------------------------------------
36
37char     *AWTC_create_numbered_suffix(GB_HASH *species_name_hash, const char *shortname, GB_ERROR& warning);
38GB_ERROR  AWTC_pars_names(GBDATA *gb_main, bool *isWarning);
39GB_ERROR  AWTC_generate_one_name(GBDATA *gb_main, const char *full_name, const char *acc, const char *addid, char*& new_name);
40GB_ERROR  AWTC_recreate_name(GBDATA *gb_main);
41
42// return name of additional field used for species identification
43// (-> para 'addid' in AWTC_generate_one_name)
44const char *AW_get_nameserver_addid(GBDATA *gb_main);
45
46GB_ERROR AW_test_nameserver(GBDATA *gb_main); // create a test link to the nameserver
47
48class UniqueNameDetector : virtual Noncopyable {
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;
53public:
54    UniqueNameDetector(GBDATA *gb_item_data, long additionalEntries = 0);
55    ~UniqueNameDetector();
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
61char *AWTC_makeUniqueShortName(const char *prefix, UniqueNameDetector& existingNames);
62char *AWTC_generate_random_name(UniqueNameDetector& existingNames);
63
64struct PersistentNameServerConnection {
65    // create a PersistentNameServerConnection instance while calling AWTC_generate_one_name
66    // to avoid repeated re-connections to name server
67    bool dummy;
68    PersistentNameServerConnection();
69    ~PersistentNameServerConnection();
70};
71
72int AWTC_name_quality(const char *short_name);
73
74#else
75#error AW_rename.hxx included twice
76#endif // AW_RENAME_HXX
Note: See TracBrowser for help on using the repository browser.