added .except(...), renamed old_ptr_noncopyable to old_ptr_if_copyable, and renamed OLDOF to OLD

This commit is contained in:
Lorenzo Caminiti
2016-08-21 09:54:10 -07:00
parent a2ac52ffd7
commit ff02b449dd
163 changed files with 1808 additions and 1491 deletions

View File

@@ -20,11 +20,11 @@ public:
/* Creation */
observer() {
boost::contract::guard c = boost::contract::constructor(this);
boost::contract::check c = boost::contract::constructor(this);
}
virtual ~observer() {
boost::contract::guard c = boost::contract::destructor(this);
boost::contract::check c = boost::contract::destructor(this);
}
/* Commands */
@@ -38,13 +38,13 @@ public:
};
bool observer::up_to_date_with_subject(boost::contract::virtual_* v) const {
boost::contract::guard c = boost::contract::public_function(v, this);
boost::contract::check c = boost::contract::public_function(v, this);
assert(false);
return false;
}
void observer::update(boost::contract::virtual_* v) {
boost::contract::guard c = boost::contract::public_function(v, this)
boost::contract::check c = boost::contract::public_function(v, this)
.postcondition([&] {
BOOST_CONTRACT_ASSERT(up_to_date_with_subject()); // Up-to-date.
})

View File

@@ -35,20 +35,20 @@ public:
// Construct subject with no observer.
subject() {
// Check invariant.
boost::contract::guard c = boost::contract::constructor(this);
boost::contract::check c = boost::contract::constructor(this);
}
// Destroy subject.
virtual ~subject() {
// Check invariant.
boost::contract::guard c = boost::contract::destructor(this);
boost::contract::check c = boost::contract::destructor(this);
}
/* Queries */
// If given object is attached.
bool attached(observer const* ob) const {
boost::contract::guard c = boost::contract::public_function(this)
boost::contract::check c = boost::contract::public_function(this)
.precondition([&] {
BOOST_CONTRACT_ASSERT(ob); // Not null.
})
@@ -63,8 +63,8 @@ public:
// Attach given object as an observer.
void attach(observer* ob) {
boost::contract::old_ptr<std::vector<observer const*> > old_observers =
BOOST_CONTRACT_OLDOF(observers());
boost::contract::guard c = boost::contract::public_function(this)
BOOST_CONTRACT_OLD(observers());
boost::contract::check c = boost::contract::public_function(this)
.precondition([&] {
BOOST_CONTRACT_ASSERT(ob); // Not null.
BOOST_CONTRACT_ASSERT(!attached(ob)); // Not already attached.
@@ -102,7 +102,7 @@ protected:
// Update all attached observers.
void notify() {
// Protected members use `function` (no inv and no subcontracting).
boost::contract::guard c = boost::contract::function()
boost::contract::check c = boost::contract::function()
.postcondition([&] {
if(O_N <= COMPLEXITY_MAX) {
// All updated.
@@ -137,7 +137,7 @@ private:
observer const* ob
) {
// Private members use `function` (no inv and no subcontracting).
boost::contract::guard c = boost::contract::function()
boost::contract::check c = boost::contract::function()
.precondition([&] {
BOOST_CONTRACT_ASSERT(ob); // Not null.
})