rasdaman complete source
inlinetile.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 _INLINETILE_HH_
24 #define _INLINETILE_HH_
25 // -*-C++-*- (for Emacs)
26 
27 /*************************************************************
28  *
29  *
30  * PURPOSE:
31  * The inlinetile class is used to store small tiles efficiently.
32  * Potentially many inlinetiles are grouped together in a blob and
33  * stored in the database. highly dependend on DBTCIndex.
34  *
35  *
36  * COMMENTS:
37  *
38  ************************************************************/
39 
40 class OId;
41 class r_Error;
42 
43 #include "raslib/mddtypes.hh"
44 #include "tileid.hh"
45 #include "blobtile.hh"
46 
47 //@ManMemo: Module: {\bf relblobif}.
48 
49 /*@Doc:
50 
51 InlineTile is the persistent class for storing the contents of MDD tiles
52 in the database. it can be stored as a blobtile or inlined:
53 in inlined mode multiple inlinetiles are stored as one blob in the database.
54 memory management and modification management is critical.
55 there are special functions in objectbroker to retrieve inlinetiles.
56 they can only be inlined by a dbtcindex.
57 
58 */
59 
63 class InlineTile : public BLOBTile
64 {
65 public:
66 
67  //@Man: constructors
69  InlineTile(const OId& id, char*& thecells);
70  /*@Doc:
71  construct a new inline tile with the oid of
72  the dbtilecontainerindex and the array which
73  holds the contents of the tile.
74  thecells will be automagically forwarded to the beginning of the next inline tile.
75  */
76 
77  InlineTile(r_Data_Format dataformat = r_Array);
78  /*@Doc:
79  constructs a new empty InlineTile and gets an id for it.
80  */
81 
82  InlineTile(const OId& BlobId) throw (r_Error);
83  /*@Doc:
84  constructs a InlineTile out of the database
85  */
86 
87  InlineTile(r_Bytes newSize, char c = 0, r_Data_Format dataformat = r_Array);
88  /*@Doc:
89  constructs a new InlineTile of size newSize filled with c.
90  */
91 
92  InlineTile(r_Bytes newSize, r_Bytes patSize, const char* pat, r_Data_Format dataformat = r_Array);
93  /*@Doc:
94  Constructs a new InlineTile of size newSize filled with the repeated
95  char array pat of size patSize. If after filling some chars are
96  left, they are filled with 0
97  */
98  /*@ManMemo: constructs a new InlineTile with the char array newCells
99  with newSize elements as contents. */
100 
101  InlineTile(r_Bytes newSize, const char* newCells, r_Data_Format dataformat = r_Array);
102  /*@Doc:
103  constructs a new InlineTile of size newSize filled with the contents of newCells.
104  */
105 
107  virtual void destroy();
108  /*@Doc:
109  may not destroy the object because it is inlined and therefore depending on its parent index.
110  */
111 
112  const OId& getIndexOId() const;
113  /*@Doc:
114  returns the oid of the index which contains the inlined tile. if the tile is outlined then this oid is invalid.
115  */
116 
117  void setIndexOId(const OId& oid);
118  /*@Doc:
119  make the inlinetile use this index as its parent and storage structure.
120  */
121 
122  r_Bytes getStorageSize() const;
123  /*@Doc:
124  returns the size this tile will consume in as an inlined array.
125  */
126 
127  virtual char* insertInMemBlock(char* test);
128  /*@Doc:
129  inserts the Blob into the char.
130  the returned pointer is after the end of this tiles data.
131  */
132 
133  virtual void setModified() throw(r_Error);
134  /*@Doc:
135  does not only set itself modified but also informs its parent of changes.
136  */
137 
138  virtual bool isCached() const;
139  /*@Doc:
140  returns true if it is inlined.
141  */
142 
143  virtual void inlineTile(const OId& ixOId);
144  /*@Doc:
145  do everything so that this tile is inlined and uses ixOId as its index parent.
146  it will not check if this tile is already inlined.
147  */
148 
149  virtual void outlineTile();
150  /*@Doc:
151  does everything necessary to act as a blobtile:
152  remove it from the index parent.
153  */
154 
155  virtual bool isInlined() const;
156  /*@Doc:
157  checks if it has a valid index parent.
158  */
159 
160  virtual ~InlineTile();
161  /*@Doc:
162  no functionality. if it is inlined the dbtcindex will take care of storing it.
163  if it is not inlined the blobtile functionality will take over.
164  */
165 
166  virtual void printStatus(unsigned int level = 0, std::ostream& stream = std::cout) const;
167 
168 protected:
169 
171  /*@Doc:
172  when this inlinetile is in inlined mode the myIndexOId points to the parent index.
173  if this oid is invalid the inlinetile is not in inline mode.
174  */
175 
176 };
177 
178 #endif
r_Bytes getStorageSize() const
virtual bool isInlined() const
const OId & getIndexOId() const
Definition: error.hh:88
virtual void printStatus(unsigned int level=0, std::ostream &stream=std::cout) const
OId myIndexOId
Definition: inlinetile.hh:170
virtual void setModified()
virtual ~InlineTile()
void setIndexOId(const OId &oid)
virtual bool isCached() const
Definition: oidif.hh:67
virtual char * insertInMemBlock(char *test)
r_Data_Format
Definition: mddtypes.hh:133
virtual void destroy()
virtual void inlineTile(const OId &ixOId)
Definition: inlinetile.hh:63
Definition: mddtypes.hh:135
unsigned int r_Bytes
Definition: mddtypes.hh:56
InlineTile(const OId &id, char *&thecells)
Definition: blobtile.hh:71
virtual void outlineTile()