1 | // =============================================================== // |
---|
2 | // // |
---|
3 | // File : adExperiment.cxx // |
---|
4 | // Purpose : DB-access on experiments // |
---|
5 | // // |
---|
6 | // Coded by Ralf Westram (coder@reallysoft.de) in December 2008 // |
---|
7 | // Institute of Microbiology (Technical University Munich) // |
---|
8 | // http://www.arb-home.de/ // |
---|
9 | // // |
---|
10 | // =============================================================== // |
---|
11 | |
---|
12 | #include <arbdbt.h> |
---|
13 | #include "gb_local.h" |
---|
14 | |
---|
15 | GBDATA* EXP_get_experiment_data(GBDATA *gb_species) { |
---|
16 | return GB_search(gb_species, "experiment_data", GB_CREATE_CONTAINER); |
---|
17 | } |
---|
18 | |
---|
19 | GBDATA* EXP_find_experiment_rel_exp_data(GBDATA *gb_experiment_data, const char *name) { |
---|
20 | return GBT_find_item_rel_item_data(gb_experiment_data, "name", name); |
---|
21 | } |
---|
22 | GBDATA* EXP_find_experiment(GBDATA *gb_species, const char *name) { |
---|
23 | // search an experiment |
---|
24 | // Note: If you know the experiment exists, use EXP_expect_experiment! |
---|
25 | return EXP_find_experiment_rel_exp_data(EXP_get_experiment_data(gb_species), name); |
---|
26 | } |
---|
27 | GBDATA* EXP_first_experiment_rel_exp_data(GBDATA *gb_experiment_data) { |
---|
28 | return GB_entry(gb_experiment_data, "experiment"); |
---|
29 | } |
---|
30 | |
---|
31 | GBDATA* EXP_next_experiment(GBDATA *gb_experiment) { |
---|
32 | gb_assert(GB_has_key(gb_experiment, "experiment")); |
---|
33 | return GB_nextEntry(gb_experiment); |
---|
34 | } |
---|
35 | |
---|
36 | |
---|
37 | GBDATA* EXP_find_or_create_experiment_rel_exp_data(GBDATA *gb_experiment_data, const char *name) { |
---|
38 | // Search for a experiment, when experiment does not exist create it |
---|
39 | return GBT_find_or_create_item_rel_item_data(gb_experiment_data, "experiment", "name", name, false); |
---|
40 | } |
---|
41 | |
---|