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

Method checkInvariant

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

Put this function first so we can reference the code in doxygen using @skip ! @brief Check whether CompressedVectorWriter class invariant is true @copydetails CompressedVectorReader::checkInvariant */

Source from the content-addressed store, hash-verified

40@copydetails CompressedVectorReader::checkInvariant
41*/
42void CompressedVectorWriter::checkInvariant( bool /*doRecurse*/ )
43{
44 // If this CompressedVectorWriter is not open, can't test invariant (almost
45 // every call would throw)
46 if ( !isOpen() )
47 {
48 return;
49 }
50
51 CompressedVectorNode cv = compressedVectorNode();
52 ImageFile imf = cv.destImageFile();
53
54 // If destImageFile not open, can't test invariant (almost every call would
55 // throw)
56 if ( !imf.isOpen() )
57 {
58 return;
59 }
60
61 // Associated CompressedVectorNode must be attached to ImageFile
62 if ( !cv.isAttached() )
63 {
64 throw E57_EXCEPTION1( ErrorInvarianceViolation );
65 }
66
67 // Dest ImageFile must be writable
68 if ( !imf.isWritable() )
69 {
70 throw E57_EXCEPTION1( ErrorInvarianceViolation );
71 }
72
73 // Dest ImageFile must have exactly 1 writer (this one)
74 if ( imf.writerCount() != 1 )
75 {
76 throw E57_EXCEPTION1( ErrorInvarianceViolation );
77 }
78
79 // Dest ImageFile can't have any readers
80 if ( imf.readerCount() != 0 )
81 {
82 throw E57_EXCEPTION1( ErrorInvarianceViolation );
83 }
84}
85
86/*!
87@class e57::CompressedVectorWriter

Callers

nothing calls this directly

Calls 7

isOpenFunction · 0.85
isWritableMethod · 0.80
destImageFileMethod · 0.45
isOpenMethod · 0.45
isAttachedMethod · 0.45
writerCountMethod · 0.45
readerCountMethod · 0.45

Tested by

no test coverage detected