3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
21 #include "fundamental_type.h"
26 #endif /* __cplusplus */
30 * @brief Provides parameter spec creation for various data type
33 /** @addtogroup engine_controller
38 * @brief Callback function which copies parameter data in structure type
39 * @param[in] pStruct Parameter data in structure type to copy from
40 * @return Pointer of newly copied structure�
42 typedef sync_agent_ec_pointer(*sync_agent_copy_struct_cb) (sync_agent_ec_pointer pStruct);
45 * @brief Callback function which frees parameter data in structure type
46 * @param[in] pStruct Parameter data in structure type to free
48 typedef void (*sync_agent_free_struct_cb) (sync_agent_ec_pointer pStruct);
51 * @brief Callback function which validates parameter data in structure type
52 * @param[in] pStruct Parameter data in structure type to validate
53 * @return 1 on validation success case, otherwise 0
55 typedef sync_agent_ec_boolean(*sync_agent_validate_struct_cb) (sync_agent_ec_pointer pStruct, sync_agent_ec_pointer usr_data);
58 * @brief Enumerations of flag which indicates sort of parameter
61 SYNC_AGENT_EC_PARAM_FLAG_DEFAULT = 0, /**< Default type */
62 SYNC_AGENT_EC_PARAM_FLAG_INPUT = 1, /**< Input type */
63 SYNC_AGENT_EC_PARAM_FLAG_OUTPUT = 2, /**< Output type */
64 SYNC_AGENT_EC_PARAM_FLAG_INPUT_VALIDATE_ON = 4, /**< Input-validate type */
65 SYNC_AGENT_EC_PARAM_FLAG_OUTPUT_VALIDATE_ON = 8, /**< Output-validate type */
66 SYNC_AGENT_EC_PARAM_FLAG_INPUT_DEFAULT_VALUE_ON = 16
67 /**< Intput-default-value type */
68 } sync_agent_ec_param_flags_e;
71 * @brief Structure of parameter spec which contains function parameter spec
73 typedef struct sync_agent_ec_param_param_spec sync_agent_ec_param_spec_s;
76 * @brief Decreases reference count of parameter spec
79 sync_agent_ec_param_spec_s *pParam_spec1 = sync_agent_alloc_param_spec_int("accountId", true, false, false, 0, 0, false, 0, false, 0, 0);
80 sync_agent_ec_param_spec_s *pParam_spec2 = sync_agent_alloc_param_spec_structure("syncMode", _string_copy_struct, free, true, false, false, NULL, false, NULL, false, NULL);
81 sync_agent_ec_param_spec_s *param_spec_array[2] = {pParam_spec1, pParam_spec2};
83 sync_agent_ec_task_spec_s *pTask_spec = sync_agent_alloc_simple_task_spec("synchronize", synchronize_task_process, NULL, NULL, 2, param_spec_array);
85 sync_agent_unref_param_spec(pParam_spec1);
86 sync_agent_unref_param_spec(pParam_spec2);
88 * @param[in] param_spec Pointer of parameter spec to decrease ref count
90 void sync_agent_unref_param_spec(sync_agent_ec_param_spec_s * param_spec);
93 * @brief Allocs and returns int type of parameter spec
96 sync_agent_ec_param_spec_s *pParam_spec1 = sync_agent_alloc_param_spec_int("accountId", true, false, false, 0, 0, false, 0, false, 0, 0);
98 * @param[in] name Name of parameter which user defined
99 * @param[in] is_input On if this parameter to be used as input
100 * @param[in] is_output On if this parameter to be used as output
101 * @param[in] input_validate_on On if want to perform input parameter value validation
102 * @param[in] input_minimum Minimum value of valid input parameter value range
103 * @param[in] input_maximum Maximum value of valid input parameter value range
104 * @param[in] input_default_on On if this parameter to contain default value
105 * @param[in] input_default_value Default value for this parameter to contain
106 * @param[in] output_validate_on On if want to perform output parameter value validation
107 * @param[in] output_minimum Minimum value of valid output parameter value range
108 * @param[in] output_maximum Maximum value of valid output parameter value range
109 * @return Pointer of parameter spec which defined as ordered type
111 sync_agent_ec_param_spec_s *sync_agent_alloc_param_spec_int(const sync_agent_ec_char * name, sync_agent_ec_boolean is_input, sync_agent_ec_boolean is_output, sync_agent_ec_boolean input_validate_on, sync_agent_ec_int input_minimum,
112 sync_agent_ec_int input_maximum, sync_agent_ec_boolean input_default_on, sync_agent_ec_int input_default_value, sync_agent_ec_boolean output_validate_on, sync_agent_ec_int output_minimum,
113 sync_agent_ec_int output_maximum);
116 * @brief Allocs and returns structure(Pointer) type of parameter spec
119 sync_agent_ec_param_spec_s *pParam_spec2 = sync_agent_alloc_param_spec_structure("syncMode", _string_copy_struct, free, true, false, false, NULL, false, NULL, false, NULL);
121 * @param[in] name Name of parameter which user defined
122 * @param[in] copy_func Function which can make copy of this structure type of parameter
123 * @param[in] free_func Function which can free this structure type of parameter
124 * @param[in] is_input On if this parameter to be used as input
125 * @param[in] is_output On if this parameter to be used as output
126 * @param[in] input_validate_on On if want to perform input parameter value validation
127 * @param[in] in_val_func Function which can validate this structure type of input parameter
128 * @param[in] input_default_on On if this parameter to contain default value
129 * @param[in] default_struct Default value of this structure type of parameter
130 * @param[in] output_validate_on On if want to perform output parameter value validation
131 * @param[in] out_val_func which can validate this structure type of output parameter
132 * @return Pointer of parameter spec which defined as ordered type
134 sync_agent_ec_param_spec_s *sync_agent_alloc_param_spec_structure(const sync_agent_ec_char * name, sync_agent_copy_struct_cb copy_func, sync_agent_free_struct_cb free_func, sync_agent_ec_boolean is_input, sync_agent_ec_boolean is_output,
135 sync_agent_ec_boolean input_validate_on, sync_agent_validate_struct_cb in_val_func, sync_agent_ec_boolean input_default_on, sync_agent_ec_pointer default_struct,
136 sync_agent_ec_boolean output_validate_on, sync_agent_validate_struct_cb out_val_func);
144 #endif /* __cplusplus */
145 #endif /* PARAM_SPEC_H_ */