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.
time_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  * time_parameter.h
18  *
19  * Created on: 31 Jan 2020
20  * Author: billy
21  */
22 
23 #ifndef CORE_SHARED_PARAMETERS_INCLUDE_TIME_PARAMETER_H_
24 #define CORE_SHARED_PARAMETERS_INCLUDE_TIME_PARAMETER_H_
25 
26 
27 #include "parameter.h"
29 #include "time.h"
30 #include "parameter_set.h"
31 
32 
33 
34 typedef struct TimeParameter
35 {
37 
38  struct tm *tp_current_value_p;
39 
40  struct tm *tp_default_value_p;
41 
42  struct tm *tp_min_value_p;
43 
44  struct tm *tp_max_value_p;
45 
47 
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
73  const char * const name_s, const char * const display_name_s,
74  const char * const description_s,
75  const struct tm *default_value_p, const struct tm *current_value_p,
76  ParameterLevel level);
77 
78 
79 GRASSROOTS_SERVICE_API TimeParameter *AllocateTimeParameterFromJSON (const json_t *param_json_p, const struct Service *service_p, const bool concise_flag);
80 
81 
83  const char * const name_s, const char * const display_name_s, const char * const description_s,
84  const struct tm *default_value_p, uint8 level);
85 
87  const char * const name_s, const char * const display_name_s, const char * const description_s,
88  const struct tm *default_value_p, const struct tm *current_value_p, uint8 level);
89 
90 
92 
93 
94 GRASSROOTS_SERVICE_API const struct tm *GetTimeParameterCurrentValue (const TimeParameter *param_p);
95 
96 
97 GRASSROOTS_SERVICE_API bool SetTimeParameterCurrentValue (TimeParameter *param_p, const struct tm *value_p);
98 
99 
100 GRASSROOTS_SERVICE_API const struct tm *GetTimeParameterDefaultValue (const TimeParameter *param_p);
101 
102 
103 GRASSROOTS_SERVICE_API bool SetTimeParameterDefaultValue (TimeParameter *param_p, const struct tm *value_p);
104 
105 
107 
108 
109 GRASSROOTS_SERVICE_API bool GetCurrentTimeParameterValueFromParameterSet (const ParameterSet * const params_p, const char * const name_s, const struct tm **value_pp);
110 
111 
112 GRASSROOTS_SERVICE_API bool SetTimeParameterCurrentValueFromJSON (TimeParameter *param_p, const json_t *value_p);
113 
114 
115 #ifdef __cplusplus
116 }
117 #endif
118 
119 
120 
121 
122 #endif /* CORE_SHARED_PARAMETERS_INCLUDE_TIME_PARAMETER_H_ */
Parameter
The datatype that stores all of the information about a Parameter.
Definition: parameter.h:121
SetTimeParameterCurrentValue
bool SetTimeParameterCurrentValue(TimeParameter *param_p, const struct tm *value_p)
ParameterGroup
A datatype to tell the system that certain parameters should be grouped together in the client's user...
Definition: parameter_group.h:85
grassroots_service_library.h
parameter_set.h
GRASSROOTS_SERVICE_API
#define GRASSROOTS_SERVICE_API
Definition: grassroots_service_library.h:49
GetTimeParameterCurrentValue
const struct tm * GetTimeParameterCurrentValue(const TimeParameter *param_p)
parameter.h
IsTimeParameter
bool IsTimeParameter(Parameter *param_p)
TimeParameter::tp_default_value_p
struct tm * tp_default_value_p
Definition: time_parameter.h:40
EasyCreateAndAddTimeParameterToParameterSet
Parameter * EasyCreateAndAddTimeParameterToParameterSet(const struct ServiceData *service_data_p, ParameterSet *params_p, ParameterGroup *group_p, const char *const name_s, const char *const display_name_s, const char *const description_s, const struct tm *default_value_p, uint8 level)
TimeParameter::AllocateTimeParameter
TimeParameter * AllocateTimeParameter(const struct ServiceData *service_data_p, const char *const name_s, const char *const display_name_s, const char *const description_s, const struct tm *default_value_p, const struct tm *current_value_p, ParameterLevel level)
Allocate a TimeParameter.
SetTimeParameterDefaultValue
bool SetTimeParameterDefaultValue(TimeParameter *param_p, const struct tm *value_p)
TimeParameter::tp_current_value_p
struct tm * tp_current_value_p
Definition: time_parameter.h:38
GetTimeParameterDefaultValue
const struct tm * GetTimeParameterDefaultValue(const TimeParameter *param_p)
TimeParameter::tp_max_value_p
struct tm * tp_max_value_p
Definition: time_parameter.h:44
Service
A datatype which defines an available service, its capabilities and its parameters.
Definition: service.h:153
ParameterLevel
ParameterLevel
The ParameterLevel defines the level that a user should be to adjust the Parameter.
Definition: parameter.h:52
SetTimeParameterCurrentValueFromJSON
bool SetTimeParameterCurrentValueFromJSON(TimeParameter *param_p, const json_t *value_p)
TimeParameter::tp_base_param
Parameter tp_base_param
Definition: time_parameter.h:36
AllocateTimeParameterFromJSON
TimeParameter * AllocateTimeParameterFromJSON(const json_t *param_json_p, const struct Service *service_p, const bool concise_flag)
GetCurrentTimeParameterValueFromParameterSet
bool GetCurrentTimeParameterValueFromParameterSet(const ParameterSet *const params_p, const char *const name_s, const struct tm **value_pp)
TimeParameter::tp_min_value_p
struct tm * tp_min_value_p
Definition: time_parameter.h:42
ServiceData
A datatype for holding the configuration data for a Service.
Definition: service.h:126
ParameterSet
A set of Parameters along with an optional name and description.
Definition: parameter_set.h:46
TimeParameter
Definition: time_parameter.h:34
CreateAndAddTimeParameterToParameterSet
Parameter * CreateAndAddTimeParameterToParameterSet(const struct ServiceData *service_data_p, ParameterSet *params_p, ParameterGroup *group_p, const char *const name_s, const char *const display_name_s, const char *const description_s, const struct tm *default_value_p, const struct tm *current_value_p, uint8 level)
FreeTimeParameter
void FreeTimeParameter(TimeParameter *param_p)