Tagcoll::ValOutOfRangeException< C > Class Template Reference

Exception thrown when index checking fails. More...

#include <Exception.h>

Inheritance diagram for Tagcoll::ValOutOfRangeException< C >:

Inheritance graph
[legend]
Collaboration diagram for Tagcoll::ValOutOfRangeException< C >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ValOutOfRangeException (const std::string &context, const std::string &var_desc, C val, C inf, C sup) throw ()
 Construct the exception; minBound and maxBound are the bounds of the valid index range (inclusive).
virtual const char * type () const throw ()
 Get a string tag identifying the exception type.
virtual std::string desc () const throw ()
 Get a string describing what happened that threw the exception.
Methods used to get informations about the index and its bounds
virtual C val () const throw ()
 Get the value that caused the index to go out-of-bounds.
virtual C inf () const throw ()
 Get the minimum allowed value for this index.
virtual C sup () const throw ()
 Get the maximum allowed value for this index.

Protected Attributes

_val
_inf
_sup

Detailed Description

template<class C>
class Tagcoll::ValOutOfRangeException< C >

Exception thrown when index checking fails.

This exception is to be thrown when an index checking fails, providing informations on the acceptable index range and on the offending value. The context should be a description of the index, possibly preceeded by a description of in what context did the index checking happen.

Example:

  if (age < 18)
     throw IndexOutOfRangeException(age, 18, 0,
                                "obtaining driver license, age");

  if (i < 0 || i > 100)
    throw IndexOutOfRangeException(i, 0, 100, "percentage of items sold");


Constructor & Destructor Documentation

template<class C>
Tagcoll::ValOutOfRangeException< C >::ValOutOfRangeException ( const std::string &  context,
const std::string &  var_desc,
val,
inf,
sup 
) throw () [inline]

Construct the exception; minBound and maxBound are the bounds of the valid index range (inclusive).


Member Function Documentation

template<class C>
virtual C Tagcoll::ValOutOfRangeException< C >::val (  )  const throw () [inline, virtual]

Get the value that caused the index to go out-of-bounds.

template<class C>
virtual C Tagcoll::ValOutOfRangeException< C >::inf (  )  const throw () [inline, virtual]

Get the minimum allowed value for this index.

template<class C>
virtual C Tagcoll::ValOutOfRangeException< C >::sup (  )  const throw () [inline, virtual]

Get the maximum allowed value for this index.

template<class C>
virtual const char* Tagcoll::ValOutOfRangeException< C >::type (  )  const throw () [inline, virtual]

Get a string tag identifying the exception type.

Reimplemented from Tagcoll::OutOfRangeException.

template<class C>
virtual std::string Tagcoll::ValOutOfRangeException< C >::desc (  )  const throw () [inline, virtual]

Get a string describing what happened that threw the exception.

Reimplemented from Tagcoll::OutOfRangeException.


Member Data Documentation

template<class C>
C Tagcoll::ValOutOfRangeException< C >::_val [protected]

template<class C>
C Tagcoll::ValOutOfRangeException< C >::_inf [protected]

template<class C>
C Tagcoll::ValOutOfRangeException< C >::_sup [protected]


The documentation for this class was generated from the following file:
Generated on Sat Jan 17 03:38:09 2009 for libtagcoll by  doxygen 1.5.1