aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-01-07 14:56:36 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-01-16 07:42:54 +0200
commitb14d811c7ea34c6ec423c0a7b90f4c271213b4af (patch)
tree7219e395c6ef3a97a249c02482a56adba948f3af
parentb366c3176462d470e445bc8aeb93a13df87e0518 (diff)
Add support for low-level access to object cache
-rw-r--r--odb/session.hxx24
1 files changed, 16 insertions, 8 deletions
diff --git a/odb/session.hxx b/odb/session.hxx
index f9c8739..4db10b3 100644
--- a/odb/session.hxx
+++ b/odb/session.hxx
@@ -73,10 +73,9 @@ namespace odb
};
template <typename T>
- struct object_map:
- object_map_base,
- std::map<typename object_traits<T>::id_type,
- typename object_traits<T>::pointer_type>
+ struct object_map: object_map_base,
+ std::map<typename object_traits<T>::id_type,
+ typename object_traits<T>::pointer_type>
{
};
@@ -84,9 +83,9 @@ namespace odb
//
public:
// Position in the cache of an inserted element. The requirements
- // for this class template are: default and copy-constructible and
- // copy-assignable. In particular, a standard iterator can be used
- // as a position.
+ // for this class template are: default and copy-constructible as
+ // well as copy-assignable. In particular, a standard iterator can
+ // be used as a position.
//
template <typename T>
struct position
@@ -119,13 +118,22 @@ namespace odb
void
erase (const position<T>&);
- protected:
+ // Low-level object cache access (iteration, etc).
+ //
+ public:
typedef std::map<const std::type_info*,
details::shared_ptr<object_map_base>,
details::type_info_comparator> type_map;
typedef std::map<database_type*, type_map> database_map;
+ database_map&
+ map () {return db_map_;}
+
+ const database_map&
+ map () const {return db_map_;}
+
+ protected:
database_map db_map_;
};
}