From 91830e3bd38a05c73d03a5dfb88997799d44274b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 6 May 2013 12:05:39 +0200 Subject: 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. --- odb/vector-traits.txx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'odb/vector-traits.txx') 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 + bool access::container_traits >:: + 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 void access::container_traits >:: update (const container_type& c, const functions& f) { -- cgit v1.1