1<html><head><base target=k-main></head><body bgcolor=white>
2
3<font face=Times size=3>
4
5The storage class uses a view, with additional functionality to be able 
6to store and reload the data it contains (including nested subviews).
7<P>
8
9By default, data is loaded on demand, i.e. whenever data which has
10not yet been referenced is used for the first time.  Loading is limited
11to the lifetime of this storage object, since the storage object carries
12the file descriptor with it that is needed to access the data file.
13<P>
14
15To save changes, call the Commit member.  This is the only time
16that data is written to file - when using a read-only file simply avoid
17calling Commit.
18<P>
19
20The LoadFromStream and SaveToStream members can be used to
21serialize the contents of this storage row using only sequential I/O
22(no seeking, only read or write calls).
23<P>
24
25The data storage mechanism implementation provides fail-safe operation:
26if anything prevents Commit from completing its task, the last
27succesfully committed version of the saved data will be recovered on
28the next open. This also includes changes made to the table structure. 
29<P>
30
31The following code creates a view with 1 row and stores it on file:
32<P>
33
34
35<PRE>    <A HREF="c4_StringProp.html" >c4_StringProp</A> pName ("Name");
36    <A HREF="c4_IntProp.html" >c4_IntProp</A> pAge ("Age");</PRE>
37<P>
38
39
40<PRE>    <A HREF="c4_Storage.html" >c4_Storage</A> storage ("myfile.dat", true);
41    <A HREF="c4_View.html" >c4_View</A> myView = storage.GetAs("Musicians[Name:S,Age:I]");</PRE>
42<P>
43
44
45<PRE>    myView.Add(pName ["John Williams"] + pAge [43]);</PRE>
46<P>
47
48
49<PRE>    storage.Commit();
50</PRE>
51<P>
52
53
54
55<hr size=1>
56
57<dl>
58  
59  <if !private>
60	<a name="c4_Storage_AutoCommit___"><dt>
61	  <nobr>
62	  void 
63	  <b>AutoCommit</b> ();
64	  </nobr>
65	<dd>
66	  
67	  
68	  <font face=Helvetica size=-1>Set storage up to always call Commit in the destructor</font>
69	<p>
70  
71  
72  <if !private>
73	<a name="c4_Storage_Commit___"><dt>
74	  <nobr>
75	  bool 
76	  <b>Commit</b> ();
77	  </nobr>
78	<dd>
79	  
80	  
81	  <font face=Helvetica size=-1>Flush pending changes to file right now</font>
82	<p>
83  
84  
85  <if !private>
86	<a name="c4_Storage_Contents___const"><dt>
87	  <nobr>
88	  <A HREF="c4_RowRef.html" >c4_RowRef</A> 
89	  <b>Contents</b> () <i>const</i>;
90	  </nobr>
91	<dd>
92	  
93	  
94	  <font face=Helvetica size=-1>Give access to the stored data as a single row</font>
95	<p>
96  
97  
98  <if !private>
99	<a name="c4_Storage_Description_const__"><dt>
100	  <nobr>
101	  const char* 
102	  <b>Description</b> (const char* name_ =0);
103	  </nobr>
104	<dd>
105	  
106	  
107	  <font face=Helvetica size=-1>Return a description of the view structure (default is all)</font>
108	<p>
109  
110  
111  <if !private>
112	<a name="c4_Storage_GetAs_const__"><dt>
113	  <nobr>
114	  <A HREF="c4_View.html" >c4_View</A> 
115	  <b>GetAs</b> (const char* description_);
116	  </nobr>
117	<dd>
118	  
119	  
120	  <font face=Helvetica size=-1>Get a named view, redefining it to match the given structure</font>
121	<p>
122  
123  
124  <if !private>
125	<a name="c4_Storage_Initialize_constbool__"><dt>
126	  <nobr>
127	  void 
128	  <b>Initialize</b> (const char*, bool);
129	  </nobr>
130	<dd>
131	  
132	  
133	  <font face=Helvetica size=-1></font>
134	<p>
135  
136  
137  <if !private>
138	<a name="c4_Storage_LoadFrom_c4_Stream___"><dt>
139	  <nobr>
140	  void 
141	  <b>LoadFrom</b> (<A HREF="c4_Stream.html" >c4_Stream</A>&#38; stream_);
142	  </nobr>
143	<dd>
144	  
145	  
146	  <font face=Helvetica size=-1>Load contents from the specified input stream</font>
147	<p>
148  
149  
150  <if !private>
151	<a name="c4_Storage_Rollback___"><dt>
152	  <nobr>
153	  bool 
154	  <b>Rollback</b> ();
155	  </nobr>
156	<dd>
157	  
158	   Calling Rollback will cancel all uncommitted changes.
159<br>
160	  
161	<p>
162  
163  
164  <if !private>
165	<a name="c4_Storage_RootTable___const"><dt>
166	  <nobr>
167	  c4_HandlerSeq&#38; 
168	  <b>RootTable</b> () <i>const</i>;
169	  </nobr>
170	<dd>
171	  
172	  
173	  <font face=Helvetica size=-1>Return the root table entry</font>
174	<p>
175  
176  
177  <if !private>
178	<a name="c4_Storage_SaveTo_c4_Stream___"><dt>
179	  <nobr>
180	  void 
181	  <b>SaveTo</b> (<A HREF="c4_Stream.html" >c4_Stream</A>&#38; stream_);
182	  </nobr>
183	<dd>
184	  
185	  
186	  <font face=Helvetica size=-1>Save contents to the specified output stream</font>
187	<p>
188  
189  
190  <if !private>
191	<a name="c4_Storage_SetStructure_const__"><dt>
192	  <nobr>
193	  void 
194	  <b>SetStructure</b> (const char*);
195	  </nobr>
196	<dd>
197	  
198	  
199	  <font face=Helvetica size=-1></font>
200	<p>
201  
202  
203  <if !private>
204	<a name="c4_Storage_Store_constconst__"><dt>
205	  <nobr>
206	  <A HREF="c4_View.html" >c4_View</A> 
207	  <b>Store</b> (const char* name_, const <A HREF="c4_View.html" >c4_View</A>&#38; view_);
208	  </nobr>
209	<dd>
210	  
211	  
212	  <font face=Helvetica size=-1>Attach a view using specified name in this storage object</font>
213	<p>
214  
215  
216  <if !private>
217	<a name="c4_Storage_Strategy___const"><dt>
218	  <nobr>
219	  <A HREF="c4_Strategy.html" >c4_Strategy</A>&#38; 
220	  <b>Strategy</b> () <i>const</i>;
221	  </nobr>
222	<dd>
223	  
224	  
225	  <font face=Helvetica size=-1>Return the strategy object associated with this storage</font>
226	<p>
227  
228  
229  <if !private>
230	<a name="c4_Storage_View_const__"><dt>
231	  <nobr>
232	  <A HREF="c4_ViewRef.html" >c4_ViewRef</A> 
233	  <b>View</b> (const char* name_);
234	  </nobr>
235	<dd>
236	  
237	  
238	  <font face=Helvetica size=-1>Get or set a named view in this storage object</font>
239	<p>
240  
241  
242  <if !private>
243	<a name="c4_Storage__persist"><dt>
244	  <nobr>
245	  c4_Persist* 
246	  <b>_persist</b>;
247	  </nobr>
248	<dd>
249	  
250	  
251	  <font face=Helvetica size=-1></font>
252	<p>
253  
254  
255  <if !private>
256	<a name="c4_Storage_c4_Storage__"><dt>
257	  <nobr>
258	  
259	  <b>c4_Storage</b> ();
260	  </nobr>
261	<dd>
262	  
263	  
264	  <font face=Helvetica size=-1>Construct streaming-only storage object</font>
265	<p>
266  
267  
268  <if !private>
269	<a name="c4_Storage_c4_Storage_c4_Strategy_bool_"><dt>
270	  <nobr>
271	  
272	  <b>c4_Storage</b> (<A HREF="c4_Strategy.html" >c4_Strategy</A>&#38; strategy_, bool owned_ =false);
273	  </nobr>
274	<dd>
275	  
276	  
277	  <font face=Helvetica size=-1>Construct a storage using the specified strategy handler</font>
278	<p>
279  
280  
281  <if !private>
282	<a name="c4_Storage_c4_Storage_const_"><dt>
283	  <nobr>
284	  
285	  <b>c4_Storage</b> (const <A HREF="c4_Storage.html" >c4_Storage</A>&#38;);
286	  </nobr>
287	<dd>
288	  
289	  
290	  <font face=Helvetica size=-1>Copy constructor</font>
291	<p>
292  
293  
294  <if !private>
295	<a name="c4_Storage_c4_Storage_constbool_"><dt>
296	  <nobr>
297	  
298	  <b>c4_Storage</b> (const char* filename_, bool canModify_);
299	  </nobr>
300	<dd>
301	  
302	  
303	  <font face=Helvetica size=-1>Construct a storage object, keeping the current structure</font>
304	<p>
305  
306  
307  <if !private>
308	<a name="c4_Storage_c4_Storage_constconst_"><dt>
309	  <nobr>
310	  
311	  <b>c4_Storage</b> (const char* filename_, const char* description_);
312	  </nobr>
313	<dd>
314	  
315	  
316	  <font face=Helvetica size=-1>Construct a storage object for given file and format</font>
317	<p>
318  
319  
320  <if !private>
321	<a name="c4_Storage_operator___const__"><dt>
322	  <nobr>
323	  <A HREF="c4_Storage.html" >c4_Storage</A>&#38; 
324	  <b>operator= </b> (const <A HREF="c4_Storage.html" >c4_Storage</A>&#38;);
325	  </nobr>
326	<dd>
327	  
328	  
329	  <font face=Helvetica size=-1>Assignment of storage implements reference semantics</font>
330	<p>
331  
332  
333  <if !private>
334	<a name="c4_Storage__c4_Storage__"><dt>
335	  <nobr>
336	  
337	  <b>~c4_Storage</b> ();
338	  </nobr>
339	<dd>
340	  
341	  
342	  <font face=Helvetica size=-1>Destructor, usually closes file, but does not commit by default</font>
343	<p>
344  
345  
346</dl>
347
348<hr size=1 width=50 align=left>
349class 
350<b>c4_Storage</b>
351</font>
352
353</body></html>
354