aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/transaction.cxx33
-rw-r--r--odb/transaction.hxx27
-rw-r--r--odb/vector-impl.cxx6
-rw-r--r--odb/vector-impl.hxx2
-rw-r--r--odb/vector-impl.ixx10
5 files changed, 43 insertions, 35 deletions
diff --git a/odb/transaction.cxx b/odb/transaction.cxx
index 508d1aa..a34f1f3 100644
--- a/odb/transaction.cxx
+++ b/odb/transaction.cxx
@@ -79,7 +79,8 @@ namespace odb
struct rollback_guard
{
rollback_guard (transaction& t): t_ (&t) {}
- ~rollback_guard () {if (t_ != 0) t_->call (transaction::event_rollback);}
+ ~rollback_guard ()
+ {if (t_ != 0) t_->callback_call (transaction::event_rollback);}
void release () {t_ = 0;}
private:
transaction* t_;
@@ -106,7 +107,7 @@ namespace odb
rg.release ();
if (callback_count_ != 0)
- call (event_commit);
+ callback_call (event_commit);
}
void transaction::
@@ -130,11 +131,11 @@ namespace odb
rg.release ();
if (callback_count_ != 0)
- call (event_rollback);
+ callback_call (event_rollback);
}
void transaction::
- call (unsigned short event)
+ callback_call (unsigned short event)
{
size_t stack_count (callback_count_ < stack_callback_count
? callback_count_ : stack_callback_count);
@@ -185,11 +186,11 @@ namespace odb
}
void transaction::
- register_ (callback_type func,
- void* key,
- unsigned short event,
- unsigned long long data,
- transaction** state)
+ callback_register (callback_type func,
+ void* key,
+ unsigned short event,
+ unsigned long long data,
+ transaction** state)
{
callback_data* s;
@@ -227,7 +228,7 @@ namespace odb
}
size_t transaction::
- find (void* key)
+ callback_find (void* key)
{
if (callback_count_ == 0)
return 0;
@@ -267,9 +268,9 @@ namespace odb
}
void transaction::
- unregister (void* key)
+ callback_unregister (void* key)
{
- size_t i (find (key));
+ size_t i (callback_find (key));
// It is ok for this function not to find the key.
//
@@ -301,9 +302,12 @@ namespace odb
}
void transaction::
- update (void* key, unsigned long long data, transaction** state)
+ callback_update (void* key,
+ unsigned short event,
+ unsigned long long data,
+ transaction** state)
{
- size_t i (find (key));
+ size_t i (callback_find (key));
// It is ok for this function not to find the key.
//
@@ -315,6 +319,7 @@ namespace odb
? stack_callbacks_[i]
: dyn_callbacks_[i - stack_callback_count]);
+ d.event = event;
d.data = data;
d.state = state;
}
diff --git a/odb/transaction.hxx b/odb/transaction.hxx
index e035661..497b89b 100644
--- a/odb/transaction.hxx
+++ b/odb/transaction.hxx
@@ -121,26 +121,29 @@ namespace odb
// unspecified.
//
void
- register_ (callback_type,
- void* key,
- unsigned short event = event_all,
- unsigned long long data = 0,
- transaction** state = 0);
+ callback_register (callback_type,
+ void* key,
+ unsigned short event = event_all,
+ unsigned long long data = 0,
+ transaction** state = 0);
// Unregister a post-commit/rollback callback. Note that this is a
// potentially slow operation. You also don't need to unregister
// a callback that has been called or auto-reset using the state
- // argument passed to register_(). This function does nothing if
+ // argument passed to register(). This function does nothing if
// the key is not found.
//
void
- unregister (void* key);
+ callback_unregister (void* key);
- // Update the data and state values for a callback. Note that just
- // like unregister(), this is a potentially slow operation.
+ // Update the event, data, and state values for a callback. Note
+ // that just like unregister(), this is a potentially slow operation.
//
void
- update (void* key, unsigned long long data, transaction** state = 0);
+ callback_update (void* key,
+ unsigned short event,
+ unsigned long long data = 0,
+ transaction** state = 0);
public:
transaction_impl&
@@ -156,10 +159,10 @@ namespace odb
friend struct rollback_guard;
std::size_t
- find (void* key);
+ callback_find (void* key);
void
- call (unsigned short event);
+ callback_call (unsigned short event);
protected:
bool finalized_;
diff --git a/odb/vector-impl.cxx b/odb/vector-impl.cxx
index 9fd38f3..725841e 100644
--- a/odb/vector-impl.cxx
+++ b/odb/vector-impl.cxx
@@ -191,7 +191,7 @@ namespace odb
{
if (x.tran_ != 0)
{
- x.tran_->unregister (&x);
+ x.tran_->callback_unregister (&x);
_arm (*x.tran_);
}
}
@@ -214,13 +214,13 @@ namespace odb
transaction* t (x.tran_);
if (tran_ != 0)
{
- tran_->unregister (this);
+ tran_->callback_unregister (this);
x._arm (*tran_);
}
if (t != 0)
{
- t->unregister (&x);
+ t->callback_unregister (&x);
_arm (*t);
}
diff --git a/odb/vector-impl.hxx b/odb/vector-impl.hxx
index a6be505..38c64aa 100644
--- a/odb/vector-impl.hxx
+++ b/odb/vector-impl.hxx
@@ -192,7 +192,7 @@ namespace odb
protected:
vector_base (): tran_ (0) {}
- ~vector_base () {if (tran_ != 0) tran_->unregister (this);}
+ ~vector_base () {if (tran_ != 0) tran_->callback_unregister (this);}
vector_base (const vector_base&);
#ifdef ODB_CXX11
diff --git a/odb/vector-impl.ixx b/odb/vector-impl.ixx
index 5a859c4..c75a128 100644
--- a/odb/vector-impl.ixx
+++ b/odb/vector-impl.ixx
@@ -141,11 +141,11 @@ namespace odb
_arm (transaction& t) const
{
tran_ = &t;
- t.register_ (&rollback,
- const_cast<vector_base*> (this),
- transaction::event_rollback,
- 0,
- &tran_);
+ t.callback_register (&rollback,
+ const_cast<vector_base*> (this),
+ transaction::event_rollback,
+ 0,
+ &tran_);
}
inline vector_base::