メインページ | アルファベット順一覧 | 構成 | ファイル一覧 | 構成メンバ | ファイルメンバ | 関連ページ

# dkc2Tree.h

説明を見る。

    00001
    00017 #ifndef DKUTIL_C_2TREE_H
    00018 #define DKUTIL_C_2TREE_H
    00019
    00020 #include "dkcOSIndependent.h"
    00021 #include "dkcMemoryPool.h"
    00022
    00023
    00024
    00025
    00026 typedef struct dkc_2TreeNode{
    00028     void *key;
    00030     void *data;
    00032     size_t data_size;
    00034     struct dkc_2TreeNode *left;
    00036     struct dkc_2TreeNode *right;
    00037 }DKC_2TREE_NODE;
    00038
    00039
    00041 typedef struct dkc_2TreeRoot{
    00043     size_t now_num;
    00045     size_t max_num;
    00047     size_t pool_max;
    00048
    00050     size_t key_size;
    00052     DKC_COMPARE_TYPE compare;
    00054     DKC_SAME_OBJECT_POOL *key_ac;
    00056     DKC_SAME_OBJECT_POOL *obj_ac;
    00057
    00059     DKC_2TREE_NODE *root;
    00061     DKC_2TREE_NODE *sentinel;
    00062 }DKC_2TREE_ROOT;
    00063
    00064
    00072
    00073 DKC_EXTERN DKC_2TREE_ROOT * WINAPI
    00074     dkcAlloc2TreeRoot(size_t key_size,size_t pool_num,DKC_COMPARE_TYPE compare,size_t max_num);
    00082
    00083 DKC_EXTERN int WINAPI dkcFree2TreeRoot(DKC_2TREE_ROOT **ptr);
    00084
    00085
    00088
    00089 DKC_EXTERN int WINAPI dkc2TreeInsert(DKC_2TREE_ROOT *ptr,
    00090                                                                          const void *Key,const void *data,size_t data_size);
    00091
    00101 DKC_EXTERN int WINAPI dkc2TreeChain(DKC_2TREE_ROOT *dest,DKC_2TREE_ROOT *src);
    00102
    00103
    00104
    00105 //DKC_EXTERN int WINAPI dkc2TreeErase(DKC_2TREE_ROOT *ptr,DKC_2TREE_NODE **parent,DKC_2TREE_NODE *node);
    00106 DKC_EXTERN int WINAPI dkc2TreeErase(DKC_2TREE_ROOT *ptr,DKC_2TREE_NODE *node);
    00107
    00111 typedef struct dkc_2TreeExist{
    00112     BOOL isExist;
    00114     DKC_2TREE_NODE *parent;
    00116     DKC_2TREE_NODE *node;
    00118     DKC_2TREE_NODE **leaf_ptr;
    00119 }DKC_2TREE_EXIST;
    00120
    00122 DKC_EXTERN DKC_2TREE_EXIST WINAPI dkc2TreeExist(DKC_2TREE_ROOT *ptr,const DKC_2TREE_NODE *node);
    00123
    00127 DKC_EXTERN int WINAPI dkc2TreeEraseFromKey(DKC_2TREE_ROOT *ptr,const void *Key);
    00132 DKC_EXTERN DKC_2TREE_NODE * WINAPI dkc2TreeFindEqual(DKC_2TREE_ROOT *ptr,const void*Key);
    00133
    00134
    00135 DKC_EXTERN DKC_2TREE_NODE * WINAPI dkc2TreeFindMinimalGreater(DKC_2TREE_ROOT *ptr,const void* Key);
    00136
    00137 DKC_EXTERN DKC_2TREE_NODE * WINAPI dkc2TreeFindMaximumLess(DKC_2TREE_ROOT *ptr,const void* Key);
    00140
    00141 DKC_EXTERN int WINAPI dkc2TreeGetBuffer(DKC_2TREE_NODE *ptr,void *data,size_t size);
    00147 DKC_EXTERN int WINAPI dkc2TreeSetBuffer(DKC_2TREE_NODE *ptr,const void *data,size_t size);
    00149 #define dkcm2TREE_SET_BUFFER_ERROR(tr) (tr != edk_NoValueToProcess && DKUTIL_FAILED(tr))
    00150
    00151
    00152
    00153 #endif //end of include once