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