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_array_parameter.h
Go to the documentation of this file.
1 /*
2  * time_array_parameter.h
3  *
4  * Created on: 18 Feb 2023
5  * Author: billy
6  */
7 
8 #ifndef CORE_SHARED_SERVICES_INCLUDE_PARAMETERS_TIME_ARRAY_PARAMETER_H_
9 #define CORE_SHARED_SERVICES_INCLUDE_PARAMETERS_TIME_ARRAY_PARAMETER_H_
10 
11 
12 #include "parameter.h"
13 #include "parameter_set.h"
15 
16 #include "service.h"
17 
18 
19 typedef struct TimeArrayParameter
20 {
22 
23  struct tm **tap_current_values_pp;
24 
25  struct tm **tap_default_values_pp;
26 
28 
30 
31 
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
38 /*
39  * Allocate a TimeArrayParameter
40  *
41  * @param service_data_p The ServiceData for the Service that is allocating this Parameter.
42  * @param name_s The name of the Parameter. The Parameter will store a copy of this string so this value does not need to remain in scope.
43  * @param display_name_s An optional name to display for the Parameter for use in Clients. The Parameter will store a copy of this string so this value does not need to remain in scope.
44  * This can be <code>NULL</code>.
45  * @param description_s The description of the Parameter. The Parameter will store a copy of this string so this value does not need to remain in scope.
46  * @param options_p This can be used to constrain the Parameter to a fixed set of values. If this is <code>NULL</code> then the Parameter can be set to any value.
47  * @param default_value_p The default value for this Parameter.
48  * @param current_value_p If this is not <code>NULL</code>, then copy this value as the current value of the Parameter. If this is <code>NULL</code>, then current value for this Parameter
49  * will be set to be a copy of its default value.
50  * @param bounds_p If this is not <code>NULL</code>, then this will be used to specify the minimum and maximum values that this Parameter can take. If this is <code>NULL</code>,
51  * then the Parameter can take any value.
52  * @param level The ParameterLevel for this Parameter. This determines when the Client should display this Parameter to the user.
53  * @param check_value_fn If this is not <code>NULL</code>, then this will be used to check whether the Parameter has been set to a valid value.
54  * @return A newly-allocated Parameter or <code>NULL</code> upon error.
55  * @memberof BooleanParameter
56  */
57 GRASSROOTS_SERVICE_API TimeArrayParameter *AllocateTimeArrayParameter (const struct ServiceData *service_data_p, const char * const name_s, const char * const display_name_s, const char * const description_s, struct tm **default_values_pp, struct tm **current_values_pp, const size_t num_values, ParameterLevel level);
58 
59 
60 GRASSROOTS_SERVICE_API TimeArrayParameter *AllocateTimeArrayParameterFromJSON (const json_t *param_json_p, const struct Service *service_p, const bool concise_flag, const ParameterType *pt_p);
61 
62 
63 
65  const char * const name_s, const char * const display_name_s, const char * const description_s,
66  struct tm **default_values_pp, const size_t num_values, uint8 level);
67 
69  const char * const name_s, const char * const display_name_s, const char * const description_s,
70  struct tm **default_values_pp, struct tm **current_values_pp,
71  const size_t num_values, uint8 level);
72 
73 
75 
77 
79 
80 
82 
84 
85 GRASSROOTS_SERVICE_API const struct tm *GetTimeArrayParameterCurrentValueAtIndex (const TimeArrayParameter *param_p, const size_t index);
86 
87 
88 GRASSROOTS_SERVICE_API bool SetTimeArrayParameterCurrentValues (TimeArrayParameter *param_p, const struct tm **values_pp, const size_t num_values);
89 
90 
91 GRASSROOTS_SERVICE_API bool SetTimeArrayParameterDefaultValues (TimeArrayParameter *param_p, const struct tm **values_pp, const size_t num_values);
92 
93 
95 
96 
97 
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 
104 
105 #endif /* CORE_SHARED_SERVICES_INCLUDE_PARAMETERS_TIME_ARRAY_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
GetNumberOfTimeArrayCurrentParameterValues
size_t GetNumberOfTimeArrayCurrentParameterValues(const TimeArrayParameter *param_p)
ParameterType
ParameterType
The different types that a Parameter can take.
Definition: parameter_type.h:35
service.h
grassroots_service_library.h
parameter_set.h
GRASSROOTS_SERVICE_API
#define GRASSROOTS_SERVICE_API
Definition: grassroots_service_library.h:49
TimeArrayParameter
Definition: time_array_parameter.h:19
TimeArrayParameter::tap_base_param
Parameter tap_base_param
Definition: time_array_parameter.h:21
parameter.h
SetTimeArrayParameterDefaultValues
bool SetTimeArrayParameterDefaultValues(TimeArrayParameter *param_p, const struct tm **values_pp, const size_t num_values)
TimeArrayParameter::tap_current_values_pp
struct tm ** tap_current_values_pp
Definition: time_array_parameter.h:23
TimeArrayParameter::tap_default_values_pp
struct tm ** tap_default_values_pp
Definition: time_array_parameter.h:25
GetTimeArrayParameterCurrentValuesAsFlattenedString
char * GetTimeArrayParameterCurrentValuesAsFlattenedString(const TimeArrayParameter *param_p)
Service
A datatype which defines an available service, its capabilities and its parameters.
Definition: service.h:153
AllocateTimeArrayParameterFromJSON
TimeArrayParameter * AllocateTimeArrayParameterFromJSON(const json_t *param_json_p, const struct Service *service_p, const bool concise_flag, const ParameterType *pt_p)
ParameterLevel
ParameterLevel
The ParameterLevel defines the level that a user should be to adjust the Parameter.
Definition: parameter.h:52
SetTimeArrayParameterCurrentValues
bool SetTimeArrayParameterCurrentValues(TimeArrayParameter *param_p, const struct tm **values_pp, const size_t num_values)
CreateAndAddTimeArrayParameterToParameterSet
Parameter * CreateAndAddTimeArrayParameterToParameterSet(const 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, struct tm **default_values_pp, struct tm **current_values_pp, const size_t num_values, uint8 level)
AllocateTimeArrayParameter
TimeArrayParameter * AllocateTimeArrayParameter(const struct ServiceData *service_data_p, const char *const name_s, const char *const display_name_s, const char *const description_s, struct tm **default_values_pp, struct tm **current_values_pp, const size_t num_values, ParameterLevel level)
IsTimeArrayParameter
bool IsTimeArrayParameter(const Parameter *param_p)
TimeArrayParameter::tap_num_values
size_t tap_num_values
Definition: time_array_parameter.h:27
EasyCreateAndAddTimeArrayParameterToParameterSet
Parameter * EasyCreateAndAddTimeArrayParameterToParameterSet(const 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, struct tm **default_values_pp, const size_t num_values, uint8 level)
GetTimeArrayParameterDefaultValues
const struct tm ** GetTimeArrayParameterDefaultValues(const TimeArrayParameter *param_p)
GetTimeArrayParameterCurrentValueAtIndex
const struct tm * GetTimeArrayParameterCurrentValueAtIndex(const TimeArrayParameter *param_p, const size_t index)
GetTimeArrayParameterCurrentValues
const struct tm ** GetTimeArrayParameterCurrentValues(const TimeArrayParameter *param_p)
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
FreeTimeArrayParameter
void FreeTimeArrayParameter(TimeArrayParameter *param_p)