- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Utils/Exceptions/ArrayIndexOutOfBoundsException.cpp

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014 #include "ArrayIndexOutOfBoundsException.h"
    00015 using std::endl;
    00016
    00017 using Mers::Utils::Exceptions::ArrayIndexOutOfBoundsException;
    00018 using Mers::Utils::Lang::String;
    00019
    00021 // Construction/Destruction
    00023
    00024 ArrayIndexOutOfBoundsException::ArrayIndexOutOfBoundsException(
    00025         unsigned int lowerBound, unsigned int upperBound,
    00026         unsigned int index, char const * fileName, unsigned int lineNumber)
    00027         throw()
    00028 {
    00029         String s;
    00030         // Sufficient amount of space that no number can be larger.
    00031         char val[100];
    00032
    00033         if(fileName != NULL){
    00034                 s = fileName;
    00035                 s += '(';
    00036                 sprintf(val, "%u", lineNumber);
    00037                 s += val;
    00038                 s += "): ";
    00039         }
    00040
    00041         s += "Array Out Of Bounds Exception: ";
    00042         sprintf(val, "%u", index);
    00043         s += val;
    00044         s += " not in [";
    00045         sprintf(val, "%u", lowerBound);
    00046         s += val;
    00047         s += ", ";
    00048         sprintf(val, "%u", upperBound);
    00049         s += val;
    00050         s += ']';
    00051
    00052         setMessage(s);
    00053 }
    00054
    00056
    00057 ArrayIndexOutOfBoundsException::~ArrayIndexOutOfBoundsException() throw()
    00058 {
    00059
    00060 }
    00061
    00063