kinetic-c  v0.12.0
Seagate Kinetic Protocol Client Library for C
yacht.h
Go to the documentation of this file.
1 /*
2 * kinetic-c
3 * Copyright (C) 2015 Seagate Technology.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20 #ifndef YACHT_H
21 #define YACHT_H
22 
23 #include <stdlib.h>
24 #include <stdint.h>
25 #include <stdbool.h>
26 
28 #define YACHT_NO_KEY ((int)-1)
29 
31 #define YACHT_DELETED ((int)-2)
32 
36 struct yacht;
37 
39 struct yacht *Yacht_Init(uint8_t sz2);
40 
42 bool Yacht_Set(struct yacht *y, int key, void *value, void **old_value);
43 
45 bool Yacht_Get(struct yacht *y, int key, void **value);
46 
48 bool Yacht_Member(struct yacht *y, int key);
49 
52 bool Yacht_Remove(struct yacht *y, int key, void **old_value);
53 
55 typedef void (Yacht_Free_cb)(void *value, void *udata);
56 
58 void Yacht_Free(struct yacht *y, Yacht_Free_cb *cb, void *udata);
59 
60 #ifdef TEST
61 #include "yacht_internals.h"
62 #endif
63 
64 #endif
bool Yacht_Get(struct yacht *y, int key, void **value)
Get KEY from the table, setting *value if found.
Definition: yacht.c:73
void Yacht_Free(struct yacht *y, Yacht_Free_cb *cb, void *udata)
Free the table.
Definition: yacht.c:202
bool Yacht_Remove(struct yacht *y, int key, void **old_value)
Remove KEY from the table.
Definition: yacht.c:174
bool Yacht_Member(struct yacht *y, int key)
Check if KEY is in the table.
Definition: yacht.c:91
void( Yacht_Free_cb)(void *value, void *udata)
Callback to free values associated with keys.
Definition: yacht.h:55
bool Yacht_Set(struct yacht *y, int key, void *value, void **old_value)
Set KEY to VALUE in the table.
Definition: yacht.c:97
struct yacht * Yacht_Init(uint8_t sz2)
Init a hash table with approx.
Definition: yacht.c:41