~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/optimizer/quick_range.h

Split some classes from the range optimizer out in to their own header and implementation files.
Corrected the case on these classes also to adhere to the coding standards. Cleaned up any style
issues in any code I came across while moving code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2008-2009 Sun Microsystems
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; version 2 of the License.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
 
19
 
 
20
#ifndef DRIZZLED_OPTIMIZER_QUICK_RANGE_H
 
21
#define DRIZZLED_OPTIMIZER_QUICK_RANGE_H
 
22
 
 
23
namespace drizzled
 
24
{
 
25
 
 
26
namespace optimizer
 
27
{
 
28
 
 
29
class QuickRange : public Sql_alloc 
 
30
{
 
31
public:
 
32
  unsigned char *min_key;
 
33
  unsigned char *max_key;
 
34
  uint16_t min_length;
 
35
  uint16_t max_length;
 
36
  uint16_t flag;
 
37
  key_part_map min_keypart_map; /**< bitmap of used keyparts in min_key */
 
38
  key_part_map max_keypart_map; /**< bitmap of used keyparts in max_key */
 
39
 
 
40
  QuickRange(); /**< Constructor for a "full range" */
 
41
  QuickRange(const unsigned char *min_key_arg,
 
42
              uint32_t min_length_arg,
 
43
              key_part_map min_keypart_map_arg,
 
44
                    const unsigned char *max_key_arg, 
 
45
              uint32_t max_length_arg,
 
46
              key_part_map max_keypart_map_arg,
 
47
                    uint32_t flag_arg)
 
48
    : 
 
49
      min_key((unsigned char*) sql_memdup(min_key_arg,min_length_arg+1)),
 
50
      max_key((unsigned char*) sql_memdup(max_key_arg,max_length_arg+1)),
 
51
      min_length((uint16_t) min_length_arg),
 
52
      max_length((uint16_t) max_length_arg),
 
53
      flag((uint16_t) flag_arg),
 
54
      min_keypart_map(min_keypart_map_arg),
 
55
      max_keypart_map(max_keypart_map_arg)
 
56
    {}
 
57
};
 
58
 
 
59
} /* namespace optimizer */
 
60
 
 
61
} /* namespace drizzled */
 
62
 
 
63
#endif /* DRIZZLED_OPTIMIZER_QUICK_RANGE_H */