SourceForge.net Logo timeSeries: timeSeries Class Library

Length_error Class Reference
[timeSeries objects]

length error exception More...

#include <tsExceptions.h>

Inherits tsException.

Collaboration diagram for Length_error:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Length_error (std::string p, std::string n1, std::string n2, const int len1, const int len2)
void debug_print ()

Detailed Description

length error exception

Thrown when the sample length of two timeSeries objects in a comparison or arithmetic operation are not the same.


Constructor & Destructor Documentation

Length_error::Length_error ( std::string  p,
std::string  n1,
std::string  n2,
const int  len1,
const int  len2 
) [inline]
Parameters:
p a string describing the offending operation
n1 the name of a timeSeries
n2 the name of a timeSeries
len1 the length of timeSeries n1
len2 the length of timeSeries n2

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

Example: The timeSeries > operator can throw a Length_error:
         if (d.length() != ts.length()) {
             throw Length_error(">",d.varName,ts.varName,d.length(),ts.length());
         }      

Member Function Documentation

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

error message

Example:
This code:
        try {
            timeSeries<float> throttle("CFS_Accelerator_Pedal_Position",data);
            timeSeries<float> swa("CFS_Steering_Wheel_Angle",data); 

            boolResult bad = (throttle > swa.range(0,50));
        }
        catch (tsException& tse) {
            tse.debug_print();
            cerr << "skipping to next file..." << endl;
        }
Results in this error message:
		Illegal operation: (>) CFS_Accelerator_Pedal_Position has length 6952
		                       CFS_Steering_Wheel_Angle has length 51
		skipping to next file...
		

Reimplemented from tsException.

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