• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/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��4.�� Db_vector</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="stldb_containerdstr_db_container.html" title="~db_container" />
12    <link rel="next" href="stldb_vectorend.html" title="end" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">Chapter��4.��
19 Db_vector  </th>
20        </tr>
21        <tr>
22          <td width="20%" align="left"><a accesskey="p" href="stldb_containerdstr_db_container.html">Prev</a>��</td>
23          <th width="60%" align="center">��</th>
24          <td width="20%" align="right">��<a accesskey="n" href="stldb_vectorend.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="db_vector"></a>Chapter��4.��
34 Db_vector  </h2>
35          </div>
36        </div>
37      </div>
38      <p>The <a class="link" href="db_vector.html" title="Chapter��4.�� Db_vector">db_vector</a>
39 class has the union set of public member functions as std::vector, std::deque and std::list, and each method has identical default semantics to that in the std equivalent containers. </p>
40      <p>The difference is that the data is maintained using a Berkeley DB database as well as some Berkeley DB related extensions. </p>
41      <h4><a id="id1545596"></a>
42See Also
43</h4>
44      <p> </p>
45      <p><a class="link" href="db_container.html" title="Chapter��3.�� Db_container">db_container</a>
46 <a class="link" href="stldb_containerdb_container.html" title="db_container">db_container(Db*, DbEnv*)</a>
47 <a class="link" href="stldb_containerdb_container.html" title="db_container">db_container(const db_container&amp;)</a>
48 </p>
49      <div class="sect2" lang="en" xml:lang="en">
50        <div class="titlepage">
51          <div>
52            <div>
53              <h3 class="title"><a id="id1545192"></a>
54Class Template Parameters</h3>
55            </div>
56          </div>
57        </div>
58        <div class="sect3" lang="en" xml:lang="en">
59          <div class="titlepage">
60            <div>
61              <div>
62                <h4 class="title"><a id="id1545402"></a>
63T</h4>
64              </div>
65            </div>
66          </div>
67          <p>The type of data to store. </p>
68        </div>
69        <div class="sect3" lang="en" xml:lang="en">
70          <div class="titlepage">
71            <div>
72              <div>
73                <h4 class="title"><a id="id1545403"></a>
74value_type_sub</h4>
75              </div>
76            </div>
77          </div>
78          <p>If T is a class/struct type, do not specify anything for this parameter; Otherwise, specify ElementHolder&lt;T&gt; to it. Database(dbp) and environment(penv) handle requirement(applies for all constructors of this class template): dbp must meet the following requirement: 1. dbp must be a DB_RECNO type of database handle. 2. DB_THREAD must be set to dbp's open flags. 3. An optional flag DB_RENUMBER is required if the container object is supposed to be a std::vector or std::deque equivalent; Not required if it is a std::list equivalent. But dbstl will not check whether DB_RENUMBER is set to this database handle. Setting DB_RENUMBER will cause the index values of all elements in the underlying databse to be maintained consecutive and in order, which involves potentially a lot of work because many indices may be updated. See the <a class="link" href="stldb_containerdb_container.html" title="db_container">db_container(Db*, DbEnv*)</a>
79 for more information about the two parameters. </p>
80        </div>
81      </div>
82      <h4><a id="id1545532"></a> Public Members </h4>
83      <div class="informaltable">
84        <table border="1" width="80%">
85          <colgroup>
86            <col />
87            <col />
88          </colgroup>
89          <thead>
90            <tr>
91              <th>Member</th>
92              <th>Description</th>
93            </tr>
94          </thead>
95          <tbody>
96            <tr>
97              <td>
98<a class="xref" href="db_vector.html#stldb_vectorbegin" title="begin">
99begin
100</a>
101</td>
102              <td>
103   <p>Create a read-write or read-only iterator. </p>        </td>
104            </tr>
105            <tr>
106              <td>
107<a class="xref" href="stldb_vectorend.html" title="end">
108end
109</a>
110</td>
111              <td>
112   <p>Create an open boundary iterator. </p>        </td>
113            </tr>
114            <tr>
115              <td>
116<a class="xref" href="stldb_vectorrbegin.html" title="rbegin">
117rbegin
118</a>
119</td>
120              <td>
121   <p>Create a reverse iterator. </p>        </td>
122            </tr>
123            <tr>
124              <td>
125<a class="xref" href="stldb_vectorrend.html" title="rend">
126rend
127</a>
128</td>
129              <td>
130   <p>Create an open boundary iterator. </p>        </td>
131            </tr>
132            <tr>
133              <td>
134<a class="xref" href="stldb_vectormax_size.html" title="max_size">
135max_size
136</a>
137</td>
138              <td>
139   <p>Get max size. </p>        </td>
140            </tr>
141            <tr>
142              <td>
143<a class="xref" href="stldb_vectorcapacity.html" title="capacity">
144capacity
145</a>
146</td>
147              <td>
148   <p>Get capacity. </p>        </td>
149            </tr>
150            <tr>
151              <td>
152<a class="xref" href="stldb_vectoroperator_sqbrk.html" title="operator[]">
153operator[]
154</a>
155</td>
156              <td>
157   <p>Index operator, can act as both a left value and a right value. </p>        </td>
158            </tr>
159            <tr>
160              <td>
161<a class="xref" href="stldb_vectorat.html" title="at">
162at
163</a>
164</td>
165              <td>
166   <p>Index function. </p>        </td>
167            </tr>
168            <tr>
169              <td>
170<a class="xref" href="stldb_vectorfront.html" title="front">
171front
172</a>
173</td>
174              <td>
175   <p>Return a reference to the first element. </p>        </td>
176            </tr>
177            <tr>
178              <td>
179<a class="xref" href="stldb_vectorback.html" title="back">
180back
181</a>
182</td>
183              <td>
184   <p>Return a reference to the last element. </p>        </td>
185            </tr>
186            <tr>
187              <td>
188<a class="xref" href="stldb_vectoroperator_eq.html" title="operator==">
189operator==
190</a>
191</td>
192              <td>
193   <p>Container equality comparison operator. </p>        </td>
194            </tr>
195            <tr>
196              <td>
197<a class="xref" href="stldb_vectoroperator_ueq.html" title="operator!=">
198operator!=
199</a>
200</td>
201              <td>
202   <p>Container in-equality comparison operator. </p>        </td>
203            </tr>
204            <tr>
205              <td>
206<a class="xref" href="stldb_vectoroperator_lt.html" title="operator&lt;">
207operator&lt;
208</a>
209</td>
210              <td>
211   <p>Container less than comparison operator. </p>        </td>
212            </tr>
213            <tr>
214              <td>
215<a class="xref" href="stldb_vectorassign.html" title="assign">
216assign
217</a>
218</td>
219              <td>
220   <p>Assign a range [first, last) to this container. </p>        </td>
221            </tr>
222            <tr>
223              <td>
224<a class="xref" href="stldb_vectorpush_front.html" title="push_front">
225push_front
226</a>
227</td>
228              <td>
229   <p>Push an element x into the vector from front. </p>        </td>
230            </tr>
231            <tr>
232              <td>
233<a class="xref" href="stldb_vectorpop_front.html" title="pop_front">
234pop_front
235</a>
236</td>
237              <td>
238   <p>Pop out the front element from the vector. </p>        </td>
239            </tr>
240            <tr>
241              <td>
242<a class="xref" href="stldb_vectorinsert.html" title="insert">
243insert
244</a>
245</td>
246              <td>
247   <p>Insert x before position pos. </p>        </td>
248            </tr>
249            <tr>
250              <td>
251<a class="xref" href="stldb_vectorerase.html" title="erase">
252erase
253</a>
254</td>
255              <td>
256   <p>Erase element at position pos. </p>        </td>
257            </tr>
258            <tr>
259              <td>
260<a class="xref" href="stldb_vectorremove.html" title="remove">
261remove
262</a>
263</td>
264              <td>
265   <p>Remove all elements whose values are "value" from the list. </p>        </td>
266            </tr>
267            <tr>
268              <td>
269<a class="xref" href="stldb_vectorremove_if.html" title="remove_if">
270remove_if
271</a>
272</td>
273              <td>
274   <p>Remove all elements making "pred" return true. </p>        </td>
275            </tr>
276            <tr>
277              <td>
278<a class="xref" href="stldb_vectormerge.html" title="merge">
279merge
280</a>
281</td>
282              <td>
283   <p>Merge content with another container. </p>        </td>
284            </tr>
285            <tr>
286              <td>
287<a class="xref" href="stldb_vectorunique.html" title="unique">
288unique
289</a>
290</td>
291              <td>
292   <p>Remove consecutive duplicate values from this list. </p>        </td>
293            </tr>
294            <tr>
295              <td>
296<a class="xref" href="stldb_vectorsort.html" title="sort">
297sort
298</a>
299</td>
300              <td>
301   <p>Sort this list. </p>        </td>
302            </tr>
303            <tr>
304              <td>
305<a class="xref" href="stldb_vectorreverse.html" title="reverse">
306reverse
307</a>
308</td>
309              <td>
310   <p>Reverse this list. </p>        </td>
311            </tr>
312            <tr>
313              <td>
314<a class="xref" href="stldb_vectorsplice.html" title="splice">
315splice
316</a>
317</td>
318              <td>
319   <p>Moves elements from list x into this list. </p>        </td>
320            </tr>
321            <tr>
322              <td>
323<a class="xref" href="stldb_vectorsize.html" title="size">
324size
325</a>
326</td>
327              <td>
328   <div class="simplesect" lang="en" xml:lang="en"><div class="titlepage"></div><p>Return the number of elements in this container. </p></div><p>
329</p>        </td>
330            </tr>
331            <tr>
332              <td>
333<a class="xref" href="stldb_vectorempty.html" title="empty">
334empty
335</a>
336</td>
337              <td>
338   <p>Returns whether this container is empty. </p>        </td>
339            </tr>
340            <tr>
341              <td>
342<a class="xref" href="stldb_vectordb_vector.html" title="db_vector">
343db_vector
344</a>
345</td>
346              <td>
347   <p>Constructor. </p>        </td>
348            </tr>
349            <tr>
350              <td>
351<a class="xref" href="stldb_vectordstr_db_vector.html" title="~db_vector">
352~db_vector
353</a>
354</td>
355              <td>
356   </td>
357            </tr>
358            <tr>
359              <td>
360<a class="xref" href="stldb_vectoroperator_assign.html" title="operator=">
361operator=
362</a>
363</td>
364              <td>
365   <p>Container assignment operator. </p>        </td>
366            </tr>
367            <tr>
368              <td>
369<a class="xref" href="stldb_vectorresize.html" title="resize">
370resize
371</a>
372</td>
373              <td>
374   <p>Resize this container to specified size n, insert values t if need to enlarge the container. </p>        </td>
375            </tr>
376            <tr>
377              <td>
378<a class="xref" href="stldb_vectorreserve.html" title="reserve">
379reserve
380</a>
381</td>
382              <td>
383   <p>Reserve space. </p>        </td>
384            </tr>
385            <tr>
386              <td>
387<a class="xref" href="stldb_vectorpush_back.html" title="push_back">
388push_back
389</a>
390</td>
391              <td>
392   <p>Push back an element into the vector. </p>        </td>
393            </tr>
394            <tr>
395              <td>
396<a class="xref" href="stldb_vectorpop_back.html" title="pop_back">
397pop_back
398</a>
399</td>
400              <td>
401   <p>Pop out last element from the vector. </p>        </td>
402            </tr>
403            <tr>
404              <td>
405<a class="xref" href="stldb_vectorswap.html" title="swap">
406swap
407</a>
408</td>
409              <td>
410   <p>Swap content with another vector vec. </p>        </td>
411            </tr>
412            <tr>
413              <td>
414<a class="xref" href="stldb_vectorclear.html" title="clear">
415clear
416</a>
417</td>
418              <td>
419   <p>Remove all elements of the vector, make it an empty vector. </p>        </td>
420            </tr>
421          </tbody>
422        </table>
423      </div>
424      <h4><a id="id1545841"></a>
425Group</h4>
426      <p>
427<a class="xref" href="dbstl_containers.html" title="Chapter��2.�� Dbstl Container Classes">
428 Dbstl Container Classes  </a>
429</p>
430      <p>
431</p>
432      <div class="sect1" lang="en" xml:lang="en">
433        <div class="titlepage">
434          <div>
435            <div>
436              <h2 class="title" style="clear: both"><a id="stldb_vectorbegin"></a>
437begin
438</h2>
439            </div>
440          </div>
441        </div>
442        <div class="sect2" lang="en" xml:lang="en">
443          <div class="titlepage">
444            <div>
445              <div>
446                <h3 class="title"><a id="func_details"></a>
447Function Details</h3>
448              </div>
449            </div>
450          </div>
451          <pre class="programlisting">
452iterator��begin(ReadModifyWriteOption��rmw=
453��������ReadModifyWriteOption::no_read_modify_write(),��bool��readonly=false,
454��������BulkRetrievalOption��bulk_read=BulkRetrievalOption::no_bulk_retrieval(),
455��������bool��directdb_get=true)
456 </pre>
457          <div class="sect3" lang="en" xml:lang="en">
458            <div class="titlepage"></div>
459            <p>Create a read-write or read-only iterator. </p>
460            <p>We allow users to create a readonly iterator here so that they don't have to use a const container to create a const_iterator. But using const_iterator is faster. The flags set via db_container::set_cursor_oflags() is used as the cursor open flags. </p>
461          </div>
462          <div class="sect3" lang="en" xml:lang="en">
463            <div class="titlepage">
464              <div>
465                <div>
466                  <h4 class="title"><a id="id1545316"></a>
467Parameters</h4>
468                </div>
469              </div>
470            </div>
471            <div class="sect4" lang="en" xml:lang="en">
472              <div class="titlepage">
473                <div>
474                  <div>
475                    <h5 class="title"><a id="id1545388"></a>
476 directdb_get </h5>
477                  </div>
478                </div>
479              </div>
480              <p>Whether always read key/data pair from backing db rather than using the value cached in the iterator. The current key/data pair is cached in the iterator and always kept updated on iterator movement, but in some extreme conditions, errors can happen if you use cached key/data pairs without always refreshing them from database. By default we are always reading from database when we are accessing the data the iterator sits on, except when we are doing bulk retrievals. But your application can gain extra performance promotion if you can set this flag to false. </p>
481            </div>
482            <div class="sect4" lang="en" xml:lang="en">
483              <div class="titlepage">
484                <div>
485                  <div>
486                    <h5 class="title"><a id="id1545493"></a>
487 readonly </h5>
488                  </div>
489                </div>
490              </div>
491              <p>Whether the iterator is created as a readonly iterator. Read only iterators can not update its underlying key/data pair. </p>
492            </div>
493            <div class="sect4" lang="en" xml:lang="en">
494              <div class="titlepage">
495                <div>
496                  <div>
497                    <h5 class="title"><a id="id1546001"></a>
498 bulk_read </h5>
499                  </div>
500                </div>
501              </div>
502              <p>Whether read database key/data pairs in bulk, by specifying DB_MULTIPLE_KEY flag to underlying cursor's Dbc::get function. Only readonly iterators can do bulk retrieval, if iterator is not read only, this parameter is ignored. Bulk retrieval can accelerate reading speed because each database read operation will read many key/data pairs, thus saved many database read operations. The default bulk buffer size is 32KB, you can set your desired bulk buffer size by specifying BulkRetrievalOpt::bulk_retrieval(your_bulk_buffer_size); If you don't want bulk retrieval, set BulkRetrievalItrOpt::no_bulk_retrieval() as the real parameter. </p>
503            </div>
504            <div class="sect4" lang="en" xml:lang="en">
505              <div class="titlepage">
506                <div>
507                  <div>
508                    <h5 class="title"><a id="id1545129"></a>
509 rmw </h5>
510                  </div>
511                </div>
512              </div>
513              <p>Whether this iterator will open a Berkeley DB cursor with DB_RMW flag set. If the iterator is used to read a key/data pair, then update it and store back to db, it is good to set the DB_RMW flag, by specifying RMWItrOpt::read_modify_write() If you don't want to set the DB_RMW flag, specify RMWItrOpt::no_read_modify_write(), which is the default behavior. </p>
514            </div>
515          </div>
516          <div class="sect3" lang="en" xml:lang="en">
517            <div class="titlepage">
518              <div>
519                <div>
520                  <h4 class="title"><a id="id1545350"></a>
521Return Value</h4>
522                </div>
523              </div>
524            </div>
525            <p>The created iterator. </p>
526          </div>
527          <div class="sect3" lang="en" xml:lang="en">
528            <div class="titlepage">
529              <div>
530                <div>
531                  <h4 class="title"><a id="id1545389"></a>
532See Also</h4>
533                </div>
534              </div>
535            </div>
536            <p>
537    </p>
538            <p>db_container::set_cursor_oflags(); </p>
539            <p>   </p>
540          </div>
541          <pre class="programlisting">
542const_iterator��begin(BulkRetrievalOption��bulkretrieval=
543��������(BulkRetrievalOption::no_bulk_retrieval()),
544��������bool��directdb_get=true)��const
545 </pre>
546          <div class="sect3" lang="en" xml:lang="en">
547            <div class="titlepage"></div>
548            <p>Create a const iterator. </p>
549            <p>The created iterator can only be used to read its referenced data element. Can only be called when using a const reference to the contaienr object. The parameters have identical meanings and usage to those of the other non-const begin function. </p>
550          </div>
551          <div class="sect3" lang="en" xml:lang="en">
552            <div class="titlepage">
553              <div>
554                <div>
555                  <h4 class="title"><a id="id1545486"></a>
556Parameters</h4>
557                </div>
558              </div>
559            </div>
560            <div class="sect4" lang="en" xml:lang="en">
561              <div class="titlepage">
562                <div>
563                  <div>
564                    <h5 class="title"><a id="id1546325"></a>
565 directdb_get </h5>
566                  </div>
567                </div>
568              </div>
569              <p>Same as that of begin(ReadModifyWrite, bool, BulkRetrievalOption, bool); </p>
570            </div>
571            <div class="sect4" lang="en" xml:lang="en">
572              <div class="titlepage">
573                <div>
574                  <div>
575                    <h5 class="title"><a id="id1545237"></a>
576 bulkretrieval </h5>
577                  </div>
578                </div>
579              </div>
580              <p>Same as that of begin(ReadModifyWrite, bool, BulkRetrievalOption, bool); </p>
581            </div>
582          </div>
583          <div class="sect3" lang="en" xml:lang="en">
584            <div class="titlepage">
585              <div>
586                <div>
587                  <h4 class="title"><a id="id1546326"></a>
588Return Value</h4>
589                </div>
590              </div>
591            </div>
592            <p>The created const iterator. </p>
593          </div>
594          <div class="sect3" lang="en" xml:lang="en">
595            <div class="titlepage">
596              <div>
597                <div>
598                  <h4 class="title"><a id="id1545998"></a>
599See Also</h4>
600                </div>
601              </div>
602            </div>
603            <p>
604    </p>
605            <p>begin(ReadModifyWrite, bool, BulkRetrievalOption, bool); </p>
606            <p>   </p>
607          </div>
608        </div>
609        <div class="sect2" lang="en" xml:lang="en">
610          <div class="titlepage">
611            <div>
612              <div>
613                <h3 class="title"><a id="id1545664"></a>
614Class</h3>
615              </div>
616            </div>
617          </div>
618          <p>
619  <a class="link" href="db_vector.html" title="Chapter��4.�� Db_vector">
620  db_vector</a>
621     </p>
622        </div>
623      </div>
624    </div>
625    <div class="navfooter">
626      <hr />
627      <table width="100%" summary="Navigation footer">
628        <tr>
629          <td width="40%" align="left"><a accesskey="p" href="stldb_containerdstr_db_container.html">Prev</a>��</td>
630          <td width="20%" align="center">��</td>
631          <td width="40%" align="right">��<a accesskey="n" href="stldb_vectorend.html">Next</a></td>
632        </tr>
633        <tr>
634          <td width="40%" align="left" valign="top">
635~db_container
636��</td>
637          <td width="20%" align="center">
638            <a accesskey="h" href="index.html">Home</a>
639          </td>
640          <td width="40%" align="right" valign="top">��
641end
642</td>
643        </tr>
644      </table>
645    </div>
646  </body>
647</html>
648