Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

DbC.h File Reference

Design by Contract framework. More...

#include <assert.h>

Include dependency graph for DbC.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Classes

class  DbC

Defines

#define ASSERT(bool_expression)
#define IS_VALID(obj)   ASSERT((obj) != NULL && (obj)->IsValid())
#define REQUIRE(bool_expression)   ASSERT(bool_expression)
#define ENSURE(bool_expression)   ASSERT(bool_expression)


Detailed Description

Design by Contract framework.

Author:
Stephan Roth
Version:
Revision
1.1
Date:
Date
2005/01/20 21:00:15
Design By Contract (DbC), a trademarked term of Prof. Bertrand Meyer (Department of Computer Science, ETH Zuerich, Switzerland), is a software correctness methodology, which was introduced to object oriented programming with the Eiffel programming language.

Design By Contract (DbC) can dramatically raise software quality and reusability levels by forcing the developer to think in terms of contracts, i.e. agreements between the designer/developer of a software module (class or interface) and the class or interface client (the user). The compliance of such agreements are verified by pre- and postconditions, as well as invariants (an object's valid state).

That means concretely: the client of a class must satisfy the precondition prior to invoking a method. If this condition is fulfilled, the supplier must satisfy the postcondition and class invariant.

This header file contains some macros to apply DbC technique to C++. These macros are only defined in _DEBUG builds, they are defined to blank in the release build.

This DbC framework is based predominantly on an article from the EventHelix web site: http://www.eventhelix.com/RealtimeMantra/Object_Oriented/design_by_contract.htm

License Terms and Conditions
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Disclaimer
This Software and any related documentation is provided "AS IS" without warranty of any kind, either expressed or implied, including and without limitation, the implied warranties or merchantability, fitness for a particular purpose, or non infringement. This Software is not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications.
Oracle is a registered trademark, and Oracle Names, Oracle7, Oracle8i, Oracle9i, Oracle10g, PL/SQL and SQL*Plus are trademarks or registered trademarks of Oracle Corporation. Windows, Windows NT, and Visual C++ are trademarks of Microsoft Corporation. Other names may be trademarks of their respective owners.

Definition in file DbC.h.


Define Documentation

#define ASSERT bool_expression   ) 
 

Value:

if (! (bool_expression)) \
        _assert(#bool_expression, __FILE__, __LINE__ - 1)
This macro aborts the program if the parameter passed to the macro does not evaluate to true

Definition at line 73 of file DbC.h.

#define ENSURE bool_expression   )     ASSERT(bool_expression)
 

This macro checks if the post conditions have been met.

Definition at line 96 of file DbC.h.

Referenced by O3DBIObject::O3DBIObject().

#define IS_VALID obj   )     ASSERT((obj) != NULL && (obj)->IsValid())
 

This macro invokes the virtual IsValid() method to check the consistency of an object (also known as Class invariants).

Definition at line 81 of file DbC.h.

#define REQUIRE bool_expression   )     ASSERT(bool_expression)
 

This macro should be used to check if the pre-conditions for the invoked method have been met.

Definition at line 89 of file DbC.h.




SourceForge.net Logo Generated on Sun Jan 23 11:36:35 2005 for Oracle Object Oriented Database Interface (O3DBI) by  doxygen 1.3.9.1