rasdaman complete source
keyobject.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 
24 #ifndef _KEYOBJECT_HH_
25 #define _KEYOBJECT_HH_
26 
27 class Tile;
28 class KeyObject;
29 
30 #include "reladminif/dbobject.hh"
31 #include "raslib/minterval.hh"
32 #include "reladminif/dbref.hh"
33 
43 class KeyObject
44 {
45 public:
46  KeyObject();
47 
48  KeyObject(const KeyObject& old);
49  /*@Doc:
50  Copy constructor. Copies the tile pointer.
51  */
52 
53  KeyObject(const Tile* p);
54  /*@Doc:
55  Construccts a new KeyObject. The type (persistent/transinet)
56  is deremined based on the Tile. The domain also.
57  This constructor is sometimes misused by the compiler in statements like KeyObject p = 0.
58  This will cause a crash because the domain is read from the tile which is NULL : )
59  */
60 
61  KeyObject(const DBObjectId& obj, const r_Minterval& dom);
62  /*@Doc:
63  Constructs a new KeyObject for a persistent object.
64  */
65 
66  const DBObjectId& getObject() const;
67  /*@Doc:
68  Returns a smartpointer to the persistent object attribute.
69  If this is a transient object carrier the returned smart-
70  pointer is invalid.
71  */
72 
73  Tile* getTransObject() const;
74  /*@Doc:
75  Returns the transient object. If this KeyObject carries
76  a persistent object a NULL is returned.
77  */
78 
79  r_Minterval getDomain() const;
80  /*@Doc:
81  Returns the domain which is associated with the objects that
82  is carried.
83  */
84 
85  ~KeyObject();
86  /*@Doc:
87  Does not delete the TransTile!!
88  */
89 
90  bool isInitialised() const;
91  /*@Doc:
92  Returns true if trans object is initialised or the dbref is initialised.
93  */
94 
95  bool isPersCarrier() const;
96  /*@Doc:
97  Returns true if the transobject attribute is NULL.
98  */
99 
100  void setDomain(const r_Minterval& dom);
101  /*@Doc:
102  Alters the domain the KeyObject carries.
103  */
104 
105  void setTransObject(const Tile* tile);
106  /*@Doc:
107  makes the KeyObject a transient carrier and copies the pointer.
108  */
109 
110  void setObject(const DBObjectId& obj);
111  /*@Doc:
112  makes the KeyObject a persistent carrier and copies object.
113  */
114 
115 protected:
117  /*@Doc:
118  A smartpointer to the carried object if it is persistent.
119  */
120 
121  r_Minterval domain;
122  /*@Doc:
123  The domain which the carried object belongs to.
124  */
125 
127  /*@Doc:
128  Attribute for storing a transtile. is NULL if a persistent
129  object is carried.
130  */
131 };
132 
133 /*@Doc:
134  Prints the status of KeyObject object.
135 */
136 extern std::ostream& operator<<(std::ostream& in, const KeyObject& d);
137 
138 #endif
void setTransObject(const Tile *tile)
const DBObjectId & getObject() const
void setDomain(const r_Minterval &dom)
bool isPersCarrier() const
Tile * getTransObject() const
r_Minterval getDomain() const
Definition: keyobject.hh:43
void setObject(const DBObjectId &obj)
Tile * transobject
Definition: keyobject.hh:126
bool isInitialised() const
DBObjectId persobject
Definition: keyobject.hh:116
r_Minterval domain
Definition: keyobject.hh:121
Definition: tile.hh:80
std::ostream & operator<<(std::ostream &in, const KeyObject &d)