rasdaman base DBMS
type.hh
Go to the documentation of this file.
1 // -*-C++-*- (for Emacs)
2 
3 /*
4 * This file is part of rasdaman community.
5 *
6 * Rasdaman community 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, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Rasdaman community is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
20 rasdaman GmbH.
21 *
22 * For more information please see <http://www.rasdaman.org>
23 * or contact Peter Baumann via <baumann@rasdaman.com>.
24 */
25 /*************************************************************
26  *
27  *
28  * PURPOSE:
29  * The Type class is the superclass for the classes
30  * CollectionType, BaseType, and MDDType.
31  *
32  *
33  * COMMENTS:
34  *
35  ************************************************************/
36 
37 #ifndef _TYPE_HH_
38 #define _TYPE_HH_
39 
40 class Type;
41 class OId;
42 
43 #include <iostream>
44 using std::ostream;
45 using std::cout;
46 using std::endl;
47 
48 #include "catalogmgr/ops.hh"
50 
51 //@ManMemo: Module: {\bf relcatalogif}.
52 
53 /*@Doc:
54 Type is the abstract base class for CollectionType, BaseType, and MDDType.
55 
56 Common to each type is the ability to get its name.
57 This functionality is defined as a pure virtual function here.
58 
59 {\bf Interdependencies}
60 
61 Each \Ref{Tile} has a pointer to its BaseType. Pointers to BaseType
62 are also used in subclasses of \Ref{MDDObject}.
63 */
64 
68 class Type : public DBNamedObject
69 {
70 public:
71  virtual void destroy();
72  /*@Doc:
73  does nothing. is neccessary to stop types from being deleted by ~DBRef<Type>
74  */
75 
77  virtual const char* getTypeName() const;
78  /*@Doc:
79  The name of the type is the class name without the Type suffix.
80  e.g. "Bool" for \Ref{BoolType}, or "ULong" for \Ref{ULongType},
81  or "Set" for \Ref{SetType}, or "Dimension" for \Ref{DimensionType}.
82  */
83 
85  virtual char* getTypeStructure() const;
86  /*@Doc:
87  Returns a copy of getTypeName() for non-structured base types. For
88  structured types a list of the elements in the form of #struct {
89  ulong elemName1, ushort elemName2 }# is returned. MDDTypes are
90  printed in the form #marray< RGBPixel, [10:20]# (less information,
91  if domain is not specified). Sets are printed in the form
92  #set<setName>#. The char* has to be freed by the caller!
93  */
94 
95  const TypeEnum getType() const;
96  /*@Doc:
97  returns the type as a TypeEnum.
98  */
99 
100  virtual int compatibleWith(const Type* aType) const;
101  /*@Doc:
102  checks, if two types are compatible (see also \Ref{MDDType}).
103  */
104 
105  Type();
106  /*@Doc:
107  default constructor, cannot be used.
108  */
109 
110  Type(const OId& id) throw (r_Error);
111  /*@Doc:
112  */
113 
114  Type(const Type& old);
115  /*@Doc:
116  */
117 
118  Type& operator=(const Type& old);
119  /*@Doc:
120  */
121 
122  virtual ~Type();
123  /*@Doc:
124  virtual destructor.
125  */
126 
127 protected:
128  TypeEnum myType;
129  /*@Doc:
130  enum for type. this can be ULONG, USHORT, CHAR,
131  BOOLTYPE, LONG, SHORT, OCTET, DOUBLE,
132  FLOAT, STRUCT, CLASSTYPE, SETTYPE, MDDTYPE
133  */
134 
135  Type(const char* name);
136  /*@Doc:
137  */
138 };
139 
140 #endif
virtual const char * getTypeName() const
returns the name of the type as a C string.
Definition: dbnamedobject.hh:40
virtual char * getTypeStructure() const
returns the structure of the type as a C string.
virtual int compatibleWith(const Type *aType) const
virtual ~Type()
Definition: oidif.hh:67
const TypeEnum getType() const
virtual void destroy()
Definition: type.hh:68
Type & operator=(const Type &old)
TypeEnum myType
Definition: type.hh:128