00001 /* 00002 * @(#)hprof_table.h 1.15 10/03/23 00003 * 00004 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are met: 00008 * 00009 * -Redistribution of source code must retain the above copyright notice, this 00010 * list of conditions and the following disclaimer. 00011 * 00012 * -Redistribution in binary form must reproduce the above copyright notice, 00013 * this list of conditions and the following disclaimer in the documentation 00014 * and/or other materials provided with the distribution. 00015 * 00016 * Neither the name of Oracle or the names of contributors may 00017 * be used to endorse or promote products derived from this software without 00018 * specific prior written permission. 00019 * 00020 * This software is provided "AS IS," without a warranty of any kind. ALL 00021 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING 00022 * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 00023 * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") 00024 * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE 00025 * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS 00026 * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST 00027 * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, 00028 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY 00029 * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, 00030 * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 00031 * 00032 * You acknowledge that this software is not designed, licensed or intended 00033 * for use in the design, construction, operation or maintenance of any 00034 * nuclear facility. 00035 */ 00036 00037 #ifndef HPROF_TABLE_H 00038 #define HPROF_TABLE_H 00039 00040 /* Key based generic lookup table */ 00041 00042 struct LookupTable; 00043 00044 typedef void (*LookupTableIterator) 00045 (TableIndex, void *key_ptr, int key_len, void*, void*); 00046 00047 struct LookupTable * table_initialize(const char *name, int size, 00048 int incr, int buckets, int esize); 00049 int table_element_count(struct LookupTable *ltable); 00050 TableIndex table_create_entry(struct LookupTable *ltable, 00051 void *key_ptr, int key_len, void *info_ptr); 00052 TableIndex table_find_entry(struct LookupTable *ltable, 00053 void *key_ptr, int key_len); 00054 TableIndex table_find_or_create_entry(struct LookupTable *ltable, 00055 void *key_ptr, int key_len, 00056 jboolean *pnew_entry, void *info_ptr); 00057 void table_free_entry(struct LookupTable *ltable, 00058 TableIndex index); 00059 void table_cleanup(struct LookupTable *ltable, 00060 LookupTableIterator func, void *arg); 00061 void table_walk_items(struct LookupTable *ltable, 00062 LookupTableIterator func, void *arg); 00063 void * table_get_info(struct LookupTable *ltable, 00064 TableIndex index); 00065 void table_get_key(struct LookupTable *ltable, 00066 TableIndex index, void **pkey_ptr, 00067 int *pkey_len); 00068 void table_lock_enter(struct LookupTable *ltable); 00069 void table_lock_exit(struct LookupTable *ltable); 00070 00071 #endif 00072
1.6.1