<?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 7. Standard Template Library API</title> <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" /> <link rel="up" href="index.html" title="Berkeley DB Programmer's Reference Guide" /> <link rel="prev" href="csharp.html" title="Chapter 6. C# API" /> <link rel="next" href="stl_usecase.html" title="Dbstl typical use cases" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">Chapter 7. Standard Template Library API</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="csharp.html">Prev</a> </td> <th width="60%" align="center"> </th> <td width="20%" align="right"> <a accesskey="n" href="stl_usecase.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="stl"></a>Chapter 7. Standard Template Library API</h2> </div> </div> </div> <div class="toc"> <p> <b>Table of Contents</b> </p> <dl> <dt> <span class="sect1"> <a href="stl.html#stl_intro">Dbstl introduction</a> </span> </dt> <dd> <dl> <dt> <span class="sect2"> <a href="stl.html#stl_intro_stdcompat">Standards compatible</a> </span> </dt> <dt> <span class="sect2"> <a href="stl.html#stl_intro_performance">Performance overhead</a> </span> </dt> <dt> <span class="sect2"> <a href="stl.html#stl_intro_portability">Portability</a> </span> </dt> </dl> </dd> <dt> <span class="sect1"> <a href="stl_usecase.html">Dbstl typical use cases</a> </span> </dt> <dt> <span class="sect1"> <a href="stl_examples.html">Dbstl examples</a> </span> </dt> <dt> <span class="sect1"> <a href="stl_db_usage.html">Berkeley DB configuration</a> </span> </dt> <dd> <dl> <dt> <span class="sect2"> <a href="stl_db_usage.html#id1599352">Registering database and environment handles</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_db_usage.html#id1599734">Truncate requirements</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_db_usage.html#id1599105">Auto commit support</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_db_usage.html#id1599533">Database and environment identity checks</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_db_usage.html#id1599614">Products, constructors and configurations</a> </span> </dt> </dl> </dd> <dt> <span class="sect1"> <a href="stl_db_advanced_usage.html">Using advanced Berkeley DB features with dbstl</a> </span> </dt> <dd> <dl> <dt> <span class="sect2"> <a href="stl_db_advanced_usage.html#id1599057">Using bulk retrieval iterators</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_db_advanced_usage.html#id1599981">Using the DB_RMW flag</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_db_advanced_usage.html#id1599961">Using secondary index database and secondary containers</a> </span> </dt> </dl> </dd> <dt> <span class="sect1"> <a href="stl_txn_usage.html">Using transactions in dbstl</a> </span> </dt> <dt> <span class="sect1"> <a href="stl_mt_usage.html">Using dbstl in multithreaded applications</a> </span> </dt> <dt> <span class="sect1"> <a href="stl_primitive_rw.html">Working with primitive types </a> </span> </dt> <dd> <dl> <dt> <span class="sect2"> <a href="stl_primitive_rw.html#id1600210">Storing strings</a> </span> </dt> </dl> </dd> <dt> <span class="sect1"> <a href="stl_complex_rw.html">Store and Retrieve data or objects of complex types </a> </span> </dt> <dd> <dl> <dt> <span class="sect2"> <a href="stl_complex_rw.html#id1600835">Storing varying length objects</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_complex_rw.html#id1601365">Storing arbitrary sequences</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_complex_rw.html#id1601088">Notes</a> </span> </dt> </dl> </dd> <dt> <span class="sect1"> <a href="stl_persistence.html">Dbstl persistence</a> </span> </dt> <dd> <dl> <dt> <span class="sect2"> <a href="stl_persistence.html#directdbget">Direct database get</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_persistence.html#chg_persistence">Change persistence</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_persistence.html#obj_life_persistence">Object life time and persistence </a> </span> </dt> </dl> </dd> <dt> <span class="sect1"> <a href="stl_container_specific.html">Dbstl container specific notes</a> </span> </dt> <dd> <dl> <dt> <span class="sect2"> <a href="stl_container_specific.html#id1601960">db_vector specific notes</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_container_specific.html#id1602573">Associative container specific notes</a> </span> </dt> </dl> </dd> <dt> <span class="sect1"> <a href="stl_efficienct_use.html">Using dbstl efficiently</a> </span> </dt> <dd> <dl> <dt> <span class="sect2"> <a href="stl_efficienct_use.html#id1602418">Using iterators efficiently</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_efficienct_use.html#id1602624">Using containers efficiently</a> </span> </dt> </dl> </dd> <dt> <span class="sect1"> <a href="stl_memory_mgmt.html">Dbstl memory management</a> </span> </dt> <dd> <dl> <dt> <span class="sect2"> <a href="stl_memory_mgmt.html#id1602244">Freeing memory</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_memory_mgmt.html#id1602395">Type specific notes</a> </span> </dt> </dl> </dd> <dt> <span class="sect1"> <a href="stl_misc.html">Dbstl miscellaneous notes</a> </span> </dt> <dd> <dl> <dt> <span class="sect2"> <a href="stl_misc.html#id1602620">Special notes about trivial methods</a> </span> </dt> <dt> <span class="sect2"> <a href="stl_misc.html#id1602670">Using correct container and iterator public types</a> </span> </dt> </dl> </dd> <dt> <span class="sect1"> <a href="stl_known_issues.html">Dbstl known issues</a> </span> </dt> </dl> </div> <div class="sect1" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"><a id="stl_intro"></a>Dbstl introduction</h2> </div> </div> </div> <div class="toc"> <dl> <dt> <span class="sect2"> <a href="stl.html#stl_intro_stdcompat">Standards compatible</a> </span> </dt> <dt> <span class="sect2"> <a href="stl.html#stl_intro_performance">Performance overhead</a> </span> </dt> <dt> <span class="sect2"> <a href="stl.html#stl_intro_portability">Portability</a> </span> </dt> </dl> </div> <p> Dbstl is a C++ STL style API that provides for Berkeley DB usage. It allows for the storage and retrieval of data/objects of any type using Berkeley DB databases, but with an interface that mimics that of C++ STL containers. Dbstl provides access to all of the functionality of Berkeley DB available via this STL-style API. </p> <p> With proper configuration, dbstl is able to store/retrieve any complex data types. There is no need to perform repetitive marshalling and unmarshalling of data. Dbstl also properly manages the life-cycle of all Berkeley DB structures and objects. </p> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="stl_intro_stdcompat"></a>Standards compatible</h3> </div> </div> </div> <p> Dbstl is composed of many container and iterator class templates. These containers and iterators correspond exactly to each container and iterator available in the C++ STL API, including identical sets of methods. This allows existing algorithms, functions and container-adapters for C++ STL to use dbstl containers through its standard iterators. This means that existing STL code can manipulate Berkeley DB databases. As a result, existing C++ STL code can very easily use dbstl to gain persistence and transaction guarantees. </p> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="stl_intro_performance"></a>Performance overhead</h3> </div> </div> </div> <p> Because dbstl uses C++ template technologies, its performance overhead is minimal. </p> <p> The dbstl API performs almost equally to the C API, as measured by two different implementations of the TPC-B benchmark: <code class="literal">ex_tpcb</code> and <code class="literal">exstl_tpcb</code>. </p> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="stl_intro_portability"></a>Portability</h3> </div> </div> </div> <p> The degree to which dbstl is portable to a new platform is determined by whether Berkeley DB is available on the platform, as well as whether an appropriate C++ compiler is available on the platform. </p> <p> For information on porting Berkeley DB to new platforms, see the <em class="citetitle">Berkeley DB Porting Guide</em>. </p> <p> Almost all the advanced C++ template features are used in dbstl, including: </p> <div class="itemizedlist"> <ul type="disc"> <li> <p> member function templates </p> </li> <li> <p> member function template overloads </p> </li> <li> <p> partial specialization </p> </li> <li> <p> default template parameters. </p> </li> </ul> </div> <p> For this reason, you need a standards-compatible C++ compiler to build dbstl. As of this writing, the following compilers are known to build dbstl successfully: </p> <div class="itemizedlist"> <ul type="disc"> <li> <p> MSVC8 </p> </li> <li> <p> gcc3.4.4 and above </p> </li> <li> <p> Intel C++ 9 and above </p> </li> </ul> </div> <p> For *nix platforms, if you can successfully configure your Berkeley DB build script with <code class="literal">--enable-stl</code>, then you should be able to successfully build dbstl library and application code using it. </p> <p> Besides its own test suite, dbstl has also been tested against, and passes, the following test suites: </p> <div class="itemizedlist"> <ul type="disc"> <li> <p> MS STL test suite </p> </li> <li> <p> SGI STL test suite </p> </li> </ul> </div> </div> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="csharp.html">Prev</a> </td> <td width="20%" align="center"> </td> <td width="40%" align="right"> <a accesskey="n" href="stl_usecase.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">Chapter 6. C# API </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> Dbstl typical use cases</td> </tr> </table> </div> </body> </html>