Putting this function first so we can reference the code in doxygen using @skip @brief Check whether FloatNode class invariant is true @copydetails IntegerNode::checkInvariant()
| 38 | /// @brief Check whether FloatNode class invariant is true |
| 39 | /// @copydetails IntegerNode::checkInvariant() |
| 40 | void FloatNode::checkInvariant( bool /*doRecurse*/, bool doUpcast ) const |
| 41 | { |
| 42 | // If destImageFile not open, can't test invariant (almost every call would throw) |
| 43 | if ( !destImageFile().isOpen() ) |
| 44 | { |
| 45 | return; |
| 46 | } |
| 47 | |
| 48 | // If requested, call Node::checkInvariant |
| 49 | if ( doUpcast ) |
| 50 | { |
| 51 | static_cast<Node>( *this ).checkInvariant( false, false ); |
| 52 | } |
| 53 | |
| 54 | if ( precision() == PrecisionSingle ) |
| 55 | { |
| 56 | if ( static_cast<float>( minimum() ) < FLOAT_MIN || |
| 57 | static_cast<float>( maximum() ) > FLOAT_MAX ) |
| 58 | { |
| 59 | throw E57_EXCEPTION1( ErrorInvarianceViolation ); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // If value is out of bounds |
| 64 | if ( value() < minimum() || value() > maximum() ) |
| 65 | { |
| 66 | throw E57_EXCEPTION1( ErrorInvarianceViolation ); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /*! |
| 71 | @class e57::FloatNode |