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 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Chapter 4. Db_vector</title>
<link rel="stylesheet" href="apiReference.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
<link rel="start" href="index.html" title="Berkeley DB C++ Standard Template Library API Reference" />
<link rel="up" href="index.html" title="Berkeley DB C++ Standard Template Library API Reference" />
<link rel="prev" href="stldb_containerdstr_db_container.html" title="~db_container" />
<link rel="next" href="stldb_vectorend.html" title="end" />
</head>
<body>
<div xmlns="" class="navheader">
<div class="libver">
<p>Library Version 11.2.5.3</p>
</div>
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Chapter 4.
Db_vector </th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="stldb_containerdstr_db_container.html">Prev</a> </td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="stldb_vectorend.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="chapter" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="db_vector"></a>Chapter 4.
Db_vector </h2>
</div>
</div>
</div>
<p>The <a class="link" href="db_vector.html" title="Chapter 4. Db_vector">db_vector</a>
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>
<p>The difference is that the data is maintained using a Berkeley DB database as well as some Berkeley DB related extensions. </p>
<h4><a id="idp49787192"></a>
See Also
</h4>
<p> </p>
<p><a class="link" href="db_container.html" title="Chapter 3. Db_container">db_container</a>
<a class="link" href="stldb_containerdb_container.html" title="db_container">db_container(Db*, DbEnv*)</a>
<a class="link" href="stldb_containerdb_container.html" title="db_container">db_container(const db_container&)</a>
</p>
<div class="sect2" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="idp50000704"></a>
Class Template Parameters</h3>
</div>
</div>
</div>
<div class="sect3" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a id="idp49985808"></a>
T</h4>
</div>
</div>
</div>
<p>The type of data to store. </p>
</div>
<div class="sect3" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a id="idp50007768"></a>
value_type_sub</h4>
</div>
</div>
</div>
<p>If T is a class/struct type, do not specify anything for this parameter; Otherwise, specify ElementHolder<T> 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>
for more information about the two parameters. </p>
</div>
</div>
<h4><a id="idp50082440"></a> Public Members </h4>
<div class="informaltable">
<table border="1" width="80%">
<colgroup>
<col />
<col />
</colgroup>
<thead>
<tr>
<th>Member</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="xref" href="db_vector.html#stldb_vectorbegin" title="begin">begin</a>
</td>
<td>
<p>Create a read-write or read-only iterator. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorend.html" title="end">end</a>
</td>
<td>
<p>Create an open boundary iterator. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorrbegin.html" title="rbegin">rbegin</a>
</td>
<td>
<p>Create a reverse iterator. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorrend.html" title="rend">rend</a>
</td>
<td>
<p>Create an open boundary iterator. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectormax_size.html" title="max_size">max_size</a>
</td>
<td>
<p>Get max size. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorcapacity.html" title="capacity">capacity</a>
</td>
<td>
<p>Get capacity. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectoroperator_sqbrk.html" title="operator[]">operator[]</a>
</td>
<td>
<p>Index operator, can act as both a left value and a right value. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorat.html" title="at">at</a>
</td>
<td>
<p>Index function. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorfront.html" title="front">front</a>
</td>
<td>
<p>Return a reference to the first element. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorback.html" title="back">back</a>
</td>
<td>
<p>Return a reference to the last element. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectoroperator_eq.html" title="operator==">operator==</a>
</td>
<td>
<p>Container equality comparison operator. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectoroperator_ueq.html" title="operator!=">operator!=</a>
</td>
<td>
<p>Container in-equality comparison operator. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectoroperator_lt.html" title="operator<">operator<</a>
</td>
<td>
<p>Container less than comparison operator. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorassign.html" title="assign">assign</a>
</td>
<td>
<p>Assign a range [first, last) to this container. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorpush_front.html" title="push_front">push_front</a>
</td>
<td>
<p>Push an element x into the vector from front. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorpop_front.html" title="pop_front">pop_front</a>
</td>
<td>
<p>Pop out the front element from the vector. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorinsert.html" title="insert">insert</a>
</td>
<td>
<p>Insert x before position pos. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorerase.html" title="erase">erase</a>
</td>
<td>
<p>Erase element at position pos. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorremove.html" title="remove">remove</a>
</td>
<td>
<p>Remove all elements whose values are "value" from the list. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorremove_if.html" title="remove_if">remove_if</a>
</td>
<td>
<p>Remove all elements making "pred" return true. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectormerge.html" title="merge">merge</a>
</td>
<td>
<p>Merge content with another container. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorunique.html" title="unique">unique</a>
</td>
<td>
<p>Remove consecutive duplicate values from this list. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorsort.html" title="sort">sort</a>
</td>
<td>
<p>Sort this list. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorreverse.html" title="reverse">reverse</a>
</td>
<td>
<p>Reverse this list. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorsplice.html" title="splice">splice</a>
</td>
<td>
<p>Moves elements from list x into this list. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorsize.html" title="size">size</a>
</td>
<td>
<div class="simplesect" lang="en" xml:lang="en"><div class="titlepage"></div><p>Return the number of elements in this container. </p></div><p>
</p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorempty.html" title="empty">empty</a>
</td>
<td>
<p>Returns whether this container is empty. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectordb_vector.html" title="db_vector">db_vector</a>
</td>
<td>
<p>Constructor. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectordstr_db_vector.html" title="~db_vector">~db_vector</a>
</td>
<td>
</td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectoroperator_assign.html" title="operator=">operator=</a>
</td>
<td>
<p>Container assignment operator. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorresize.html" title="resize">resize</a>
</td>
<td>
<p>Resize this container to specified size n, insert values t if need to enlarge the container. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorreserve.html" title="reserve">reserve</a>
</td>
<td>
<p>Reserve space. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorpush_back.html" title="push_back">push_back</a>
</td>
<td>
<p>Push back an element into the vector. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorpop_back.html" title="pop_back">pop_back</a>
</td>
<td>
<p>Pop out last element from the vector. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorswap.html" title="swap">swap</a>
</td>
<td>
<p>Swap content with another vector vec. </p> </td>
</tr>
<tr>
<td>
<a class="xref" href="stldb_vectorclear.html" title="clear">clear</a>
</td>
<td>
<p>Remove all elements of the vector, make it an empty vector. </p> </td>
</tr>
</tbody>
</table>
</div>
<h4><a id="idp50090336"></a>
Group</h4>
<p>
<a class="xref" href="dbstl_containers.html" title="Chapter 2. Dbstl Container Classes">
Dbstl Container Classes </a>
</p>
<p>
</p>
<div class="sect1" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a id="stldb_vectorbegin"></a>begin</h2>
</div>
</div>
</div>
<div class="sect2" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="stldb_vectorbegin_details"></a>Function Details</h3>
</div>
</div>
</div>
<pre class="programlisting">
iterator begin(ReadModifyWriteOption rmw=
ReadModifyWriteOption::no_read_modify_write(), bool readonly=false,
BulkRetrievalOption bulk_read=BulkRetrievalOption::no_bulk_retrieval(),
bool directdb_get=true)
</pre>
<p>Create a read-write or read-only iterator. </p>
<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>
<div class="sect3" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a id="idp50122152"></a>Parameters</h4>
</div>
</div>
</div>
<div class="sect4" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h5 class="title"><a id="idp50154576"></a>directdb_get</h5>
</div>
</div>
</div>
<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>
</div>
<div class="sect4" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h5 class="title"><a id="idp50079352"></a>readonly</h5>
</div>
</div>
</div>
<p>Whether the iterator is created as a readonly iterator. Read only iterators can not update its underlying key/data pair. </p>
</div>
<div class="sect4" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h5 class="title"><a id="idp50138024"></a>bulk_read</h5>
</div>
</div>
</div>
<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>
</div>
<div class="sect4" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h5 class="title"><a id="idp50139400"></a>rmw</h5>
</div>
</div>
</div>
<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>
</div>
</div>
<div class="sect3" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a id="idp50140432"></a>Return Value</h4>
</div>
</div>
</div>
<p>The created iterator. </p>
</div>
<div class="sect3" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a id="idp50145544"></a>See Also</h4>
</div>
</div>
</div>
<p>
</p>
<p>db_container::set_cursor_oflags(); </p>
<p>
</p>
</div>
<pre class="programlisting">
const_iterator begin(BulkRetrievalOption bulkretrieval=
(BulkRetrievalOption::no_bulk_retrieval()),
bool directdb_get=true) const
</pre>
<p>Create a const iterator. </p>
<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>
<div class="sect3" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a id="idp50145040"></a>Parameters</h4>
</div>
</div>
</div>
<div class="sect4" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h5 class="title"><a id="idp50068072"></a>directdb_get</h5>
</div>
</div>
</div>
<p>Same as that of begin(ReadModifyWrite, bool, BulkRetrievalOption, bool); </p>
</div>
<div class="sect4" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h5 class="title"><a id="idp50143520"></a>bulkretrieval</h5>
</div>
</div>
</div>
<p>Same as that of begin(ReadModifyWrite, bool, BulkRetrievalOption, bool); </p>
</div>
</div>
<div class="sect3" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a id="idp50006976"></a>Return Value</h4>
</div>
</div>
</div>
<p>The created const iterator. </p>
</div>
<div class="sect3" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a id="idp50143848"></a>See Also</h4>
</div>
</div>
</div>
<p>
</p>
<p>begin(ReadModifyWrite, bool, BulkRetrievalOption, bool); </p>
<p>
</p>
</div>
</div>
<div class="sect2" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="idp50143664"></a>Class</h3>
</div>
</div>
</div>
<p>
<a class="link" href="db_vector.html" title="Chapter 4. Db_vector">db_vector</a>
</p>
</div>
</div>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="stldb_containerdstr_db_container.html">Prev</a> </td>
<td width="20%" align="center"> </td>
<td width="40%" align="right"> <a accesskey="n" href="stldb_vectorend.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">~db_container </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> end</td>
</tr>
</table>
</div>
</body>
</html>
|