~xnox/ubuntu/saucy/drizzle/merge

« back to all changes in this revision

Viewing changes to .pc/debian-changes-2010.12.06-0ubuntu4/drizzled/hybrid_type.h

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2011-01-01 13:55:03 UTC
  • Revision ID: james.westby@ubuntu.com-20110101135503-x2ub1akxoisgwi6z
Tags: 2010.12.06-0ubuntu4
* Fixed missing build depends.
* Added Lee to uploaders.

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 Sun Microsystems, Inc.
 
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_HYBRID_TYPE_H
 
21
#define DRIZZLED_HYBRID_TYPE_H
 
22
 
 
23
#include <drizzled/decimal.h>
 
24
 
 
25
namespace drizzled
 
26
{
 
27
 
 
28
/*************************************************************************/
 
29
/*
 
30
  A framework to easily handle different return types for hybrid items
 
31
  (hybrid item is an item whose operand can be of any type, e.g. integer,
 
32
  real, decimal).
 
33
*/
 
34
 
 
35
class Hybrid_type_traits;
 
36
 
 
37
class Hybrid_type
 
38
{
 
39
public:
 
40
  int64_t integer;
 
41
 
 
42
  double real;
 
43
  /*
 
44
    Use two decimal buffers interchangeably to speed up += operation
 
45
    which has no native support in decimal library.
 
46
    Hybrid_type+= arg is implemented as dec_buf[1]= dec_buf[0] + arg.
 
47
    The third decimal is used as a handy temporary storage.
 
48
  */
 
49
  my_decimal dec_buf[3];
 
50
  int used_dec_buf_no;
 
51
 
 
52
  /*
 
53
    Traits moved to a separate class to
 
54
      a) be able to easily change object traits in runtime
 
55
      b) they work as a differentiator for the union above
 
56
  */
 
57
  const Hybrid_type_traits *traits;
 
58
 
 
59
  Hybrid_type() {}
 
60
  /* XXX: add traits->copy() when needed */
 
61
  Hybrid_type(const Hybrid_type &rhs) :traits(rhs.traits) {}
 
62
};
 
63
 
 
64
} /* namespace drizzled */
 
65
 
 
66
#endif /* DRIZZLED_HYBRID_TYPE_H */