Logo Search packages:      
Sourcecode: launchtool version File versions  Download package

ValOutOfRangeException< C > Class Template Reference

#include <Exception.h>

Inheritance diagram for ValOutOfRangeException< C >:

ConsistencyCheckException ContextException Exception

List of all members.

Detailed Description

template<class C>
class 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.


  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");

Definition at line 216 of file Exception.h.

Public Member Functions

virtual std::string context () const throw ()
virtual std::string desc () const throw ()
 Get a string describing what happened that threw the exception.
virtual const char * type () const throw ()
 Get a string tag identifying the exception type.
 ValOutOfRangeException (const std::string &context, const std::string &var_desc, C val, C inf, C sup) throw ()
virtual std::string var_desc () const throw ()
 Get a short description of the variable that has been checked.
Methods used to get informations about the index and its 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.
virtual C val () const throw ()
 Get the value that caused the index to go out-of-bounds.

Protected Attributes

std::string _context
std::string _var_desc

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index