rasdaman complete source
relcatalogif/complextype.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 */
23 // -*-C++-*- (for Emacs)
24 
25 /*************************************************************
26  *
27  *
28  * PURPOSE:
29  *
30  *
31  *
32  *
33  * COMMENTS:
34  *
35  ************************************************************/
36 
37 #ifndef _COMPLEXTYPE_HH_
38 #define _COMPLEXTYPE_HH_
39 
40 #include <iostream>
41 #ifdef __APPLE__
42 #include <float.h>
43 #else
44 #include <values.h>
45 #endif
46 #include "realtype.hh"
47 #include "catalogmgr/ops.hh"
48 
49 class OId;
50 
51 
52 
57 {
58 
59 public:
60  GenericComplexType(const char *name, unsigned int size): AtomicType(name, size) {}
61  GenericComplexType(const OId& id) throw (r_Error): AtomicType(id) {}
62  virtual ~GenericComplexType() {}
63  virtual unsigned int getReOffset() const = 0;
64  virtual unsigned int getImOffset() const = 0;
65 
66 protected:
67  virtual void readFromDb() throw (r_Error) = 0;
68 };
69 
70 
75 {
76 
77 public:
78  ComplexType1();
79  ComplexType1(const OId& id) throw (r_Error);
80  ComplexType1(const ComplexType1& old);
81  ComplexType1& operator=(const ComplexType1& old);
82  virtual ~ComplexType1();
83  virtual void printCell(ostream& stream, const char* cell) const;
84  unsigned int getReOffset() const;
85  unsigned int getImOffset() const;
86  virtual const char* getTypeName() const;
87  static const char* Name;
88 
89 
90 protected:
91  virtual void readFromDb() throw (r_Error);
92 
93 private:
94  unsigned int reOffset, imOffset;
95 
96 // static const char* complexTypeName;
97 
98  r_ULong* convertToCULong(const char*, r_ULong*) const;
99  char* makeFromCULong(char*, const r_ULong*) const;
100  r_Long* convertToCLong(const char*, r_Long*) const;
101  char* makeFromCLong(char*, const r_Long*) const;
102  double* convertToCDouble(const char* cell, double* value) const;
103  char* makeFromCDouble(char* cell, const double* value) const;
104 
105 };
106 
110 class ComplexType2 : public GenericComplexType
111 {
112 
113 public:
114  ComplexType2();
115  ComplexType2(const OId& id) throw (r_Error);
116  ComplexType2(const ComplexType2& old);
117  ComplexType2& operator=(const ComplexType2& old);
118  virtual ~ComplexType2();
119  virtual void printCell(ostream& stream, const char* cell) const;
120  unsigned int getReOffset() const;
121  unsigned int getImOffset() const;
122  virtual const char* getTypeName() const;
123  static const char* Name;
124 
125 protected:
126  virtual void readFromDb() throw (r_Error);
127 
128 private:
129  unsigned int reOffset, imOffset;
130 
131 // static const char* complexTypeName;
132 
133  r_ULong* convertToCULong(const char*, r_ULong*) const;
134  char* makeFromCULong(char*, const r_ULong*) const;
135  r_Long* convertToCLong(const char*, r_Long*) const;
136  char* makeFromCLong(char*, const r_Long*) const;
137  double* convertToCDouble(const char* cell, double* value) const;
138  char* makeFromCDouble(char* cell, const double* value) const;
139 
140 };
141 
142 
143 #include "complextype.icc"
144 
145 
146 
147 #endif
virtual unsigned int getReOffset() const =0
virtual const char * getTypeName() const
returns the name of the type as a C string.
AtomicType & operator=(const AtomicType &old)
unsigned int r_ULong
Definition: odmgtypes.hh:114
static const char * Name
Definition: relcatalogif/complextype.hh:87
GenericComplexType(const char *name, unsigned int size)
Definition: relcatalogif/complextype.hh:60
virtual ~GenericComplexType()
Definition: relcatalogif/complextype.hh:62
Definition: error.hh:88
virtual double * convertToCDouble(const char *cell, double *value) const =0
AtomicType(unsigned int newSize)
virtual char * makeFromCDouble(char *cell, const double *value) const =0
virtual r_Long * convertToCLong(const char *cell, r_Long *value) const =0
GenericComplexType(const OId &id)
Definition: relcatalogif/complextype.hh:61
Definition: oidif.hh:67
virtual char * makeFromCLong(char *cell, const r_Long *value) const =0
unsigned int size
Definition: atomictype.hh:90
static const char * Name
Definition: relcatalogif/complextype.hh:123
Definition: atomictype.hh:59
virtual void readFromDb()=0
Definition: relcatalogif/complextype.hh:110
virtual unsigned int getImOffset() const =0
int r_Long
Definition: odmgtypes.hh:100
Definition: relcatalogif/complextype.hh:56
Definition: relcatalogif/complextype.hh:74
virtual r_ULong * convertToCULong(const char *cell, r_ULong *value) const =0
virtual void printCell(ostream &stream, const char *cell) const =0
virtual char * makeFromCULong(char *cell, const r_ULong *value) const =0