MCPcopy Create free account
hub / github.com/PDAL/PDAL / checkInvariant

Method checkInvariant

plugins/e57/libE57Format/src/ScaledIntegerNode.cpp:42–73  ·  view source on GitHub ↗

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() */

Source from the content-addressed store, hash-verified

40@copydetails IntegerNode::checkInvariant()
41*/
42void 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

Callers

nothing calls this directly

Calls 4

minimumFunction · 0.85
maximumFunction · 0.85
offsetFunction · 0.50
isOpenMethod · 0.45

Tested by

no test coverage detected