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.
double_parameter.h
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2020 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  * boolean_parameter.h
18  *
19  * Created on: 30 Jan 2020
20  * Author: billy
21  */
22 
23 #ifndef CORE_SHARED_PARAMETERS_INCLUDE_DOUBLE_PARAMETER_H_
24 #define CORE_SHARED_PARAMETERS_INCLUDE_DOUBLE_PARAMETER_H_
25 
26 #include "parameter.h"
28 #include "parameter_set.h"
29 
30 
31 /* forward declaration */
32 struct ServiceData;
33 
34 
35 typedef struct DoubleParameter
36 {
38 
39  double64 *dp_current_value_p;
40 
41  double64 *dp_default_value_p;
42 
43  double64 *dp_min_value_p;
44 
45  double64 *dp_max_value_p;
46 
48 
49 
50 typedef struct DoubleParameterOption
51 {
53  double64 dpo_value;
54 
57 
59 
60 
62 {
64 
66 
68 
69 
70 
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74 
94 GRASSROOTS_SERVICE_API DoubleParameter *AllocateDoubleParameter (const struct ServiceData *service_data_p, const ParameterType pt, const char * const name_s, const char * const display_name_s, const char * const description_s, const double64 *default_value_p, const double64 *current_value_p, ParameterLevel level);
95 
96 
97 
98 GRASSROOTS_SERVICE_API DoubleParameter *AllocateDoubleParameterFromJSON (const json_t *param_json_p, const struct Service *service_p, const bool concise_flag);
99 
100 
102 
103 
105 
106 
107 GRASSROOTS_SERVICE_API bool SetDoubleParameterCurrentValue (DoubleParameter *param_p, const double64 *value_p);
108 
109 
111 
112 
113 GRASSROOTS_SERVICE_API bool SetDoubleParameterDefaultValue (DoubleParameter *param_p, const double64 *value_p);
114 
115 
117 
118 
119 GRASSROOTS_SERVICE_API bool GetCurrentDoubleParameterValueFromParameterSet (const ParameterSet * const params_p, const char * const name_s, const double64 **value_pp);
120 
139  const char * const name_s, const char * const display_name_s, const char * const description_s,
140  const double64 *default_value_p, uint8 level);
141 
164  const char * const name_s, const char * const display_name_s, const char * const description_s,
165  const double64 *default_value_p, const double64 *current_value_p, uint8 level);
166 
167 
168 
169 GRASSROOTS_SERVICE_API bool SetDoubleParameterBounds (DoubleParameter *param_p, const double64 *min_value_p, const double64 *max_value_p);
170 
171 
172 GRASSROOTS_SERVICE_API bool GetDoubleParameterBounds (const DoubleParameter *param_p, double64 *min_value_p, double64 *max_value_p);
173 
174 
175 GRASSROOTS_SERVICE_API bool SetDoubleParameterMinimumValue (DoubleParameter *param_p, const double64 *min_value_p);
176 
177 
178 GRASSROOTS_SERVICE_API bool SetDoubleParameterMaximumValue (DoubleParameter *param_p, const double64 *max_value_p);
179 
180 
182 
183 
184 #ifdef __cplusplus
185 }
186 #endif
187 
188 
189 
190 
191 #endif /* CORE_SHARED_PARAMETERS_INCLUDE_DOUBLE_PARAMETER_H_ */
Parameter
The datatype that stores all of the information about a Parameter.
Definition: parameter.h:121
ParameterGroup
A datatype to tell the system that certain parameters should be grouped together in the client's user...
Definition: parameter_group.h:85
SetDoubleParameterBounds
bool SetDoubleParameterBounds(DoubleParameter *param_p, const double64 *min_value_p, const double64 *max_value_p)
ParameterType
ParameterType
The different types that a Parameter can take.
Definition: parameter_type.h:35
DoubleParameter
Definition: double_parameter.h:35
grassroots_service_library.h
parameter_set.h
GRASSROOTS_SERVICE_API
#define GRASSROOTS_SERVICE_API
Definition: grassroots_service_library.h:49
ParameterSet::CreateAndAddDoubleParameterToParameterSet
Parameter * CreateAndAddDoubleParameterToParameterSet(const struct ServiceData *service_data_p, ParameterSet *params_p, ParameterGroup *group_p, const ParameterType pt, const char *const name_s, const char *const display_name_s, const char *const description_s, const double64 *default_value_p, const double64 *current_value_p, uint8 level)
Allocate a new Parameter and add it to a ParameterSet.
parameter.h
DoubleParameterOptionNode::dpon_node
ListItem dpon_node
Definition: double_parameter.h:63
DoubleParameter::dp_max_value_p
double64 * dp_max_value_p
Definition: double_parameter.h:45
DoubleParameter::AllocateDoubleParameter
DoubleParameter * AllocateDoubleParameter(const struct ServiceData *service_data_p, const ParameterType pt, const char *const name_s, const char *const display_name_s, const char *const description_s, const double64 *default_value_p, const double64 *current_value_p, ParameterLevel level)
Allocate a DoubleParameter.
GetDoubleParameterCurrentValue
const double64 * GetDoubleParameterCurrentValue(const DoubleParameter *param_p)
DoubleParameter::dp_current_value_p
double64 * dp_current_value_p
Definition: double_parameter.h:39
DoubleParameterOption::dpo_value
double64 dpo_value
The internal value for this option.
Definition: double_parameter.h:53
DoubleParameter::dp_min_value_p
double64 * dp_min_value_p
Definition: double_parameter.h:43
Service
A datatype which defines an available service, its capabilities and its parameters.
Definition: service.h:153
GetCurrentDoubleParameterValueFromParameterSet
bool GetCurrentDoubleParameterValueFromParameterSet(const ParameterSet *const params_p, const char *const name_s, const double64 **value_pp)
DoubleParameter::dp_default_value_p
double64 * dp_default_value_p
Definition: double_parameter.h:41
SetDoubleParameterCurrentValueFromJSON
bool SetDoubleParameterCurrentValueFromJSON(DoubleParameter *param_p, const json_t *value_p)
SetDoubleParameterDefaultValue
bool SetDoubleParameterDefaultValue(DoubleParameter *param_p, const double64 *value_p)
ParameterLevel
ParameterLevel
The ParameterLevel defines the level that a user should be to adjust the Parameter.
Definition: parameter.h:52
DoubleParameterOption::dpo_description_s
char * dpo_description_s
The user-friendly description for this value.
Definition: double_parameter.h:56
GetDoubleParameterBounds
bool GetDoubleParameterBounds(const DoubleParameter *param_p, double64 *min_value_p, double64 *max_value_p)
DoubleParameterOptionNode
Definition: double_parameter.h:61
AllocateDoubleParameterFromJSON
DoubleParameter * AllocateDoubleParameterFromJSON(const json_t *param_json_p, const struct Service *service_p, const bool concise_flag)
DoubleParameterOptionNode::dpon_option_p
DoubleParameterOption * dpon_option_p
Definition: double_parameter.h:65
IsDoubleParameter
bool IsDoubleParameter(const Parameter *param_p)
DoubleParameterOption
Definition: double_parameter.h:50
SetDoubleParameterCurrentValue
bool SetDoubleParameterCurrentValue(DoubleParameter *param_p, const double64 *value_p)
DoubleParameter::dp_base_param
Parameter dp_base_param
Definition: double_parameter.h:37
SetDoubleParameterMinimumValue
bool SetDoubleParameterMinimumValue(DoubleParameter *param_p, const double64 *min_value_p)
ServiceData
A datatype for holding the configuration data for a Service.
Definition: service.h:126
FreeDoubleParameter
void FreeDoubleParameter(DoubleParameter *param_p)
GetDoubleParameterDefaultValue
const double64 * GetDoubleParameterDefaultValue(const DoubleParameter *param_p)
ParameterSet
A set of Parameters along with an optional name and description.
Definition: parameter_set.h:46
ParameterSet::EasyCreateAndAddDoubleParameterToParameterSet
Parameter * EasyCreateAndAddDoubleParameterToParameterSet(const struct ServiceData *service_data_p, ParameterSet *params_p, ParameterGroup *group_p, const ParameterType pt, const char *const name_s, const char *const display_name_s, const char *const description_s, const double64 *default_value_p, uint8 level)
Allocate a new Parameter and add it to a ParameterSet.
SetDoubleParameterMaximumValue
bool SetDoubleParameterMaximumValue(DoubleParameter *param_p, const double64 *max_value_p)
ListItem
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43