3e70982aa20b8b6152ac48ce7c72a92759797cd8
[src/app-framework-binder.git] / src / u16id.h
1 /*
2  * Copyright (C) 2015-2019 "IoT.bzh"
3  * Author José Bollo <jose.bollo@iot.bzh>
4  *
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
8  *
9  *   http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 #pragma once
19
20 struct u16id2ptr;
21 struct u16id2bool;
22
23 /**********************************************************************/
24 /**        u16id2ptr                                                 **/
25 /**********************************************************************/
26
27 extern int u16id2ptr_create(struct u16id2ptr **pi2p);
28 extern void u16id2ptr_destroy(struct u16id2ptr **pi2p);
29 extern void u16id2ptr_dropall(struct u16id2ptr **pi2p);
30 extern int u16id2ptr_has(struct u16id2ptr *i2p, uint16_t id);
31 extern int u16id2ptr_add(struct u16id2ptr **pi2p, uint16_t id, void *ptr);
32 extern int u16id2ptr_set(struct u16id2ptr **pi2p, uint16_t id, void *ptr);
33 extern int u16id2ptr_put(struct u16id2ptr *i2p, uint16_t id, void *ptr);
34 extern int u16id2ptr_get(struct u16id2ptr *i2p, uint16_t id, void **ptr);
35 extern int u16id2ptr_drop(struct u16id2ptr **pi2p, uint16_t id, void **ptr);
36 extern int u16id2ptr_count(struct u16id2ptr *i2p);
37 extern int u16id2ptr_at(struct u16id2ptr *i2p, int index, uint16_t *pid, void **pptr);
38 extern void u16id2ptr_forall(
39                         struct u16id2ptr *i2p,
40                         void (*callback)(void*closure, uint16_t id, void *ptr),
41                         void *closure);
42
43 /**********************************************************************/
44 /**        u16id2bool                                                **/
45 /**********************************************************************/
46
47 extern int u16id2bool_create(struct u16id2bool **pi2b);
48 extern void u16id2bool_destroy(struct u16id2bool **pi2b);
49 extern void u16id2bool_clearall(struct u16id2bool **pi2b);
50 extern int u16id2bool_get(struct u16id2bool *i2b, uint16_t id);
51 extern int u16id2bool_set(struct u16id2bool **pi2b, uint16_t id, int value);