~drizzle-trunk/drizzle/development

483.1.1 by Lee
latest code cleanup for Field_real
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
1122.2.10 by Monty Taylor
Fixed all of the include guards.
21
#ifndef DRIZZLED_FIELD_REAL_H
22
#define DRIZZLED_FIELD_REAL_H
483.1.1 by Lee
latest code cleanup for Field_real
23
584.5.1 by Monty Taylor
Removed field includes from field.h.
24
#include <drizzled/field/num.h>
483.1.1 by Lee
latest code cleanup for Field_real
25
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
26
namespace drizzled
27
{
28
483.1.1 by Lee
latest code cleanup for Field_real
29
/* base class for float and double and decimal (old one) */
30
class Field_real :public Field_num {
31
public:
32
  bool not_fixed;
33
873.2.18 by Monty Taylor
Fixed some solaris warnings.
34
  using Field::unpack;
892.1.2 by Monty Taylor
Fixed solaris warnings.
35
  using Field::pack;
873.2.18 by Monty Taylor
Fixed some solaris warnings.
36
483.1.1 by Lee
latest code cleanup for Field_real
37
  Field_real(unsigned char *ptr_arg, uint32_t len_arg, unsigned char *null_ptr_arg,
38
             unsigned char null_bit_arg, utype unireg_check_arg,
39
             const char *field_name_arg,
40
             uint8_t dec_arg, bool zero_arg, bool unsigned_arg)
41
    :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
42
               field_name_arg, dec_arg, zero_arg, unsigned_arg),
43
    not_fixed(dec_arg >= NOT_FIXED_DEC)
44
    {}
45
  int store_decimal(const my_decimal *);
46
  my_decimal *val_decimal(my_decimal *);
47
  int truncate(double *nr, double max_length);
48
  uint32_t max_display_length() { return field_length; }
49
  uint32_t size_of() const { return sizeof(*this); }
50
  virtual const unsigned char *unpack(unsigned char* to, const unsigned char *from,
51
                              uint32_t param_data, bool low_byte_first);
52
  virtual unsigned char *pack(unsigned char* to, const unsigned char *from,
53
                      uint32_t max_length, bool low_byte_first);
54
};
55
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
56
} /* namespace drizzled */
57
1122.2.10 by Monty Taylor
Fixed all of the include guards.
58
#endif /* DRIZZLED_FIELD_REAL_H */