rasdaman complete source
dbnamedobject.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 #ifndef _DBNAMEDOBJECT_HH_
24 #define _DBNAMEDOBJECT_HH_
25 
26 class DBObject;
27 class DBNamedObject;
28 
29 #include "dbobject.hh"
30 
31 //@ManMemo: Module: {\bf reladminif}.
32 /*@Doc:
33 Has functionality for setting the name of itsself from VARCHAR structures.
34 Takes care of too long names.
35 Implements set/getName functionality.
36 */
40 class DBNamedObject : public DBObject
41 {
42 public:
43  DBNamedObject();
44  /*@Doc:
45  sets Name to defaultName
46  */
47 
48  DBNamedObject(const OId& id) throw (r_Error);
49  /*@Doc:
50  only initializes itself
51  */
52 
53  DBNamedObject(const DBNamedObject& old);
54  /*@Doc:
55  sets myName to the name of the old object
56  */
57 
58  DBNamedObject(const char* name);
59  /*@Doc:
60  sets myName to name
61  */
62 
63  DBNamedObject(const OId& id, const char* name);
64  /*@Doc:
65  sets myName to name and calls DBObject(OId). this is needed by MDDSet.
66  */
67 
68  virtual ~DBNamedObject();
69  /*@Doc:
70  frees myName
71  */
72 
73  const char* getName() const;
74  /*@Doc:
75  returns a pointer to myName.
76  */
77 
78  static short MAXNAMELENGTH;
79  /*@Doc:
80  the maximum length of a name.
81  */
82 
84  /*@Doc:
85  takes care of the name
86  */
87 
88  virtual r_Bytes getMemorySize() const;
89  /*@Doc:
90  Should be revised not to include attribute sizes
91  */
92 
93  virtual void printStatus(unsigned int level = 0, std::ostream& stream = std::cout) const;
94  /*@Doc:
95  prints the status of DBObject + Name: myName
96  */
97 
98 protected:
99 
100  void setName(const char* newname);
101  /*@Doc:
102  renames the object
103  */
104 
105  void setName(const short length, const char* data);
106  /*@Doc:
107  sets the name from a VARCHAR structure
108  */
109 
110  char* myName;
111  /*@Doc:
112  the name of the object
113  */
114 
115  unsigned short myNameSize;
116  /*@Doc:
117  the size of the name
118  */
119 
120  static const char* defaultName;
121 };
122 
123 #endif
Definition: dbnamedobject.hh:40
char * myName
Definition: dbnamedobject.hh:110
unsigned short myNameSize
Definition: dbnamedobject.hh:115
void setName(const char *newname)
virtual void printStatus(unsigned int level=0, std::ostream &stream=std::cout) const
virtual ~DBNamedObject()
static short MAXNAMELENGTH
Definition: dbnamedobject.hh:78
Definition: oidif.hh:67
virtual r_Bytes getMemorySize() const
static const char * defaultName
Definition: dbnamedobject.hh:120
const char * getName() const
DBNamedObject & operator=(const DBNamedObject &old)
Definition: dbobject.hh:54