00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00026 #ifndef _UCOMMON_BITMAP_H_
00027 #define _UCOMMON_BITMAP_H_
00028
00029 #ifndef _UCOMMON_CONFIG_H_
00030 #include <ucommon/platform.h>
00031 #endif
00032
00033 NAMESPACE_UCOMMON
00034
00051 class __EXPORT bitmap
00052 {
00053 protected:
00054 size_t size;
00055
00056 typedef union
00057 {
00058 void *a;
00059 uint8_t *b;
00060 uint16_t *w;
00061 uint32_t *l;
00062 uint64_t *d;
00063 } addr_t;
00064
00065 addr_t addr;
00066
00067 public:
00071 typedef enum {
00072 BMALLOC,
00073 B8,
00074 B16,
00075 B32,
00076 B64,
00077 BMIN = BMALLOC,
00078 BMAX = B64
00079 } bus_t;
00080
00081 protected:
00082 bus_t bus;
00083
00084 unsigned memsize(void);
00085
00086 public:
00093 bitmap(void *addr, size_t length, bus_t size = B8);
00094
00100 bitmap(size_t length);
00101
00107 ~bitmap();
00108
00112 void clear(void);
00113
00119 bool get(size_t offset);
00120
00126 void set(size_t offset, bool value);
00127 };
00128
00129 END_NAMESPACE
00130
00131 #endif