OSDN Git Service

4320701c03aaa63e35c1de7a9bc122308e7d61cb
[hos/hos-v4a.git] / aplfw / library / container / assoc / assoc.h
1 /** 
2  *  Hyper Operating System  Application Framework
3  *
4  * @file  assocbuf.h
5  * @brief %jp{連想バッファクラス}
6  *
7  * Copyright (C) 2006 by Project HOS
8  * http://sourceforge.jp/projects/hos/
9  */
10
11
12 #ifndef __HOS__assoc_h__
13 #define __HOS__assoc_h__
14
15
16 #include "library/container/list/list.h"
17
18 #define ASSOC_ERR_OK    0
19 #define ASSOC_ERR_NG    (-1)
20
21 typedef void*   ASSOC_POS;
22 typedef int     ASSOC_ERR;
23
24 /* ストリームバッファクラス */
25 typedef struct c_assocbuf
26 {
27         C_LIST  List;   /* とりあえず手抜き(そのうちB-Treeとかに....) */
28         C_MEMIF *pMemIf;
29 } C_ASSOC;
30
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /* 生成/削除 */
37 void        Assoc_Create(C_ASSOC *self);                                                                                                        /* 連想バッファの生成 */
38 void        Assoc_CreateEx(C_ASSOC *self, C_MEMIF *pMemIf);                                                                     /* 連想バッファの生成 */
39 void        Assoc_Delete(C_ASSOC *self);                                                                                                        /* 連想バッファの削除 */
40
41 /* 操作 */
42 ASSOC_ERR   Assoc_Add(C_ASSOC *self, const char *pszKey, const void *pData, long lSize);        /* データの登録 */
43 const void *Assoc_Get(C_ASSOC *self, const char *pszKey);                                                                       /* データの参照 */
44 ASSOC_ERR   Assoc_Remove(C_ASSOC *self, const char *pszKey);                                                            /* データの削除 */
45
46 /* イテレータ操作 */
47 ASSOC_POS   Assoc_GetFirst(C_ASSOC *self);
48 ASSOC_POS   Assoc_GetNext(C_ASSOC *self, ASSOC_POS *Pos);
49 const void *Assoc_GetAt(C_ASSOC *self, ASSOC_POS *Pos, const char **ppszKey);
50
51 #ifdef __cplusplus
52 }
53 #endif
54
55
56
57 #endif  /* __HOS__assocbuf_h__ */
58