File:  [ELWIX - Embedded LightWeight unIX -] / gpl / axl / src / axl_hash.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Jun 8 07:09:12 2011 UTC (13 years, 2 months ago) by misho
Branches: axl, MAIN
CVS tags: HEAD, AXL0_6_7, AXL0_6_1
3th party - XML

    1: /*
    2:  *  LibAxl:  Another XML library
    3:  *  Copyright (C) 2006 Advanced Software Production Line, S.L.
    4:  *
    5:  *  This program is free software; you can redistribute it and/or
    6:  *  modify it under the terms of the GNU Lesser General Public License
    7:  *  as published by the Free Software Foundation; either version 2.1 of
    8:  *  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 Lesser General Public License for more details.
   14:  *
   15:  *  You should have received a copy of the GNU Lesser General Public
   16:  *  License along with this program; if not, write to the Free
   17:  *  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   18:  *  02111-1307 USA
   19:  *  
   20:  *  You may find a copy of the license under this software is released
   21:  *  at COPYING file. This is LGPL software: you are welcome to
   22:  *  develop proprietary applications using this library without any
   23:  *  royalty or fee but returning back any change, improvement or
   24:  *  addition in the form of source code, project image, documentation
   25:  *  patches, etc. 
   26:  *
   27:  *  For commercial support on build XML enabled solutions contact us:
   28:  *          
   29:  *      Postal address:
   30:  *         Advanced Software Production Line, S.L.
   31:  *         Edificio Alius A, Oficina 102,
   32:  *         C/ Antonio Suarez Nº 10,
   33:  *         Alcalá de Henares 28802 Madrid
   34:  *         Spain
   35:  *
   36:  *      Email address:
   37:  *         info@aspl.es - http://www.aspl.es/xml
   38:  */
   39: #ifndef __AXL_HASH_H__
   40: #define __AXL_HASH_H__
   41: 
   42: #include <axl_decl.h>
   43: 
   44: BEGIN_C_DECLS
   45: 
   46: axlHash       * axl_hash_new          (axlHashFunc    hash,
   47: 				       axlEqualFunc   equal);
   48: 
   49: axlHash       * axl_hash_new_full     (axlHashFunc    hash,
   50: 				       axlEqualFunc   equal,
   51: 				       int            step);
   52: 
   53: unsigned int    axl_hash_string       (axlPointer key);
   54: 
   55: int             axl_hash_equal_string (axlPointer keya, 
   56: 				       axlPointer keyb);
   57: 
   58: unsigned int    axl_hash_int          (axlPointer key);
   59: 
   60: int             axl_hash_equal_int    (axlPointer keya, 
   61: 				       axlPointer keyb);
   62: 
   63: void            axl_hash_insert       (axlHash    * hash, 
   64: 				       axlPointer   key,
   65: 				       axlPointer   data);
   66: 
   67: void            axl_hash_insert_full  (axlHash        * hash,
   68: 				       axlPointer       key,
   69: 				       axlDestroyFunc   destroy_key,
   70: 				       axlPointer       data,
   71: 				       axlDestroyFunc   destroy_data);
   72: 
   73: axl_bool        axl_hash_remove       (axlHash    * hash,
   74: 				       axlPointer   key);
   75: 
   76: axl_bool        axl_hash_delete       (axlHash    * hash,
   77: 				       axlPointer   key);
   78: 
   79: axl_bool        axl_hash_exists       (axlHash   * hash,
   80: 				       axlPointer  key);
   81: 
   82: axlPointer      axl_hash_get          (axlHash * hash, 
   83: 				       axlPointer key);
   84: 
   85: void            axl_hash_foreach      (axlHash            * hash, 
   86: 				       axlHashForeachFunc   func, 
   87: 				       axlPointer           user_data);
   88: 
   89: void            axl_hash_foreach2     (axlHash            * hash, 
   90: 				       axlHashForeachFunc2  func, 
   91: 				       axlPointer           user_data,
   92: 				       axlPointer           user_data2);
   93: 
   94: void            axl_hash_foreach3     (axlHash            * hash, 
   95: 				       axlHashForeachFunc3  func, 
   96: 				       axlPointer           user_data,
   97: 				       axlPointer           user_data2,
   98: 				       axlPointer           user_data3);
   99: 
  100: void            axl_hash_foreach4     (axlHash            * hash, 
  101: 				       axlHashForeachFunc4  func, 
  102: 				       axlPointer           user_data,
  103: 				       axlPointer           user_data2,
  104: 				       axlPointer           user_data3,
  105: 				       axlPointer           user_data4);
  106: 				
  107: int             axl_hash_items        (axlHash * hash);
  108: 
  109: int             axl_hash_capacity     (axlHash * hash);
  110: 
  111: axlHash       * axl_hash_copy         (axlHash             * hash,
  112: 				       axlHashItemCopy       key_copy,
  113: 				       axlHashItemCopy       value_copy);
  114: 				       
  115: 
  116: void            axl_hash_show_status  (axlHash * hash);
  117: 
  118: typedef void (*axlHashPrintKeyData) (axlPointer key, axlPointer data);
  119: 
  120: void            axl_hash_show_status_full (axlHash * hash, 
  121: 					   axlHashPrintKeyData show_item);
  122: 
  123: 
  124: void            axl_hash_free         (axlHash * hash);
  125: 
  126: /* cursor interface */
  127: axlHashCursor * axl_hash_cursor_new          (axlHash * hash);
  128: 
  129: void            axl_hash_cursor_first        (axlHashCursor * cursor);
  130: 
  131: void            axl_hash_cursor_last         (axlHashCursor * cursor);
  132: 
  133: void            axl_hash_cursor_next         (axlHashCursor * cursor);
  134: 
  135: axl_bool        axl_hash_cursor_has_next     (axlHashCursor * cursor);
  136: 
  137: axl_bool        axl_hash_cursor_has_item     (axlHashCursor * cursor);
  138: 
  139: void            axl_hash_cursor_remove       (axlHashCursor * cursor);
  140: 
  141: axlPointer      axl_hash_cursor_get_key      (axlHashCursor * cursor);
  142: 
  143: axlPointer      axl_hash_cursor_get_value    (axlHashCursor * cursor);
  144: 
  145: axlHash       * axl_hash_cursor_hash         (axlHashCursor * cursor);
  146: 
  147: void            axl_hash_cursor_free         (axlHashCursor * cursor);
  148: 
  149: /* private api */
  150: int             __axl_hash_spare_max         (axlHash * hash);
  151: 
  152: int             __axl_hash_spare_next        (axlHash * hash);
  153: 
  154: END_C_DECLS
  155: 
  156: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>