File: c4_Storage_info.html

package info (click to toggle)
libmetakit2.4.9.3 2.4.9.3-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,196 kB
  • ctags: 3,754
  • sloc: cpp: 24,454; xml: 19,818; sh: 9,358; tcl: 1,365; python: 1,176; makefile: 287; ansic: 16; asm: 10
file content (353 lines) | stat: -rw-r--r-- 7,371 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
<html><head><base target=k-main></head><body bgcolor=white>

<font face=Times size=3>

The storage class uses a view, with additional functionality to be able 
to store and reload the data it contains (including nested subviews).
<P>

By default, data is loaded on demand, i.e. whenever data which has
not yet been referenced is used for the first time.  Loading is limited
to the lifetime of this storage object, since the storage object carries
the file descriptor with it that is needed to access the data file.
<P>

To save changes, call the Commit member.  This is the only time
that data is written to file - when using a read-only file simply avoid
calling Commit.
<P>

The LoadFromStream and SaveToStream members can be used to
serialize the contents of this storage row using only sequential I/O
(no seeking, only read or write calls).
<P>

The data storage mechanism implementation provides fail-safe operation:
if anything prevents Commit from completing its task, the last
succesfully committed version of the saved data will be recovered on
the next open. This also includes changes made to the table structure. 
<P>

The following code creates a view with 1 row and stores it on file:
<P>


<PRE>    <A HREF="c4_StringProp.html" >c4_StringProp</A> pName ("Name");
    <A HREF="c4_IntProp.html" >c4_IntProp</A> pAge ("Age");</PRE>
<P>


<PRE>    <A HREF="c4_Storage.html" >c4_Storage</A> storage ("myfile.dat", true);
    <A HREF="c4_View.html" >c4_View</A> myView = storage.GetAs("Musicians[Name:S,Age:I]");</PRE>
<P>


<PRE>    myView.Add(pName ["John Williams"] + pAge [43]);</PRE>
<P>


<PRE>    storage.Commit();
</PRE>
<P>



<hr size=1>

<dl>
  
  <if !private>
	<a name="c4_Storage_AutoCommit___"><dt>
	  <nobr>
	  void 
	  <b>AutoCommit</b> ();
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Set storage up to always call Commit in the destructor</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_Commit___"><dt>
	  <nobr>
	  bool 
	  <b>Commit</b> ();
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Flush pending changes to file right now</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_Contents___const"><dt>
	  <nobr>
	  <A HREF="c4_RowRef.html" >c4_RowRef</A> 
	  <b>Contents</b> () <i>const</i>;
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Give access to the stored data as a single row</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_Description_const__"><dt>
	  <nobr>
	  const char* 
	  <b>Description</b> (const char* name_ =0);
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Return a description of the view structure (default is all)</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_GetAs_const__"><dt>
	  <nobr>
	  <A HREF="c4_View.html" >c4_View</A> 
	  <b>GetAs</b> (const char* description_);
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Get a named view, redefining it to match the given structure</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_Initialize_constbool__"><dt>
	  <nobr>
	  void 
	  <b>Initialize</b> (const char*, bool);
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1></font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_LoadFrom_c4_Stream___"><dt>
	  <nobr>
	  void 
	  <b>LoadFrom</b> (<A HREF="c4_Stream.html" >c4_Stream</A>&#38; stream_);
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Load contents from the specified input stream</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_Rollback___"><dt>
	  <nobr>
	  bool 
	  <b>Rollback</b> ();
	  </nobr>
	<dd>
	  
	   Calling Rollback will cancel all uncommitted changes.
<br>
	  
	<p>
  
  
  <if !private>
	<a name="c4_Storage_RootTable___const"><dt>
	  <nobr>
	  c4_HandlerSeq&#38; 
	  <b>RootTable</b> () <i>const</i>;
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Return the root table entry</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_SaveTo_c4_Stream___"><dt>
	  <nobr>
	  void 
	  <b>SaveTo</b> (<A HREF="c4_Stream.html" >c4_Stream</A>&#38; stream_);
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Save contents to the specified output stream</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_SetStructure_const__"><dt>
	  <nobr>
	  void 
	  <b>SetStructure</b> (const char*);
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1></font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_Store_constconst__"><dt>
	  <nobr>
	  <A HREF="c4_View.html" >c4_View</A> 
	  <b>Store</b> (const char* name_, const <A HREF="c4_View.html" >c4_View</A>&#38; view_);
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Attach a view using specified name in this storage object</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_Strategy___const"><dt>
	  <nobr>
	  <A HREF="c4_Strategy.html" >c4_Strategy</A>&#38; 
	  <b>Strategy</b> () <i>const</i>;
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Return the strategy object associated with this storage</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_View_const__"><dt>
	  <nobr>
	  <A HREF="c4_ViewRef.html" >c4_ViewRef</A> 
	  <b>View</b> (const char* name_);
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Get or set a named view in this storage object</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage__persist"><dt>
	  <nobr>
	  c4_Persist* 
	  <b>_persist</b>;
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1></font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_c4_Storage__"><dt>
	  <nobr>
	  
	  <b>c4_Storage</b> ();
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Construct streaming-only storage object</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_c4_Storage_c4_Strategy_bool_"><dt>
	  <nobr>
	  
	  <b>c4_Storage</b> (<A HREF="c4_Strategy.html" >c4_Strategy</A>&#38; strategy_, bool owned_ =false);
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Construct a storage using the specified strategy handler</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_c4_Storage_const_"><dt>
	  <nobr>
	  
	  <b>c4_Storage</b> (const <A HREF="c4_Storage.html" >c4_Storage</A>&#38;);
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Copy constructor</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_c4_Storage_constbool_"><dt>
	  <nobr>
	  
	  <b>c4_Storage</b> (const char* filename_, bool canModify_);
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Construct a storage object, keeping the current structure</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_c4_Storage_constconst_"><dt>
	  <nobr>
	  
	  <b>c4_Storage</b> (const char* filename_, const char* description_);
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Construct a storage object for given file and format</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage_operator___const__"><dt>
	  <nobr>
	  <A HREF="c4_Storage.html" >c4_Storage</A>&#38; 
	  <b>operator= </b> (const <A HREF="c4_Storage.html" >c4_Storage</A>&#38;);
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Assignment of storage implements reference semantics</font>
	<p>
  
  
  <if !private>
	<a name="c4_Storage__c4_Storage__"><dt>
	  <nobr>
	  
	  <b>~c4_Storage</b> ();
	  </nobr>
	<dd>
	  
	  
	  <font face=Helvetica size=-1>Destructor, usually closes file, but does not commit by default</font>
	<p>
  
  
</dl>

<hr size=1 width=50 align=left>
class 
<b>c4_Storage</b>
</font>

</body></html>