DataTypes.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib 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 Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/postgis/DataTypes.h
22 
23  \brief Utility data types for PostgreSQL.
24 */
25 
26 #ifndef __TERRALIB_POSTGIS_INTERNAL_DATATYPES_H
27 #define __TERRALIB_POSTGIS_INTERNAL_DATATYPES_H
28 
29 // STL
30 #include <cstring>
31 
32 namespace te
33 {
34  namespace pgis
35  {
36  /*!
37  \struct VersionInfo
38 
39  \brief A data structure for holding version information.
40  */
41  struct VersionInfo
42  {
43  int m_major;
44  int m_minor;
45  int m_release;
46  };
47 
48  /*!
49  \struct Numeric
50 
51  \brief Auxiliary structure used to decode Numeric data types.
52  */
53  struct Numeric
54  {
55  int m_ndigits; //!< number of digits in digits[] - can be 0!
56  int m_weight; //!< weight of first digit.
57  int m_rscale; //!< result scale.
58  int m_dscale; //!< display scale
59  int m_sign; //!< NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN.
60  unsigned char* m_buf; //!< start of alloc'd space for digits[].
61  unsigned char* m_digits; //!< decimal digits
62  };
63 
64  /*!
65  \struct Array
66 
67  \brief Auxiliary structure used to decode Array data types.
68 
69  After the dimensions information we have the following structure:
70  <ul>
71  <li>lower bnds: lower boundary of each dimension (C array of int)</li>
72  <li>null bitmap: bitmap showing locations of nulls (OPTIONAL)</li>
73  <li>actual data: whatever is the stored data.</li>
74  <ul>
75 
76  \note Individual items in the array are aligned as specified by the array element type. They are
77  stored in row-major order (last subscript varies most rapidly).
78  */
79  struct Array
80  {
81  int m_ndim; //!< number of dimensions of the array.
82  int m_dataoffset; //!< offset to stored data, or 0 if no nulls bitmap.
83  unsigned int m_elemtype; //!< element type OID.
84  int m_dimensions; //!< length of each array axis (C array of int)
85  };
86 
87  } // end namespace pgis
88 } // end namespace te
89 
91 
92 #endif // __TERRALIB_POSTGIS_INTERNAL_DATATYPES_H
93 
int m_weight
weight of first digit.
Definition: DataTypes.h:56
int m_rscale
result scale.
Definition: DataTypes.h:57
int m_sign
NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN.
Definition: DataTypes.h:59
int m_dataoffset
offset to stored data, or 0 if no nulls bitmap.
Definition: DataTypes.h:82
int m_ndim
number of dimensions of the array.
Definition: DataTypes.h:81
int m_dimensions
length of each array axis (C array of int)
Definition: DataTypes.h:84
int m_ndigits
number of digits in digits[] - can be 0!
Definition: DataTypes.h:55
unsigned char * m_digits
decimal digits
Definition: DataTypes.h:61
A data structure for holding version information.
Definition: DataTypes.h:41
Auxiliary structure used to decode Numeric data types.
Definition: DataTypes.h:53
unsigned char * m_buf
start of alloc'd space for digits[].
Definition: DataTypes.h:60
Auxiliary structure used to decode Array data types.
Definition: DataTypes.h:79
URI C++ Library.
te::pgis::VersionInfo & operator<<(te::pgis::VersionInfo &vinfo, const char *v)
int m_dscale
display scale
Definition: DataTypes.h:58
unsigned int m_elemtype
element type OID.
Definition: DataTypes.h:83