Drizzled Public API Documentation

real.h
00001 /* - mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 MySQL
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 #pragma once
00022 
00023 #include <drizzled/field/num.h>
00024 
00025 namespace drizzled
00026 {
00027 
00028 /* base class for float and double and decimal (old one) */
00029 class Field_real :public Field_num {
00030 public:
00031   bool not_fixed;
00032 
00033   using Field::unpack;
00034   using Field::pack;
00035 
00036   Field_real(unsigned char *ptr_arg, uint32_t len_arg, unsigned char *null_ptr_arg,
00037              unsigned char null_bit_arg, utype unireg_check_arg,
00038              const char *field_name_arg,
00039              uint8_t dec_arg, bool zero_arg, bool unsigned_arg)
00040     :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
00041                field_name_arg, dec_arg, zero_arg, unsigned_arg),
00042     not_fixed(dec_arg >= NOT_FIXED_DEC)
00043     {}
00044   int store_decimal(const type::Decimal *);
00045   type::Decimal *val_decimal(type::Decimal *) const;
00046   int truncate(double *nr, double max_length);
00047   uint32_t max_display_length() { return field_length; }
00048   uint32_t size_of() const { return sizeof(*this); }
00049   virtual const unsigned char *unpack(unsigned char* to, const unsigned char *from,
00050                               uint32_t param_data, bool low_byte_first);
00051   virtual unsigned char *pack(unsigned char* to, const unsigned char *from,
00052                       uint32_t max_length, bool low_byte_first);
00053 };
00054 
00055 } /* namespace drizzled */
00056