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.
instrument.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  * instrument.h
18  *
19  * Created on: 11 Sep 2018
20  * Author: billy
21  */
22 
23 #ifndef SERVICES_FIELD_TRIALS_INCLUDE_INSTRUMENT_H_
24 #define SERVICES_FIELD_TRIALS_INCLUDE_INSTRUMENT_H_
25 
26 
27 
30 #include "typedefs.h"
31 
32 
33 typedef struct Instrument
34 {
35  bson_oid_t *in_id_p;
36 
37  char *in_name_s;
38 
39  char *in_model_s;
40 
41 } Instrument;
42 
43 
44 
45 #ifndef DOXYGEN_SHOULD_SKIP_THIS
46 
47 #ifdef ALLOCATE_INSTRUMENT_TAGS
48  #define INSTRUMENT_PREFIX DFW_FIELD_TRIAL_SERVICE_LOCAL
49  #define INSTRUMENT_VAL(x) = x
50  #define INSTRUMENT_CONCAT_VAL(x,y) = x y
51 #else
52  #define INSTRUMENT_PREFIX extern
53  #define INSTRUMENT_VAL(x)
54  #define INSTRUMENT_CONCAT_VAL(x,y)
55 #endif
56 
57 #endif /* #ifndef DOXYGEN_SHOULD_SKIP_THIS */
58 
59 
60 INSTRUMENT_PREFIX const char *IN_NAME_S INSTRUMENT_CONCAT_VAL (CONTEXT_PREFIX_SCHEMA_ORG_S, "name");
61 
62 INSTRUMENT_PREFIX const char *IN_MODEL_S INSTRUMENT_VAL ("model");
63 
64 
65 #ifdef __cplusplus
66 extern "C"
67 {
68 #endif
69 
70 
71 
72 DFW_FIELD_TRIAL_SERVICE_LOCAL Instrument *AllocateInstrument (bson_oid_t *id_p, const char *name_s, const char *model_s);
73 
75 
76 
78 
79 DFW_FIELD_TRIAL_SERVICE_LOCAL Instrument *GetInstrumentFromJSON (const json_t *phenotype_json_p);
80 
81 
83 
84 
85 DFW_FIELD_TRIAL_SERVICE_LOCAL Instrument *GetInstrumentById (const bson_oid_t *instrument_id_p, const FieldTrialServiceData *data_p);
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 
92 
93 
94 #endif /* SERVICES_FIELD_TRIALS_INCLUDE_INSTRUMENT_H_ */
Instrument
Definition: instrument.h:33
Instrument::in_model_s
char * in_model_s
Definition: instrument.h:39
Instrument::in_id_p
bson_oid_t * in_id_p
Definition: instrument.h:35
GetInstrumentById
Instrument * GetInstrumentById(const bson_oid_t *instrument_id_p, const FieldTrialServiceData *data_p)
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
Instrument::in_name_s
char * in_name_s
Definition: instrument.h:37
typedefs.h
INSTRUMENT_VAL
const INSTRUMENT_PREFIX char *IN_MODEL_S INSTRUMENT_VAL("model")
INSTRUMENT_CONCAT_VAL
const INSTRUMENT_PREFIX char *IN_NAME_S INSTRUMENT_CONCAT_VAL(CONTEXT_PREFIX_SCHEMA_ORG_S, "name")
GetInstrumentAsJSON
json_t * GetInstrumentAsJSON(const Instrument *instrument_p)
AllocateInstrument
Instrument * AllocateInstrument(bson_oid_t *id_p, const char *name_s, const char *model_s)
dfw_field_trial_service_data.h
FieldTrialServiceData
The configuration data used by the DFW Field Trial Service.
Definition: dfw_field_trial_service_data.h:118
SaveInstrument
bool SaveInstrument(Instrument *instrument_p, const FieldTrialServiceData *data_p)
FreeInstrument
void FreeInstrument(Instrument *instrument_p)
GetInstrumentFromJSON
Instrument * GetInstrumentFromJSON(const json_t *phenotype_json_p)