libamxc  1.10.3
C Generic Data Containers
variant_dummy_types.c
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** SPDX-License-Identifier: BSD-2-Clause-Patent
4 **
5 ** SPDX-FileCopyrightText: Copyright (c) 2023 SoftAtHome
6 **
7 ** Redistribution and use in source and binary forms, with or without modification,
8 ** are permitted provided that the following conditions are met:
9 **
10 ** 1. Redistributions of source code must retain the above copyright notice,
11 ** this list of conditions and the following disclaimer.
12 **
13 ** 2. Redistributions in binary form must reproduce the above copyright notice,
14 ** this list of conditions and the following disclaimer in the documentation
15 ** and/or other materials provided with the distribution.
16 **
17 ** Subject to the terms and conditions of this license, each copyright holder
18 ** and contributor hereby grants to those receiving rights under this license
19 ** a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
20 ** (except for failure to satisfy the conditions of this license) patent license
21 ** to make, have made, use, offer to sell, sell, import, and otherwise transfer
22 ** this software, where such license applies only to those patent claims, already
23 ** acquired or hereafter acquired, licensable by such copyright holder or contributor
24 ** that are necessarily infringed by:
25 **
26 ** (a) their Contribution(s) (the licensed copyrights of copyright holders and
27 ** non-copyrightable additions of contributors, in source or binary form) alone;
28 ** or
29 **
30 ** (b) combination of their Contribution(s) with the work of authorship to which
31 ** such Contribution(s) was added by such copyright holder or contributor, if,
32 ** at the time the Contribution is added, such addition causes such combination
33 ** to be necessarily infringed. The patent license shall not apply to any other
34 ** combinations which include the Contribution.
35 **
36 ** Except as expressly stated above, no rights or licenses from any copyright
37 ** holder or contributor is granted under this license, whether expressly, by
38 ** implication, estoppel or otherwise.
39 **
40 ** DISCLAIMER
41 **
42 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
43 ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45 ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
46 ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
48 ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
49 ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
51 ** USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 **
53 ****************************************************************************/
54 #include <stdlib.h>
55 
56 #include <amxc/amxc_variant_type.h>
57 #include <amxc/amxc_variant.h>
58 #include <amxc/amxc_htable.h>
59 #include <amxc_variant_priv.h>
60 
62 {
63  .init = NULL,
64  .del = NULL,
65  .copy = NULL,
66  .convert_from = NULL,
67  .convert_to = NULL,
68  .compare = NULL,
69  .name = AMXC_VAR_NAME_INT8
70 };
71 
73 {
74  .init = NULL,
75  .del = NULL,
76  .copy = NULL,
77  .convert_from = NULL,
78  .convert_to = NULL,
79  .compare = NULL,
80  .name = AMXC_VAR_NAME_INT16
81 };
82 
84 {
85  .init = NULL,
86  .del = NULL,
87  .copy = NULL,
88  .convert_from = NULL,
89  .convert_to = NULL,
90  .compare = NULL,
91  .name = AMXC_VAR_NAME_INT32
92 };
93 
95 {
96  .init = NULL,
97  .del = NULL,
98  .copy = NULL,
99  .convert_from = NULL,
100  .convert_to = NULL,
101  .compare = NULL,
102  .name = AMXC_VAR_NAME_UINT8
103 };
104 
106 {
107  .init = NULL,
108  .del = NULL,
109  .copy = NULL,
110  .convert_from = NULL,
111  .convert_to = NULL,
112  .compare = NULL,
113  .name = AMXC_VAR_NAME_UINT16
114 };
115 
117 {
118  .init = NULL,
119  .del = NULL,
120  .copy = NULL,
121  .convert_from = NULL,
122  .convert_to = NULL,
123  .compare = NULL,
124  .name = AMXC_VAR_NAME_UINT32
125 };
126 
128 {
129  .init = NULL,
130  .del = NULL,
131  .copy = NULL,
132  .convert_from = NULL,
133  .convert_to = NULL,
134  .compare = NULL,
135  .name = AMXC_VAR_NAME_FLOAT
136 };
137 
139 {
140  .init = NULL,
141  .del = NULL,
142  .copy = NULL,
143  .convert_from = NULL,
144  .convert_to = NULL,
145  .compare = NULL,
146  .name = AMXC_VAR_NAME_DOUBLE
147 };
148 
150 {
151  .init = NULL,
152  .del = NULL,
153  .copy = NULL,
154  .convert_from = NULL,
155  .convert_to = NULL,
156  .compare = NULL,
157  .name = AMXC_VAR_NAME_FD
158 };
159 
161 {
162  .init = NULL,
163  .del = NULL,
164  .copy = NULL,
165  .convert_from = NULL,
166  .convert_to = NULL,
167  .compare = NULL,
168  .name = "dummy_custom_t"
169 };
170 
172  NULL,
173  NULL,
174  &dummy_int8_t,
175  &dummy_int16_t,
176  &dummy_int32_t,
177  NULL,
178  &dummy_uint8_t,
181  NULL,
182  &dummy_float_t,
184  NULL,
185  NULL,
186  NULL,
187  &dummy_fd_t
188 };
189 
191  for(uint32_t i = 0; i < AMXC_VAR_ID_CUSTOM_BASE; i++) {
192  if(dummies[i] != NULL) {
193  amxc_var_add_type(dummies[i], i);
194  }
195  }
196 
198 }
199 
201  for(uint32_t i = 0; i < AMXC_VAR_ID_CUSTOM_BASE; i++) {
202  if(dummies[i] != NULL) {
204  }
205  }
207 }
Ambiorix hash table API header file.
#define CONSTRUCTOR
Definition: amxc_macros.h:86
#define DESTRUCTOR
Definition: amxc_macros.h:90
Ambiorix variant API header file.
uint32_t PRIVATE amxc_var_add_type(amxc_var_type_t *const type, const uint32_t index)
int PRIVATE amxc_var_remove_type(amxc_var_type_t *const type)
Ambiorix ring buffer API header file.
#define AMXC_VAR_NAME_UINT32
Provides a name for variant id AMXC_VAR_ID_UINT32.
Definition: amxc_variant.h:318
#define AMXC_VAR_NAME_UINT8
Provides a name for variant id AMXC_VAR_ID_UINT8.
Definition: amxc_variant.h:306
#define AMXC_VAR_ID_CUSTOM_BASE
Base variant id for custom variants.
Definition: amxc_variant.h:257
#define AMXC_VAR_NAME_INT16
Provides a name for variant id AMXC_VAR_ID_INT16.
Definition: amxc_variant.h:288
#define AMXC_VAR_NAME_INT32
Provides a name for variant id AMXC_VAR_ID_INT32.
Definition: amxc_variant.h:294
#define AMXC_VAR_NAME_INT8
Provides a name for variant id AMXC_VAR_ID_INT8.
Definition: amxc_variant.h:282
#define AMXC_VAR_NAME_FD
Provides a name for variant id AMXC_VAR_ID_FD.
Definition: amxc_variant.h:360
#define AMXC_VAR_NAME_DOUBLE
Provides a name for variant id AMXC_VAR_ID_DOUBLE.
Definition: amxc_variant.h:336
#define AMXC_VAR_NAME_FLOAT
Provides a name for variant id AMXC_VAR_ID_FLOAT.
Definition: amxc_variant.h:330
#define AMXC_VAR_NAME_UINT16
Provides a name for variant id AMXC_VAR_ID_UINT16.
Definition: amxc_variant.h:312
uint32_t amxc_var_register_type(amxc_var_type_t *const type)
Register a new variant type.
int amxc_var_unregister_type(amxc_var_type_t *const type)
Unregisters an already registered variant type.
A variant type structure.
amxc_var_new_fn_t init
static amxc_var_type_t dummy_int8_t
static amxc_var_type_t dummy_int16_t
static amxc_var_type_t dummy_double_t
static amxc_var_type_t dummy_uint8_t
static amxc_var_type_t * dummies[AMXC_VAR_ID_CUSTOM_BASE+1]
static amxc_var_type_t dummy_float_t
static amxc_var_type_t dummy_custom_t
static amxc_var_type_t dummy_uint16_t
static DESTRUCTOR void test_remove_dummy_types()
static amxc_var_type_t dummy_fd_t
static amxc_var_type_t dummy_int32_t
static CONSTRUCTOR void test_add_dummy_types()
static amxc_var_type_t dummy_uint32_t