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