Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
gene_bank.h
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2018 The Earlham Institute
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 /*
17  * germplasm.h
18  *
19  * Created on: 23 Jul 2018
20  * Author: billy
21  */
22 
23 #ifndef SERVICES_DFW_FIELD_TRIAL_SERVICE_INCLUDE_GERMPLASM_H_
24 #define SERVICES_DFW_FIELD_TRIAL_SERVICE_INCLUDE_GERMPLASM_H_
25 
26 
29 #include "typedefs.h"
30 
31 #include "jansson.h"
32 
33 
34 typedef struct GeneBank
35 {
36  bson_oid_t *gb_id_p;
37 
38  char *gb_name_s;
39 
40  char *gb_url_s;
41 
42  char *gb_api_url_s;
43 
44 } GeneBank;
45 
46 
47 #ifndef DOXYGEN_SHOULD_SKIP_THIS
48 
49 #ifdef ALLOCATE_GENE_BANK_TAGS
50  #define GENE_BANK_PREFIX DFW_FIELD_TRIAL_SERVICE_LOCAL
51  #define GENE_BANK_VAL(x) = x
52  #define GENE_BANK_CONCAT_VAL(x,y) = x y
53 #else
54  #define GENE_BANK_PREFIX extern
55  #define GENE_BANK_VAL(x)
56  #define GENE_BANK_CONCAT_VAL(x,y)
57 #endif
58 
59 #endif /* #ifndef DOXYGEN_SHOULD_SKIP_THIS */
60 
61 
62 
63 
64 /* Location */
65 
66 
67 
68 GENE_BANK_PREFIX const char *GB_NAME_S GENE_BANK_CONCAT_VAL (CONTEXT_PREFIX_SCHEMA_ORG_S, "name");
69 
70 GENE_BANK_PREFIX const char *GB_URL_S GENE_BANK_CONCAT_VAL (CONTEXT_PREFIX_SCHEMA_ORG_S, "url");
71 
72 GENE_BANK_PREFIX const char *GB_API_URL_S GENE_BANK_VAL ("api_url");
73 
74 
75 
76 
77 
78 #ifdef __cplusplus
79 extern "C"
80 {
81 #endif
82 
83 
84 DFW_FIELD_TRIAL_SERVICE_LOCAL GeneBank *AllocateGeneBank (bson_oid_t *id_p, const char *name_s, const char *url_s, const char *api_url_s);
85 
86 
88 
89 
90 DFW_FIELD_TRIAL_SERVICE_LOCAL json_t *GetGeneBankAsJSON (const GeneBank *gene_bank_p, const ViewFormat format, const char * const api_query_s);
91 
92 
93 DFW_FIELD_TRIAL_SERVICE_LOCAL GeneBank *GetGeneBankFromJSON (const json_t *germplasm_json_p);
94 
95 
97 
98 
99 DFW_FIELD_TRIAL_SERVICE_LOCAL GeneBank *GetGeneBankById (const bson_oid_t *id_p, const ViewFormat format, const FieldTrialServiceData *data_p);
100 
101 
102 DFW_FIELD_TRIAL_SERVICE_LOCAL GeneBank *GetGeneBankByIdString (const char *gene_bank_id_s, const ViewFormat format, const FieldTrialServiceData *data_p);
103 
104 
106 
107 
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 
113 #endif /* SERVICES_DFW_FIELD_TRIAL_SERVICE_INCLUDE_GERMPLASM_H_ */
AllocateGeneBank
GeneBank * AllocateGeneBank(bson_oid_t *id_p, const char *name_s, const char *url_s, const char *api_url_s)
GeneBank::gb_api_url_s
char * gb_api_url_s
Definition: gene_bank.h:42
GetGeneBankAsJSON
json_t * GetGeneBankAsJSON(const GeneBank *gene_bank_p, const ViewFormat format, const char *const api_query_s)
GeneBank::gb_id_p
bson_oid_t * gb_id_p
Definition: gene_bank.h:36
dfw_field_trial_service_library.h
DFW_FIELD_TRIAL_SERVICE_LOCAL
#define DFW_FIELD_TRIAL_SERVICE_LOCAL
Definition: dfw_field_trial_service_library.h:43
CONTEXT_PREFIX_SCHEMA_ORG_S
#define CONTEXT_PREFIX_SCHEMA_ORG_S
Definition: schema_keys.h:103
SaveGeneBank
bool SaveGeneBank(GeneBank *gene_bank_p, FieldTrialServiceData *data_p)
GeneBank::gb_url_s
char * gb_url_s
Definition: gene_bank.h:40
typedefs.h
FreeGeneBank
void FreeGeneBank(GeneBank *germplasm_p)
GetGeneBankById
GeneBank * GetGeneBankById(const bson_oid_t *id_p, const ViewFormat format, const FieldTrialServiceData *data_p)
GetGeneBankFromJSON
GeneBank * GetGeneBankFromJSON(const json_t *germplasm_json_p)
GENE_BANK_VAL
const GENE_BANK_PREFIX char *GB_API_URL_S GENE_BANK_VAL("api_url")
GeneBank
Definition: gene_bank.h:34
dfw_field_trial_service_data.h
GeneBank::gb_name_s
char * gb_name_s
Definition: gene_bank.h:38
FieldTrialServiceData
The configuration data used by the DFW Field Trial Service.
Definition: dfw_field_trial_service_data.h:118
ViewFormat
ViewFormat
An indicator of what the output destination is for the JSON data values.
Definition: view_format.h:19
GENE_BANK_CONCAT_VAL
const GENE_BANK_PREFIX char *GB_NAME_S GENE_BANK_CONCAT_VAL(CONTEXT_PREFIX_SCHEMA_ORG_S, "name")
GetGeneBankByName
GeneBank * GetGeneBankByName(const char *name_s, const FieldTrialServiceData *data_p)
GetGeneBankByIdString
GeneBank * GetGeneBankByIdString(const char *gene_bank_id_s, const ViewFormat format, const FieldTrialServiceData *data_p)