Dimension mismatch during construction. More...
#include <tsExceptions.h>
Inherits tsException.
Public Member Functions | |
BadDimension (std::string oc, std::string fn, int d) | |
void | debug_print () |
Dimension mismatch during construction.
Thrown when an attempt is made to construct a timeSeries object from a timeSeriesArray field. This exception is also thrown when attempting to construct a timeSeriesArray object from a timeSeries field.
BadDimension::BadDimension | ( | std::string | oc, | |
std::string | fn, | |||
int | d | |||
) | [inline] |
oc | a string containing either "timeSeries" or "timeSeriesArray" | |
fn | a string containin the name of the field | |
d | an integer containing the dimension of the field |
The information used to construct the BadDimension exception can be used by the debug_print method to generate readable error messages for the user
void BadDimension::debug_print | ( | ) | [inline, virtual] |
error message
If the data definition for field CFS_Auto_Transmission_Mode specifies a dimension of 1 then the following code will generate a BadDimension exception:
try { timeSeriesArray<short> prndl("CFS_Auto_Transmission_Mode",data); } catch (tsException& tse) { tse.debug_print(); cerr << "skipping to next file..." << endl; }
Results in this error message:
Illegal Construction: attempt to construct a timeSeriesArray from data field "CFS_Auto_Transmission_Mode" of dimension 1 skipping to next file...
Similarly, if the data definition for field SCC_Lane_Deviation specifies a dimension of 4, then this code is also in error:
try { timeSeries<float> lanedev("SCC_Lane_Deviation",data); } catch (tsException& tse) { tse.debug_print(); cerr << "skipping to next file..." << endl; }
Results in this error message:
Illegal Construction: attempt to construct a timeSeries from data field "SCC_Lane_Deviation" of dimension 4 skipping to next file...
Reimplemented from tsException.