SourceForge.net Logo timeSeries: timeSeries Class Library

Dimension_error Class Reference
[timeSeries objects]

dimension error exception More...

#include <tsExceptions.h>

Inherits tsException.

Collaboration diagram for Dimension_error:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Dimension_error (std::string p, std::string n1, std::string n2, const int dim1, const int dim2)
void debug_print ()

Detailed Description

dimension error exception

Thrown when the vector dimension of two timeSeriesArray objects in an arithmetic operation are not the same.


Constructor & Destructor Documentation

Dimension_error::Dimension_error ( std::string  p,
std::string  n1,
std::string  n2,
const int  dim1,
const int  dim2 
) [inline]
Parameters:
p a string describing the offending operation
n1 the name of a timeSeriesArray
n2 the name of a timeSeriesArray
dim1 the dimension of timeSeriesArray n1
dim2 the dimension of timeSeriesArray n2

The information used to construct the Dimension_error exception can be used by the debug_print method to generate readable error messages for the user

Example: the timeSeriesArray + operator can throw Dimension_error:
         if (d.get_nElem() != ts.get_nElem()) {
             throw Dimension_error("+",d.varName,ts.varName,
                                   d.get_nElem(),ts.get_nElem());
         }

Member Function Documentation

void Dimension_error::debug_print (  )  [inline, virtual]

error message

Example:
This code:
        try {
            timeSeriesArray<float> lanedev("SCC_Lane_Deviation",data);
            timeSeriesArray<float> objhead("SCC_DynObj_Heading",data);
            
            timeSeriesArray<float> bad = lanedev + objhead;
        }
        catch (tsException& tse) {
            tse.debug_print();
            cerr << "skipping to next file..." << endl;
        }
Results in this error message:
		Illegal operation: (+) SCC_Lane_Deviation has dimension 4
		                       SCC_DynObj_Heading has dimension 20
		skipping to next file...
		

Reimplemented from tsException.

Generated on Tue Mar 16 15:10:52 2010 for timeSeries by  doxygen 1.6.3