rasdaman complete source
relcatalogif/basetype.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  * The BaseType class is the superclass for all classes
30  * describing the type of a cell
31  *
32  *
33  * COMMENTS:
34  *
35  ************************************************************/
36 
37 #ifndef _BASETYPE_HH_
38 #define _BASETYPE_HH_
39 
40 #include <iostream>
41 #include "catalogmgr/ops.hh"
42 #include "type.hh"
43 #include "raslib/odmgtypes.hh"
44 
45 //@ManMemo: Module: {\bf relcatalogif}.
46 
47 /*@Doc:
48 BaseType is the abstract base class for all types usable as basetypes
49 for an MDD. At the moment, only atomic types are supported. Later
50 structured types will also be supported.
51 
52 Common to each basetype is the ability to get size information,to
53 print a cell and to provide means to carry out operations on cells of
54 this type. This functionality is defined as pure virtual functions
55 here.
56 
57 {\bf Interdependencies}
58 
59 Each \Ref{Tile} has a pointer to its BaseType. Pointers to BaseType
60 are also used in subclasses of \Ref{MDDObject}.
61 */
62 
66 class BaseType : public Type
67 {
68 public:
69  virtual unsigned int getSize() const = 0;
70  /*@Doc:
71  returns the size of one cell of the type in chars.
72  */
73 
74  virtual r_ULong* convertToCULong(const char* cell, r_ULong* value) const = 0;
75 
76  /*@Doc:
77  returns value of the cell as a C #unsigned long#.
78  */
79 
80  virtual char* makeFromCULong(char* cell, const r_ULong* value) const = 0;
81  /*@Doc:
82  returns C #unsigned long# in cell #cell#.
83  */
84 
85  virtual r_Long* convertToCLong(const char* cell, r_Long* value) const = 0;
86  /*@Doc:
87  returns value of the cell as a C #long#.
88  */
89 
90  virtual char* makeFromCLong(char* cell, const r_Long* value) const = 0;
91  /*@Doc:
92  returns C #long# in cell #cell#.
93  */
94 
95  virtual double* convertToCDouble(const char* cell, double* value) const = 0;
96  /*@Doc:
97  returns value of the cell as a C #double#.
98  */
99 
100  virtual char* makeFromCDouble(char* cell, const double* value) const = 0;
101  /*@Doc:
102  returns C #double# in cell #cell#.
103  */
104 
105  virtual void printCell(ostream& stream, const char* cell) const = 0;
106  /*@Doc:
107  print contents of a cell to stream.
108  */
109 
110  //@Man: methods for getting functions (used by \Ref{Tile})
112  virtual CondenseOp* getCondenseOp( Ops::OpType op ) const;
114  /*@Doc:
115  \Ref{CondenseOp} carrying out the operation op on a cell of this
116  type. The type of the result depends on the operation carried out,
117  but is usually of type self. See \Ref{Ops} for details.
118  */
119 
121  virtual UnaryOp* getUnaryOp( Ops::OpType op, const BaseType* optype ) const;
122  /*@Doc:
123  Returns a pointer to a function object of a subclass of class
124  \Ref{UnaryOp} carrying out the operation {\tt op} on a cell of
125  type {\tt optype}. The result type has the type self. See
126  \Ref{Ops} for details.
127  */
128 
130  virtual BinaryOp* getBinaryOp( Ops::OpType op, const BaseType* op1type, const BaseType* op2type) const;
131  /*@Doc:
132  Returns a pointer to a function object of a subclass of class
133  \Ref{BinaryOp} carrying out the operation {\tt op} on two cells of
134  type {\tt op1type} respective {\tt op2type}. The result type has
135  the type self. See \Ref{Ops} for details.
136  */
138 
139  BaseType();
140  /*@Doc:
141  default constructor, cannot be used.
142  */
143 
144  BaseType(const OId& id) throw (r_Error);
145 
146  BaseType(const BaseType& old);
147 
148  BaseType& operator=(const BaseType& old);
149 
150  virtual ~BaseType();
151  /*@Doc:
152  virtual destructor.
153  */
154 
155  virtual int compatibleWith(const Type* aType) const;
156  /*@Doc:
157  returns true if my TypeEnum == aType->getType()
158  */
159 
160 protected:
161  BaseType(const char* name);
162 };
163 
164 #endif
virtual int compatibleWith(const Type *aType) const
virtual UnaryOp * getUnaryOp(Ops::OpType op, const BaseType *optype) const
get function object for unary operation.
virtual double * convertToCDouble(const char *cell, double *value) const =0
virtual char * makeFromCDouble(char *cell, const double *value) const =0
virtual r_Long * convertToCLong(const char *cell, r_Long *value) const =0
Definition: oidif.hh:67
virtual char * makeFromCLong(char *cell, const r_Long *value) const =0
virtual unsigned int getSize() const =0
virtual CondenseOp * getCondenseOp(Ops::OpType op) const
get function object for condense operation.
BaseType & operator=(const BaseType &old)
virtual BinaryOp * getBinaryOp(Ops::OpType op, const BaseType *op1type, const BaseType *op2type) const
get function object for binary operation.
Definition: relcatalogif/basetype.hh:66
virtual ~BaseType()
Definition: relcatalogif/type.hh:68
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