aboutsummaryrefslogtreecommitdiff
path: root/odb/context.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-05-06 12:05:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-08-14 15:19:49 +0200
commit09d7377f81aeb8fde4aa1698e946457f03380d45 (patch)
treeeaedf7045fde8354a3693ce77edc7d5f86824e4e /odb/context.ixx
parent548f0b10aa3adfc722198bf31f773ba85047f344 (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/context.ixx')
-rw-r--r--odb/context.ixx27
1 files changed, 27 insertions, 0 deletions
diff --git a/odb/context.ixx b/odb/context.ixx
new file mode 100644
index 0000000..285d364
--- /dev/null
+++ b/odb/context.ixx
@@ -0,0 +1,27 @@
+// file : odb/context.ixx
+// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+// license : GNU GPL v3; see accompanying LICENSE file
+
+inline bool user_section::
+load_empty () const
+{
+ return !separate_load () || (total == 0 && !containers && !optimistic ());
+}
+
+inline bool user_section::
+update_empty () const
+{
+ return total == inverse + readonly && !readwrite_containers;
+}
+
+inline bool user_section::
+optimistic () const
+{
+ if (!context::optimistic (*object))
+ return false;
+ else
+ {
+ semantics::class_* poly_root (context::polymorphic (*object));
+ return poly_root == 0 || poly_root == object;
+ }
+}