Rev | Line | |
---|
[176] | 1 | // -*- C++ -*- |
---|
| 2 | |
---|
| 3 | #ifndef _CHECK_H_ |
---|
| 4 | #define _CHECK_H_ |
---|
| 5 | |
---|
| 6 | template <class TYPE, class CHECK> |
---|
| 7 | class Check { |
---|
| 8 | public: |
---|
| 9 | Check (TYPE * t) |
---|
| 10 | #ifndef NDEBUG |
---|
| 11 | : _object (t) |
---|
| 12 | #endif |
---|
| 13 | { |
---|
| 14 | t = t; // avoid warning |
---|
| 15 | #ifndef NDEBUG |
---|
| 16 | CHECK::precondition (_object); |
---|
| 17 | #endif |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | ~Check (void) { |
---|
| 21 | #ifndef NDEBUG |
---|
| 22 | CHECK::postcondition (_object); |
---|
| 23 | #endif |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | private: |
---|
| 27 | Check (const Check&); |
---|
| 28 | Check& operator=(const Check&); |
---|
| 29 | |
---|
| 30 | #ifndef NDEBUG |
---|
| 31 | TYPE * _object; |
---|
| 32 | #endif |
---|
| 33 | |
---|
| 34 | }; |
---|
| 35 | |
---|
| 36 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.