eoRealInterval better error handling
Replace a logic exception in eoRealInterval by an assert. Add a warning in debug mode when the range is null.
This commit is contained in:
parent
7428b36608
commit
6f13853f27
1 changed files with 9 additions and 4 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
#ifndef _eoRealBounds_h
|
#ifndef _eoRealBounds_h
|
||||||
#define _eoRealBounds_h
|
#define _eoRealBounds_h
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
#include <stdexcept> // std::exceptions!
|
#include <stdexcept> // std::exceptions!
|
||||||
#include <utils/eoRNG.h>
|
#include <utils/eoRNG.h>
|
||||||
|
|
||||||
|
|
@ -226,10 +227,14 @@ public :
|
||||||
*/
|
*/
|
||||||
eoRealInterval(double _min=0, double _max=1) :
|
eoRealInterval(double _min=0, double _max=1) :
|
||||||
repMinimum(_min), repMaximum(_max), repRange(_max-_min)
|
repMinimum(_min), repMaximum(_max), repRange(_max-_min)
|
||||||
{
|
{
|
||||||
if (repRange<=0)
|
assert( repRange >= 0 );
|
||||||
throw std::logic_error("Void range in eoRealBounds");
|
#ifndef NDEBUG
|
||||||
}
|
if( repRange == 0 ) {
|
||||||
|
eo::log << eo::warnings << "Null range in eoRealBounds (min=" << _min << ", max=" << _max << ")" << std::endl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// accessors
|
// accessors
|
||||||
virtual double minimum() const { return repMinimum; }
|
virtual double minimum() const { return repMinimum; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue