summaryrefslogtreecommitdiff
path: root/odb/context.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-09-02 08:33:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-09-02 08:33:25 +0200
commit3e23b0478aa8f426e0443d2c4c0189b4da0e6198 (patch)
treef3d3c7ba0e2cb26e7d060795c368f38eeb118f97 /odb/context.hxx
parentf3f682c074117fda84bf51a4ce9a378d950a04de (diff)
Support for versioning simple value in object
Diffstat (limited to 'odb/context.hxx')
-rw-r--r--odb/context.hxx39
1 files changed, 37 insertions, 2 deletions
diff --git a/odb/context.hxx b/odb/context.hxx
index df32cdd..9c52282 100644
--- a/odb/context.hxx
+++ b/odb/context.hxx
@@ -726,7 +726,7 @@ public:
return m.count ("transient");
}
- // Return the deletion version or 0 if not fort-deleted.
+ // Return the deletion version or 0 if not soft-deleted.
//
static unsigned long long
deleted (semantics::class_& c)
@@ -735,6 +735,12 @@ public:
}
static unsigned long long
+ deleted (semantics::data_member& m)
+ {
+ return m.get<unsigned long long> ("deleted", 0);
+ }
+
+ static unsigned long long
deleted (data_member_path const& mp)
{
unsigned long long r (0);
@@ -745,7 +751,7 @@ public:
i != mp.rend (); ++i)
{
unsigned long long v ((*i)->get<unsigned long long> ("deleted", 0));
- if (v != 0 && v < r)
+ if (v != 0 && (r == 0 || v < r))
r = v;
}
@@ -755,6 +761,12 @@ public:
// Return the addition version or 0 if not soft-added.
//
static unsigned long long
+ added (semantics::data_member& m)
+ {
+ return m.get<unsigned long long> ("added", 0);
+ }
+
+ static unsigned long long
added (data_member_path const& mp)
{
unsigned long long r (0);
@@ -888,6 +900,26 @@ public:
return unit.get<model_version> ("model-version");
}
+ // Versioned object, view, or composite.
+ //
+ static bool
+ versioned (semantics::class_& c)
+ {
+ // Set by processor.
+ //
+ return c.count ("versioned") != 0;
+ }
+
+ // Versioned container.
+ //
+ static bool
+ versioned (semantics::data_member& m)
+ {
+ // Set by processor.
+ //
+ return container (m)->count ("versioned");
+ }
+
// Object sections.
//
static object_section&
@@ -1145,6 +1177,7 @@ public:
readonly (0),
optimistic_managed (0),
discriminator (0),
+ soft (0),
separate_load (0),
separate_update (0)
{
@@ -1157,6 +1190,8 @@ public:
size_t optimistic_managed;
size_t discriminator;
+ size_t soft; // Soft-added/deleted.
+
size_t separate_load;
size_t separate_update; // Only readwrite.
};