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.
standard_row.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  * row.h
18  *
19  * Created on: 11 Sep 2018
20  * Author: billy
21  */
22 
23 #ifndef SERVICES_FIELD_TRIALS_INCLUDE_ROW_H_
24 #define SERVICES_FIELD_TRIALS_INCLUDE_ROW_H_
25 
26 
27 #include "material.h"
28 #include "plot.h"
29 #include "observation.h"
30 #include "treatment_factor_value.h"
31 
32 #include "row.h"
33 
34 struct Study;
35 
36 
37 
38 
39 typedef struct StandardRow
40 {
42 
47  uint32 sr_rack_index;
48 
50 
52 
54 
56 
58 
60 
62 
63 } StandardRow;
64 
65 
66 #ifndef DOXYGEN_SHOULD_SKIP_THIS
67 
68 #ifdef ALLOCATE_STANDARD_ROW_TAGS
69  #define STANDARD_ROW_PREFIX DFW_FIELD_TRIAL_SERVICE_API
70  #define STANDARD_ROW_VAL(x) = x
71  #define STANDARD_ROW_CONCAT_VAL(x,y) = x y
72 #else
73  #define STANDARD_ROW_PREFIX extern
74  #define STANDARD_ROW_VAL(x)
75  #define STANDARD_ROW_CONCAT_VAL(x,y)
76 #endif
77 
78 #endif /* #ifndef DOXYGEN_SHOULD_SKIP_THIS */
79 
80 
81 
82 STANDARD_ROW_PREFIX const char *SR_RACK_INDEX_S STANDARD_ROW_VAL ("rack_index");
83 
84 
85 STANDARD_ROW_PREFIX const char *SR_REPLICATE_S STANDARD_ROW_VAL ("replicate");
86 
87 STANDARD_ROW_PREFIX const char *SR_MATERIAL_ID_S STANDARD_ROW_VAL ("material_id");
88 
89 
90 STANDARD_ROW_PREFIX const char *SR_MATERIAL_S STANDARD_ROW_VAL ("material");
91 
92 STANDARD_ROW_PREFIX const char *SR_STORE_CODE_S STANDARD_ROW_VAL ("store_code");
93 
94 
95 STANDARD_ROW_PREFIX const char *SR_OBSERVATIONS_S STANDARD_ROW_VAL ("observations");
96 
97 STANDARD_ROW_PREFIX const char *SR_TREATMENTS_S STANDARD_ROW_VAL ("treatments");
98 
99 
100 STANDARD_ROW_PREFIX const char *SR_REPLICATE_CONTROL_S STANDARD_ROW_VAL ("control");
101 
102 
103 
104 
105 STANDARD_ROW_PREFIX const char *SR_IMPORT_RACK_S STANDARD_ROW_VAL ("Rack");
106 
107 
108 STANDARD_ROW_PREFIX const char *SR_PLOT_INDEX_S STANDARD_ROW_VAL ("Plot index");
109 
110 
111 #ifdef __cplusplus
112 extern "C"
113 {
114 #endif
115 
116 
117 DFW_FIELD_TRIAL_SERVICE_LOCAL StandardRow *AllocateStandardRow (bson_oid_t *id_p, const uint32 rack_index, const uint32 study_index, const bool replicate_control_flag, const uint32 replicate, Material *material_p, MEM_FLAG material_mem, const char * const store_code_s, Plot *parent_plot_p);
118 
119 
120 DFW_FIELD_TRIAL_SERVICE_LOCAL StandardRow *GetStandardRowFromJSON (const json_t *json_p, Plot *plot_p, Material *material_p, const struct Study *study_p, const ViewFormat format, FieldTrialServiceData *data_p);
121 
122 //DFW_FIELD_TRIAL_SERVICE_LOCAL bool SaveRow (Row *row_p, const FieldTrialServiceData *data_p, bool insert_flag);
123 
125 
126 
128 
129 
131 
132 
133 DFW_FIELD_TRIAL_SERVICE_LOCAL bool SetStandardRowStoreCode (StandardRow *row_p, const char * const store_code_s);
134 
135 
136 DFW_FIELD_TRIAL_SERVICE_LOCAL void UpdateStandardRow (StandardRow *row_p, const uint32 rack_index, const bool replicate_control_flag, const uint32 replicate, Material *material_p, MEM_FLAG material_mem, const char * const store_code_s);
137 
138 
140 
141 
142 DFW_FIELD_TRIAL_SERVICE_LOCAL bool AddStandardRowToJSON (const Row *row_p, json_t *row_json_p, const ViewFormat format, const FieldTrialServiceData *data_p);
143 
144 
145 DFW_FIELD_TRIAL_SERVICE_LOCAL bool AddStandardRowToPlotTable (const StandardRow *row_p, json_t *row_json_p, const FieldTrialServiceData *service_data_p);
146 
147 
148 #ifdef __cplusplus
149 }
150 #endif
151 
152 
153 #endif /* SERVICES_FIELD_TRIALS_INCLUDE_ROW_H_ */
StandardRow
Definition: standard_row.h:39
Plot
Definition: plot.h:84
StandardRow::sr_material_mem
MEM_FLAG sr_material_mem
Definition: standard_row.h:51
MEM_FLAG
MEM_FLAG
An enum specifying the particular status of a piece of dynamically allocated memory for a particular ...
Definition: memory_allocations.h:38
treatment_factor_value.h
SetStandardRowGenotypeControl
void SetStandardRowGenotypeControl(StandardRow *row_p, bool control_flag)
StandardRow::sr_treatment_factor_values_p
LinkedList * sr_treatment_factor_values_p
Definition: standard_row.h:55
AllocateStandardRow
StandardRow * AllocateStandardRow(bson_oid_t *id_p, const uint32 rack_index, const uint32 study_index, const bool replicate_control_flag, const uint32 replicate, Material *material_p, MEM_FLAG material_mem, const char *const store_code_s, Plot *parent_plot_p)
Material
Definition: material.h:121
StandardRow::sr_replicate_control_flag
bool sr_replicate_control_flag
Definition: standard_row.h:59
StandardRow::sr_observations_p
LinkedList * sr_observations_p
Definition: standard_row.h:53
DFW_FIELD_TRIAL_SERVICE_LOCAL
#define DFW_FIELD_TRIAL_SERVICE_LOCAL
Definition: dfw_field_trial_service_library.h:43
StandardRow::sr_rack_index
uint32 sr_rack_index
The row factor/category for this rack within its parent plot.
Definition: standard_row.h:47
material.h
AddStandardRowToJSON
bool AddStandardRowToJSON(const Row *row_p, json_t *row_json_p, const ViewFormat format, const FieldTrialServiceData *data_p)
AddStandardRowToPlotTable
bool AddStandardRowToPlotTable(const StandardRow *row_p, json_t *row_json_p, const FieldTrialServiceData *service_data_p)
StandardRow::sr_replicate_index
uint32 sr_replicate_index
Definition: standard_row.h:57
LinkedList
A doubly-linked list that can be traversed in either direction.
Definition: linked_list.h:56
AddTreatmentFactorValueToStandardRow
bool AddTreatmentFactorValueToStandardRow(StandardRow *row_p, TreatmentFactorValue *tf_value_p)
row.h
STANDARD_ROW_VAL
const STANDARD_ROW_PREFIX char *SR_RACK_INDEX_S STANDARD_ROW_VAL("rack_index")
UpdateStandardRow
void UpdateStandardRow(StandardRow *row_p, const uint32 rack_index, const bool replicate_control_flag, const uint32 replicate, Material *material_p, MEM_FLAG material_mem, const char *const store_code_s)
GetStandardRowFromJSON
StandardRow * GetStandardRowFromJSON(const json_t *json_p, Plot *plot_p, Material *material_p, const struct Study *study_p, const ViewFormat format, FieldTrialServiceData *data_p)
AddObservationToStandardRow
bool AddObservationToStandardRow(StandardRow *row_p, Observation *observation_p)
observation.h
StandardRow::sr_material_p
Material * sr_material_p
Definition: standard_row.h:49
Observation
A datatype for storing a phneotypic observation within an experiment.
Definition: observation.h:63
StandardRow::sr_base
Row sr_base
Definition: standard_row.h:41
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
SetStandardRowStoreCode
bool SetStandardRowStoreCode(StandardRow *row_p, const char *const store_code_s)
TreatmentFactorValue
Definition: treatment_factor_value.h:32
plot.h
Study
Definition: study.h:182
Row
Definition: row.h:54
StandardRow::sr_store_code_s
char * sr_store_code_s
Definition: standard_row.h:61
IsStandardRowGenotypeControl
bool IsStandardRowGenotypeControl(const StandardRow *row_p)