Eneboo - Documentación para desarrolladores
src/libmysql_std/include/my_bitmap.h
Ir a la documentación de este archivo.
00001 /* Copyright (C) 2000 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
00015 
00016 #ifndef _my_bitmap_h_
00017 #define _my_bitmap_h_
00018 
00019 #include <my_pthread.h>
00020 
00021 #define MY_BIT_NONE (~(uint) 0)
00022 
00023 typedef struct st_bitmap
00024 {
00025   uchar *bitmap;
00026   uint bitmap_size; /* number of bytes occupied by the above */
00027   /*
00028      mutex will be acquired for the duration of each bitmap operation if
00029      thread_safe flag in bitmap_init was set.  Otherwise, we optimize by not
00030      acquiring the mutex
00031    */
00032 #ifdef THREAD
00033   pthread_mutex_t *mutex;
00034 #endif
00035 } MY_BITMAP;
00036 
00037 #ifdef  __cplusplus
00038 extern "C" {
00039 #endif
00040 extern my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2);
00041 extern my_bool bitmap_init(MY_BITMAP *map, uchar *buf, uint bitmap_size, my_bool thread_safe);
00042 extern my_bool bitmap_is_clear_all(const MY_BITMAP *map);
00043 extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size);
00044 extern my_bool bitmap_is_set(const MY_BITMAP *map, uint bitmap_bit);
00045 extern my_bool bitmap_is_set_all(const MY_BITMAP *map);
00046 extern my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2);
00047 extern my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit);
00048 extern my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit);
00049 extern uint bitmap_set_next(MY_BITMAP *map);
00050 extern uint bitmap_get_first(const MY_BITMAP *map);
00051 extern uint bitmap_bits_set(const MY_BITMAP *map);
00052 extern void bitmap_clear_all(MY_BITMAP *map);
00053 extern void bitmap_clear_bit(MY_BITMAP *map, uint bitmap_bit);
00054 extern void bitmap_free(MY_BITMAP *map);
00055 extern void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2);
00056 extern void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit);
00057 extern void bitmap_set_all(MY_BITMAP *map);
00058 extern void bitmap_set_bit(MY_BITMAP *map, uint bitmap_bit);
00059 extern void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size);
00060 extern void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2);
00061 extern void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2);
00062 
00063 /* Fast, not thread safe, bitmap functions */
00064 #define bitmap_fast_set_bit(MAP, BIT) (MAP)->bitmap[(BIT) / 8] |= (1 << ((BIT) & 7))
00065 #define bitmap_fast_clear_bit(MAP, BIT) (MAP)->bitmap[(BIT) / 8] &= ~ (1 << ((BIT) & 7))
00066 #define bitmap_fast_is_set(MAP, BIT) (MAP)->bitmap[(BIT) / 8] & (1 << ((BIT) & 7))
00067 
00068 #ifdef  __cplusplus
00069 }
00070 #endif
00071 
00072 #endif /* _my_bitmap_h_ */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'