diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-05-06 12:05:39 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-08-14 15:18:23 +0200 |
commit | 91830e3bd38a05c73d03a5dfb88997799d44274b (patch) | |
tree | 399f1fc61ce959ac63b8b7ebaf5e3c58f80d8a7d /odb/vector-traits.txx | |
parent | 72b262ee4f375089256f6438152bd323df1ff5a3 (diff) |
Add support for object sections
Sections are an optimization mechanism that allows the partitioning of
data members of a persistent class into groups that can be separately
loaded and/or updated.
Diffstat (limited to 'odb/vector-traits.txx')
-rw-r--r-- | odb/vector-traits.txx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/odb/vector-traits.txx b/odb/vector-traits.txx index 66f757a..2844633 100644 --- a/odb/vector-traits.txx +++ b/odb/vector-traits.txx @@ -5,6 +5,34 @@ namespace odb { template <typename V, typename A LIBODB_VECTOR_ARG_DECL> + bool access::container_traits<vector<V, A LIBODB_VECTOR_ARG_USE> >:: + changed (const container_type& c) + { + // Because modifications can cancel each other (e.g., push and pop), + // it is tricky to keep track of whether there are any changes in + // the container. Instead, we are just going to examine each element + // just like update(). + // + + // We should either be tracking or summarily changed. + // + if (c._tracking ()) + { + const vector_impl& impl (c._impl ()); + + for (std::size_t i (0), n (impl.size ()); i < n; ++i) + { + if (impl.state (i) != vector_impl::state_unchanged) + return true; + } + } + else + return true; + + return false; + } + + template <typename V, typename A LIBODB_VECTOR_ARG_DECL> void access::container_traits<vector<V, A LIBODB_VECTOR_ARG_USE> >:: update (const container_type& c, const functions& f) { |