mapped_parameter.h
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2016 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 
21 /*
22  * mapped_parameter.h
23  *
24  * Created on: 7 Sep 2016
25  * Author: tyrrells
26  */
27 
28 #ifndef SERVER_SRC_SERVICES_LIB_INCLUDE_MAPPED_PARAMETER_H_
29 #define SERVER_SRC_SERVICES_LIB_INCLUDE_MAPPED_PARAMETER_H_
30 
31 #include "jansson.h"
32 
34 
35 #include "linked_list.h"
36 
37 #include "parameter_set.h"
38 
39 
40 
41 /* forward declarations */
42 struct ServiceJob;
43 
44 
52 typedef struct MappedParameter
53 {
60 
70 
71 
76 
77 
83 
84 
92 typedef struct MappedParameterNode
93 {
96 
100 
101 
102 #ifdef __cplusplus
103 extern "C"
104 {
105 #endif
106 
117 GRASSROOTS_SERVICE_API MappedParameter *AllocateMappedParameter (const char *input_s, const char *output_s, bool required_flag, bool multi_flag);
118 
119 
127 GRASSROOTS_SERVICE_API MappedParameter *CreateMappedParameterFromJSON (const json_t *mapped_param_json_p);
128 
129 
136 GRASSROOTS_SERVICE_API void FreeMappedParameter (MappedParameter *mapped_param_p);
137 
138 
146 GRASSROOTS_SERVICE_API MappedParameterNode *AllocateMappedParameterNode (MappedParameter *mapped_param_p);
147 
148 
155 GRASSROOTS_SERVICE_API void FreeMappedParameterNode (ListItem *node_p);
156 
157 
168 GRASSROOTS_SERVICE_API bool SetMappedStringParameterValue (MappedParameter *mapped_param_p, ParameterSet *params_p, const char *param_name_s);
169 
170 
171 #ifdef __cplusplus
172 }
173 #endif
174 
175 
176 #endif /* SERVER_SRC_SERVICES_LIB_INCLUDE_MAPPED_PARAMETER_H_ */
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43
MappedParameter * AllocateMappedParameter(const char *input_s, const char *output_s, bool required_flag, bool multi_flag)
Allocate a MappedParameter for the given Parameter names.
This datatype allows the storage of MappedParameters on a LinkedList.
Definition: mapped_parameter.h:92
char * mp_output_param_s
This is name of the parameter in the second service.
Definition: mapped_parameter.h:69
void FreeMappedParameter(MappedParameter *mapped_param_p)
Free a MappedParameter.
MappedParameter * CreateMappedParameterFromJSON(const json_t *mapped_param_json_p)
Create a new MappedParameter from a JSON fragment.
ListItem mpn_node
The base node.
Definition: mapped_parameter.h:95
bool mp_required_flag
Is this MappedParameter required for the LinkedService to run?
Definition: mapped_parameter.h:75
A doubly-linked list.
char * mp_input_param_s
This is the selector to get the value from the first service's output.
Definition: mapped_parameter.h:59
bool SetMappedStringParameterValue(MappedParameter *mapped_param_p, ParameterSet *params_p, const char *param_name_s)
Set a Parameter value within a given ParameterSet by a MappedParameter's defintion.
A datatype to represent a running task.
Definition: service_job.h:72
MappedParameterNode * AllocateMappedParameterNode(MappedParameter *mapped_param_p)
Allocate a MappedParameterNode to store a MappedParameter on a LinkedList.
void FreeMappedParameterNode(ListItem *node_p)
Free a MappedParameterNode and its associated MappedParameter.
MappedParameter * mpn_mapped_param_p
A pointer to the MappedParameter to store.
Definition: mapped_parameter.h:98
This structure is used to store a relationship between a value from the output of running one service...
Definition: mapped_parameter.h:52
bool mp_multiple_flag
Can there be multiple input values?
Definition: mapped_parameter.h:81
A set of Parameters along with an optional name and description.
Definition: parameter_set.h:46