~drizzle-trunk/drizzle/development

1089.1.13 by Brian Aker
Sorting methods into class files.
1
/* - mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 MySQL
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; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
20
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
21
#pragma once
1241.9.57 by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined.
22
2210.3.2 by Olaf van der Spek
Remove dynamic_element
23
#include <cstddef>
24
25
namespace drizzled {
26
27
class DYNAMIC_ARRAY
28
{
29
public:
1089.1.13 by Brian Aker
Sorting methods into class files.
30
  unsigned char *buffer;
2183.2.20 by Olaf van der Spek
Use List::size()
31
  size_t max_element;
1089.1.13 by Brian Aker
Sorting methods into class files.
32
  uint32_t alloc_increment;
33
  uint32_t size_of_element;
2183.2.20 by Olaf van der Spek
Use List::size()
34
2210.3.5 by Olaf van der Spek
Refactor
35
  void push_back(void*);
2210.3.1 by Olaf van der Spek
Remove o
36
2183.2.20 by Olaf van der Spek
Use List::size()
37
  size_t size() const
38
  {
39
    return elements;
40
  }
2221.7.1 by Olaf van der Spek
DYNAMIC_ARRAY::size()
41
42
  void set_size(size_t v)
43
  {
44
    elements = v;
45
  }
46
private:
47
  size_t elements;
2210.3.2 by Olaf van der Spek
Remove dynamic_element
48
};
1089.1.13 by Brian Aker
Sorting methods into class files.
49
50
#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D)
51
#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D)
52
2210.3.5 by Olaf van der Spek
Refactor
53
bool init_dynamic_array2(DYNAMIC_ARRAY *array,uint32_t element_size,
1089.1.13 by Brian Aker
Sorting methods into class files.
54
                                   void *init_buffer, uint32_t init_alloc,
55
                                   uint32_t alloc_increment);
2210.3.5 by Olaf van der Spek
Refactor
56
unsigned char *alloc_dynamic(DYNAMIC_ARRAY *array);
57
unsigned char *pop_dynamic(DYNAMIC_ARRAY*);
58
void delete_dynamic(DYNAMIC_ARRAY *array);
1089.1.13 by Brian Aker
Sorting methods into class files.
59
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
60
} /* namespace drizzled */
1089.1.13 by Brian Aker
Sorting methods into class files.
61