From b324eaf164f9fa79e1ebbb7261e650fbde312374 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov
+
+
+ PART III PROFILES
+
+
+
+ 11 Profiles Introduction
+
+
+
@@ -1904,9 +1922,9 @@ class person
object pointers. Plus, ODB profile libraries, that are available for
commonly used frameworks and libraries (such as Boost and Qt),
provide support for smart pointers found in these frameworks and
- libraries. It is also easy to add support for our own smart pointers,
- as described in Section 6.4, "Using Custom Smart
- Pointers".12 Boost Profile
+
+
+
+
+ 12.1
+ 12.2
+ 12.3
The ODB runtime library provides built-in persistence support for - all the commonly used standard C++ containers, namely, +
The ODB runtime library provides built-in persistence support for all the
+ commonly used standard C++ containers, namely,
std::vector
, std::list
, std::set
,
std::multiset
, std::map
, and
std::multimap
. Plus, ODB profile libraries, that are
- available for commonly used frameworks and libraries (such as Boost
- and Qt), provide persistence support for containers found in these
- frameworks and libraries. It is also easy to persist custom
- container types as discussed later in Section 5.4,
- "Using Custom Containers".
We don't need to do anything special to declare a member of a container type in a persistent class. For example:
@@ -3694,18 +3712,18 @@ private:Relationships between persistent objects are expressed with pointers or
- containers of pointers. The ODB runtime library provides built-in
- support for the TR1 shared_ptr
/weak_ptr
,
+ containers of pointers. The ODB runtime library provides built-in support
+ for the TR1 shared_ptr
/weak_ptr
,
std::auto_ptr
, and raw pointers. Plus, ODB profile
libraries, that available for commonly used frameworks and libraries
- (such as Boost and Qt), provide support for smart pointers found
- in these frameworks and libraries. It is also easy to add support
- for a custom smart pointer as discussed later in
- Section 6.4, "Using Custom Smart Pointers". Any supported
- smart pointer can be used in a data member as long as it can be
+ (such as Boost and Qt), provide support for smart pointers found in these
+ frameworks and libraries (Part III, "Profiles"). It is
+ also easy to add support for a custom smart pointer as discussed later
+ in Section 6.4, "Using Custom Smart Pointers". Any
+ supported smart pointer can be used in a data member as long as it can be
explicitly constructed from the canonical object pointer
- (Section 3.2, "Object Pointers").
- For example, we can use weak_ptr
if the object pointer
+ (Section 3.2, "Object Pointers"). For example, we can
+ use weak_ptr
if the object pointer
is shared_ptr
.
When an object containing a pointer to another object is loaded,
@@ -4422,7 +4440,7 @@ t.commit ();
std::auto_ptr
, and odb::lazy_ptr
for raw
pointers. The ODB profile libraries provide lazy pointer
implementations for smart pointers from popular frameworks and
- libraries.
While we will discuss the interface of lazy pointers in more detail
shortly, the most commonly used extra function provided by these
@@ -6878,6 +6896,79 @@ namespace odb
what()
function returns a human-readable description
of an error.
Part III covers the integration of ODB with popular C++ frameworks + and libraries.
+ + + + +ODB profiles are a generic mechanism for integrating ODB with other
+ C++ frameworks and libraries. A profile provides glue code, packaged
+ into a profile library, which allows you to seamlesly persist various
+ components, such as smart pointers, containers, and value types from
+ your favorite C++ framework or library. For example, the Boost profile
+ implementation is provided by the libodb-boost
profile
+ library.
While we will need to link the profile library to our application,
+ it is also necessary to let the ODB compiler know which profiles we
+ are using. This is acomplished with the --profile
+ (or -p
alias) option. For example:
+odb --profile boost ... ++ +
Some profiles, especially those covering frameworks or libraries that
+ consist of multiple sub-libraries, provide sub-profiles which allow you
+ to pick and chooses which components you would like to use in your
+ application. For example, the boost
profile contains
+ the boost/data-time
sub-profile. If we are only
+ interested in the date_time
types, then we can
+ pass boost/data-time
instead of boost
+ to the --profile
option, for example:
+odb --profile boost/date-time ... ++ +
To summarize, you will need to perform the following steps in order + to make use of a profile in your application:
+ +-I
option).--profile
option.-I
option).The remaining chapters in this part of the manual describe the + individual profiles supported by ODB.
+ +The ODB profile implementation for Boost is provided by the
+ libodb-boost
profile library. To enable all supported Boost
+ sub-libraries, specify boost
as the profile name in
+ the --profile
ODB compiler option. Alternatively you can
+ enable only specific sub-profiles. The available sub-profiles are
+ discussed in the following sections.