~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/key_map.cc

  • Committer: Monty Taylor
  • Date: 2009-04-25 20:45:19 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 1003.
  • Revision ID: mordred@inaugust.com-20090425204519-lgrl7mz2r66v0jby
Blackhole.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
 
20
#include <drizzled/global.h>
21
21
 
22
22
#include <drizzled/key_map.h>
23
23
 
24
 
namespace drizzled
 
24
bool is_subset(const key_map& map, const key_map& map2)
25
25
{
26
26
 
27
 
bool is_keymap_prefix(const key_map& map, const uint32_t prefix_size)
 
27
  size_t count;
 
28
  for (count= 0; count < map.size(); count++)
 
29
  {
 
30
    if (map[count] & ~map2[count])
 
31
      return true;
 
32
  }
 
33
  return false;
 
34
 
 
35
}
 
36
 
 
37
bool is_prefix(const key_map& map, const uint32_t prefix_size)
28
38
{
29
39
  size_t pos= 0;
30
40
 
31
41
  for (; pos < prefix_size; pos++)
32
 
    if (! map.test(pos))
 
42
    if (map[pos] == false)
33
43
      return false;
34
44
 
35
45
  /*TODO: huh?
39
49
  */
40
50
 
41
51
  for (; pos < map.size(); pos++)
42
 
    if (map.test(pos))
 
52
    if (map[pos] == true)
43
53
      return false;
44
54
 
45
55
  return true;
46
56
}
47
57
 
48
 
void set_prefix(key_map& map, const uint32_t prefix_size)
49
 
{
50
 
  size_t pos= 0;
51
 
 
52
 
  for (; pos < prefix_size && pos < map.size(); pos++)
53
 
  {
54
 
    map.set(pos);
55
 
  }
56
 
}
57
 
 
58
58
bool is_overlapping(const key_map& map, const key_map& map2)
59
59
{
60
60
  size_t count;
65
65
  }
66
66
  return true;
67
67
}
68
 
 
69
 
void key_map_subtract(key_map& map1, key_map& map2)
70
 
{
71
 
  map1&= map2.flip();
72
 
  map2.flip();
73
 
}
74
 
 
75
 
} /* namespace drizzled */