OSB_LIB::FailPoint Class Reference

Collaboration diagram for OSB_LIB::FailPoint:

Collaboration graph
[legend]
List of all members.

Detailed Description

Force exceptions or core dumps.

This class may be used in white-box testing to force that an OsbException is thrown or the function abort() is called.

For this the source code must be modified to call the function operator of the global object theFailPoint at potential points of failure.

      void foo(const std::string& path)
      {
          int rc = openFile(path);
          if (0 != rc) throw NoFile;
          // temporary add this:
          theFailPoint("foo: openFile");
      }

The application should initialize counter_ and action_ in order to control when failure will be forced.
Note that if initialized with 0, counter_ will contain the number of calls to the function operator.

Definition at line 66 of file osbfail.h.

Public Types

Public Member Functions

Public Attributes


Member Enumeration Documentation

enum OSB_LIB::FailPoint::Action

Throw or abort if counter_ has reached 0?

Enumerator:
aThrow 
aAbort 

Definition at line 69 of file osbfail.h.


Constructor & Destructor Documentation

OSB_LIB::FailPoint::FailPoint (  )  [inline]

Default constructor.

Definition at line 71 of file osbfail.h.


Member Function Documentation

void OSB_LIB::FailPoint::operator() ( const char *  where = 0  ) 

Decrease counter_ and throw/abort if it is 0.


Member Data Documentation

Action OSB_LIB::FailPoint::action_

What to do if counter_ is 0.

Definition at line 76 of file osbfail.h.

int OSB_LIB::FailPoint::counter_

Downwards counter of calls to the function operator().

Definition at line 74 of file osbfail.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:12:07 2006 for OSB Library by  doxygen 1.4.7