• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/db-4.8.30/docs/api_reference/STL/
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4  <head>
5    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6    <title>Chapter 26.  DbstlElemTraits</title>
7    <link rel="stylesheet" href="apiReference.css" type="text/css" />
8    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9    <link rel="start" href="index.html" title="Berkeley DB C++ Standard Template Library API Reference" />
10    <link rel="up" href="index.html" title="Berkeley DB C++ Standard Template Library API Reference" />
11    <link rel="prev" href="stlDbstlDbtoperator_assign.html" title="operator=" />
12    <link rel="next" href="stlDbstlElemTraitseq.html" title="eq" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">Chapter 26. 
19 DbstlElemTraits  </th>
20        </tr>
21        <tr>
22          <td width="20%" align="left"><a accesskey="p" href="stlDbstlDbtoperator_assign.html">Prev</a> </td>
23          <th width="60%" align="center"> </th>
24          <td width="20%" align="right"> <a accesskey="n" href="stlDbstlElemTraitseq.html">Next</a></td>
25        </tr>
26      </table>
27      <hr />
28    </div>
29    <div class="chapter" lang="en" xml:lang="en">
30      <div class="titlepage">
31        <div>
32          <div>
33            <h2 class="title"><a id="DbstlElemTraits"></a>Chapter 26. 
34 DbstlElemTraits  </h2>
35          </div>
36        </div>
37      </div>
38      <p>This class is used to register callbacks to manipulate an object of a complex type. </p>
39      <p>These callbacks are used by dbstl at runtime to manipulate the object.</p>
40      <p>A complex type is a type whose members are not located in a contiguous chunk of memory. For example, the following class A is a complex type because for any instance a of class A, a.b_ points to another object of type B, and dbstl treats the object that a.b_ points to as part of the data of the instance a. Hence, if the user needs to store a.b_ into a dbstl container, the user needs to register an appropriate callback to de-reference and store the object referenced by a.b. Similarly, the user also needs to register callbacks to marshall an array as well as to count the number of elements in such an array.</p>
41      <p>class A { int m; B *p_; }; class B { int n; };</p>
42      <p>The user also needs to register callbacks for i). returning an object¡¯s size in bytes; ii). Marshalling and unmarshalling an object; iii). Copying a complex object and and assigning an object to another object of the same type; iv). Element comparison. v). Compare two sequences of any type of objects; Measuring the length of an object sequence and copy an object sequence.</p>
43      <p>Several elements located in a contiguous chunk of memory form a sequence. An element of a sequence may be a simple object located at a contigous memory chunk, or a complex object, i.e. some of its members may contain references (pointers) to another region of memory. It is not necessary to store a special object to denote the end of the sequence. The callback to traverse the constituent elements of the sequence needs to able to determine the end of the sequence.</p>
44      <p>Marshalling means packing the object's data members into a contiguous chunk of memory; unmarshalling is the opposite of marshalling. In other words, when you unmarshall an object, its data members are populated with values from a previously marshalled version of the object.</p>
45      <p>The callbacks need not be set to every type explicitly. . dbstl will check if a needed callback function of this type is provided. If one is available, dbstl will use the registered callback. If the appropriate callback is not provided, dbstl will use reasonable defaults to do the job.</p>
46      <p>For returning the size of an object, the default behavior is to use the sizeof() operator; For marshalling and unmarshalling, dbstl uses memcpy, so the default behavior is sufficient for simple types whose data reside in a contiguous chunk of memory; Dbstl uses uses &gt;, == and &lt; for comparison operations; For char* and wchar_t * strings, dbstl already provides the appropriate callbacks, so you do not need to register them. In general, if the default behavior is adequate, you don't need to register the corresponding callback.</p>
47      <p>If you have registered proper callbacks, the DbstlElemTraits&lt;T&gt; can also be used as the char_traits&lt;T&gt; class for std::basic_string&lt;T, char_traits&lt;T&gt; &gt;, and you can enable your class T to form a basic_string&lt;T, DbstlElemTraits&lt;T&gt;&gt;, and use basic_string's functionality and the algorithms to manipulate it. </p>
48      <h4><a id="id1571000"></a> Public Members </h4>
49      <div class="informaltable">
50        <table border="1" width="80%">
51          <colgroup>
52            <col />
53            <col />
54          </colgroup>
55          <thead>
56            <tr>
57              <th>Member</th>
58              <th>Description</th>
59            </tr>
60          </thead>
61          <tbody>
62            <tr>
63              <td>
64<a class="xref" href="DbstlElemTraits.html#stlDbstlElemTraitsassign" title="assign">
65assign
66</a>
67</td>
68              <td>
69   <p>Assignone object to another. </p>        </td>
70            </tr>
71            <tr>
72              <td>
73<a class="xref" href="stlDbstlElemTraitseq.html" title="eq">
74eq
75</a>
76</td>
77              <td>
78   <p>Check for equality of two objects. </p>        </td>
79            </tr>
80            <tr>
81              <td>
82<a class="xref" href="stlDbstlElemTraitslt.html" title="lt">
83lt
84</a>
85</td>
86              <td>
87   <p>Less than comparison. </p>        </td>
88            </tr>
89            <tr>
90              <td>
91<a class="xref" href="stlDbstlElemTraitscompare.html" title="compare">
92compare
93</a>
94</td>
95              <td>
96   <p>Sequence comparison. </p>        </td>
97            </tr>
98            <tr>
99              <td>
100<a class="xref" href="stlDbstlElemTraitslength.html" title="length">
101length
102</a>
103</td>
104              <td>
105   <p>Returns the number of elements in sequence seq1. </p>        </td>
106            </tr>
107            <tr>
108              <td>
109<a class="xref" href="stlDbstlElemTraitscopy.html" title="copy">
110copy
111</a>
112</td>
113              <td>
114   <p>Copy first cnt number of elements from seq2 to seq1. </p>        </td>
115            </tr>
116            <tr>
117              <td>
118<a class="xref" href="stlDbstlElemTraitsfind.html" title="find">
119find
120</a>
121</td>
122              <td>
123   <p>Find within the first cnt elements of sequence seq the position of element equal to elem. </p>        </td>
124            </tr>
125            <tr>
126              <td>
127<a class="xref" href="stlDbstlElemTraitsmove.html" title="move">
128move
129</a>
130</td>
131              <td>
132   <p>Sequence movement. </p>        </td>
133            </tr>
134            <tr>
135              <td>
136<a class="xref" href="stlDbstlElemTraitsto_char_type.html" title="to_char_type">
137to_char_type
138</a>
139</td>
140              <td>
141   </td>
142            </tr>
143            <tr>
144              <td>
145<a class="xref" href="stlDbstlElemTraitsto_int_type.html" title="to_int_type">
146to_int_type
147</a>
148</td>
149              <td>
150   </td>
151            </tr>
152            <tr>
153              <td>
154<a class="xref" href="stlDbstlElemTraitseq_int_type.html" title="eq_int_type">
155eq_int_type
156</a>
157</td>
158              <td>
159   </td>
160            </tr>
161            <tr>
162              <td>
163<a class="xref" href="stlDbstlElemTraitseof.html" title="eof">
164eof
165</a>
166</td>
167              <td>
168   </td>
169            </tr>
170            <tr>
171              <td>
172<a class="xref" href="stlDbstlElemTraitsnot_eof.html" title="not_eof">
173not_eof
174</a>
175</td>
176              <td>
177   </td>
178            </tr>
179            <tr>
180              <td>
181<a class="xref" href="stlDbstlElemTraitsset_restore_function.html" title="set_restore_function">
182set_restore_function
183</a>
184</td>
185              <td>
186   </td>
187            </tr>
188            <tr>
189              <td>
190<a class="xref" href="stlDbstlElemTraitsget_restore_function.html" title="get_restore_function">
191get_restore_function
192</a>
193</td>
194              <td>
195   </td>
196            </tr>
197            <tr>
198              <td>
199<a class="xref" href="stlDbstlElemTraitsset_assign_function.html" title="set_assign_function">
200set_assign_function
201</a>
202</td>
203              <td>
204   </td>
205            </tr>
206            <tr>
207              <td>
208<a class="xref" href="stlDbstlElemTraitsget_assign_function.html" title="get_assign_function">
209get_assign_function
210</a>
211</td>
212              <td>
213   </td>
214            </tr>
215            <tr>
216              <td>
217<a class="xref" href="stlDbstlElemTraitsget_size_function.html" title="get_size_function">
218get_size_function
219</a>
220</td>
221              <td>
222   </td>
223            </tr>
224            <tr>
225              <td>
226<a class="xref" href="stlDbstlElemTraitsset_size_function.html" title="set_size_function">
227set_size_function
228</a>
229</td>
230              <td>
231   </td>
232            </tr>
233            <tr>
234              <td>
235<a class="xref" href="stlDbstlElemTraitsget_copy_function.html" title="get_copy_function">
236get_copy_function
237</a>
238</td>
239              <td>
240   </td>
241            </tr>
242            <tr>
243              <td>
244<a class="xref" href="stlDbstlElemTraitsset_copy_function.html" title="set_copy_function">
245set_copy_function
246</a>
247</td>
248              <td>
249   </td>
250            </tr>
251            <tr>
252              <td>
253<a class="xref" href="stlDbstlElemTraitsset_sequence_len_function.html" title="set_sequence_len_function">
254set_sequence_len_function
255</a>
256</td>
257              <td>
258   </td>
259            </tr>
260            <tr>
261              <td>
262<a class="xref" href="stlDbstlElemTraitsget_sequence_len_function.html" title="get_sequence_len_function">
263get_sequence_len_function
264</a>
265</td>
266              <td>
267   </td>
268            </tr>
269            <tr>
270              <td>
271<a class="xref" href="stlDbstlElemTraitsget_sequence_copy_function.html" title="get_sequence_copy_function">
272get_sequence_copy_function
273</a>
274</td>
275              <td>
276   </td>
277            </tr>
278            <tr>
279              <td>
280<a class="xref" href="stlDbstlElemTraitsset_sequence_copy_function.html" title="set_sequence_copy_function">
281set_sequence_copy_function
282</a>
283</td>
284              <td>
285   </td>
286            </tr>
287            <tr>
288              <td>
289<a class="xref" href="stlDbstlElemTraitsset_compare_function.html" title="set_compare_function">
290set_compare_function
291</a>
292</td>
293              <td>
294   </td>
295            </tr>
296            <tr>
297              <td>
298<a class="xref" href="stlDbstlElemTraitsget_compare_function.html" title="get_compare_function">
299get_compare_function
300</a>
301</td>
302              <td>
303   </td>
304            </tr>
305            <tr>
306              <td>
307<a class="xref" href="stlDbstlElemTraitsset_sequence_compare_function.html" title="set_sequence_compare_function">
308set_sequence_compare_function
309</a>
310</td>
311              <td>
312   </td>
313            </tr>
314            <tr>
315              <td>
316<a class="xref" href="stlDbstlElemTraitsget_sequence_compare_function.html" title="get_sequence_compare_function">
317get_sequence_compare_function
318</a>
319</td>
320              <td>
321   </td>
322            </tr>
323            <tr>
324              <td>
325<a class="xref" href="stlDbstlElemTraitsset_sequence_n_compare_function.html" title="set_sequence_n_compare_function">
326set_sequence_n_compare_function
327</a>
328</td>
329              <td>
330   </td>
331            </tr>
332            <tr>
333              <td>
334<a class="xref" href="stlDbstlElemTraitsget_sequence_n_compare_function.html" title="get_sequence_n_compare_function">
335get_sequence_n_compare_function
336</a>
337</td>
338              <td>
339   </td>
340            </tr>
341            <tr>
342              <td>
343<a class="xref" href="stlDbstlElemTraitsinstance.html" title="instance">
344instance
345</a>
346</td>
347              <td>
348   <p>Factory method to create a singeleton instance of this class. </p>        </td>
349            </tr>
350            <tr>
351              <td>
352<a class="xref" href="stlDbstlElemTraitsdstr_DbstlElemTraits.html" title="~DbstlElemTraits">
353~DbstlElemTraits
354</a>
355</td>
356              <td>
357   </td>
358            </tr>
359            <tr>
360              <td>
361<a class="xref" href="stlDbstlElemTraitsDbstlElemTraits.html" title="DbstlElemTraits">
362DbstlElemTraits
363</a>
364</td>
365              <td>
366   </td>
367            </tr>
368          </tbody>
369        </table>
370      </div>
371      <h4><a id="id1571342"></a>
372Group</h4>
373      <p>
374<a class="xref" href="dbstl_helper_classes.html" title="Chapter 21.  Dbstl Helper Classes">
375 Dbstl Helper Classes  </a>
376</p>
377      <p>
378</p>
379      <div class="sect1" lang="en" xml:lang="en">
380        <div class="titlepage">
381          <div>
382            <div>
383              <h2 class="title" style="clear: both"><a id="stlDbstlElemTraitsassign"></a>
384assign
385</h2>
386            </div>
387          </div>
388        </div>
389        <div class="sect2" lang="en" xml:lang="en">
390          <div class="titlepage">
391            <div>
392              <div>
393                <h3 class="title"><a id="func_details"></a>
394Function Details</h3>
395              </div>
396            </div>
397          </div>
398          <pre class="programlisting">
399static void assign(T &amp;left,
400    const T &amp;right)
401 </pre>
402          <div class="sect3" lang="en" xml:lang="en">
403            <div class="titlepage"></div>
404            <p>Assignone object to another. </p>
405          </div>
406          <pre class="programlisting">
407static T* assign(T *seq, size_t cnt,
408    T elem)
409 </pre>
410          <div class="sect3" lang="en" xml:lang="en">
411            <div class="titlepage"></div>
412            <p>Assign first cnt number of elements of sequence seq with the value of elem. </p>
413          </div>
414        </div>
415        <div class="sect2" lang="en" xml:lang="en">
416          <div class="titlepage">
417            <div>
418              <div>
419                <h3 class="title"><a id="id1571733"></a>
420Group: Interface compatible with std::string's char_traits.</h3>
421              </div>
422            </div>
423          </div>
424          <p>Following are char_traits funcitons, which make this class char_traits compatiable, so that it can be used in std::basic_string template, and be manipulated by the c++ stl algorithms. </p>
425        </div>
426        <div class="sect2" lang="en" xml:lang="en">
427          <div class="titlepage">
428            <div>
429              <div>
430                <h3 class="title"><a id="id1570953"></a>
431Class</h3>
432              </div>
433            </div>
434          </div>
435          <p>
436  <a class="link" href="DbstlElemTraits.html" title="Chapter 26.  DbstlElemTraits">
437  DbstlElemTraits</a>
438     </p>
439        </div>
440      </div>
441    </div>
442    <div class="navfooter">
443      <hr />
444      <table width="100%" summary="Navigation footer">
445        <tr>
446          <td width="40%" align="left"><a accesskey="p" href="stlDbstlDbtoperator_assign.html">Prev</a> </td>
447          <td width="20%" align="center"> </td>
448          <td width="40%" align="right"> <a accesskey="n" href="stlDbstlElemTraitseq.html">Next</a></td>
449        </tr>
450        <tr>
451          <td width="40%" align="left" valign="top">
452operator=
453 </td>
454          <td width="20%" align="center">
455            <a accesskey="h" href="index.html">Home</a>
456          </td>
457          <td width="40%" align="right" valign="top"458eq
459</td>
460        </tr>
461      </table>
462    </div>
463  </body>
464</html>
465