111 E57Exception::E57Exception(
ErrorCode ecode,
const std::string &
context,
const std::string &srcFileName,
112 int srcLineNumber,
const char *srcFunctionName ) :
113 errorCode_( ecode ), context_(
context ), sourceFunctionName_( srcFunctionName ),
114 sourceLineNumber_( srcLineNumber )
116 sourceFileName_ = srcFileName.substr( srcFileName.find_last_of(
"/\\" ) + 1 );
137 void E57Exception::report(
const char *reportingFileName,
int reportingLineNumber,
const char *reportingFunctionName,
138 std::ostream &os )
const
144 os <<
" context: " << context_ <<
std::endl;
145 os <<
" sourceFunctionName: " << sourceFunctionName_ <<
std::endl;
146 if ( reportingFunctionName !=
nullptr )
147 os <<
" reportingFunctionName: " << reportingFunctionName <<
std::endl;
151 os << sourceFileName_ <<
"(" << sourceLineNumber_ <<
") : error C" << errorCode_ <<
": <--- occurred on"
153 if ( reportingFileName !=
nullptr )
154 os << reportingFileName <<
"(" << reportingLineNumber <<
") : error C0: <--- reported on" <<
std::endl;
197 const char *E57Exception::what() const noexcept
199 return "E57 exception";
213 const char *E57Exception::sourceFileName()
const
215 return sourceFileName_.c_str();
230 const char *E57Exception::sourceFunctionName()
const
232 return sourceFunctionName_;
247 int E57Exception::sourceLineNumber()
const
249 return sourceLineNumber_;
274 #error "Need to specify REVISION_ID on command line"
279 libraryId = REVISION_ID;
298 return "operation was successful (E57_SUCCESS)";
300 return "a CompressedVector binary header was bad "
301 "(E57_ERROR_BAD_CV_HEADER)";
303 return "a CompressedVector binary packet was bad "
304 "(E57_ERROR_BAD_CV_PACKET)";
306 return "a numerical index identifying a child was out of bounds "
307 "(E57_ERROR_CHILD_INDEX_OUT_OF_BOUNDS)";
309 return "attempted to set an existing child element to a new value "
310 "(E57_ERROR_SET_TWICE)";
312 return "attempted to add an E57 Element that would have made the "
314 "homogenous Vector have different types "
315 "(E57_ERROR_HOMOGENEOUS_VIOLATION)";
317 return "a value could not be represented in the requested type "
318 "(E57_ERROR_VALUE_NOT_REPRESENTABLE)";
320 return "after scaling the result could not be represented in the "
322 "(E57_ERROR_SCALED_VALUE_NOT_REPRESENTABLE)";
324 return "a 64 bit IEEE float was too large to store in a 32 bit IEEE "
326 "(E57_ERROR_REAL64_TOO_LARGE)";
328 return "Expecting numeric representation in user's buffer, found "
330 "(E57_ERROR_EXPECTING_NUMERIC)";
332 return "Expecting string representation in user's buffer, found "
334 "(E57_ERROR_EXPECTING_USTRING)";
336 return "An unrecoverable inconsistent internal state was detected "
337 "(E57_ERROR_INTERNAL)";
339 return "E57 primitive not encoded in XML correctly "
340 "(E57_ERROR_BAD_XML_FORMAT)";
342 return "XML not well formed (E57_ERROR_XML_PARSER)";
344 return "bad API function argument provided by user "
345 "(E57_ERROR_BAD_API_ARGUMENT)";
347 return "can't modify read only file (E57_ERROR_FILE_IS_READ_ONLY)";
349 return "checksum mismatch, file is corrupted (E57_ERROR_BAD_CHECKSUM)";
351 return "open() failed (E57_ERROR_OPEN_FAILED)";
353 return "close() failed (E57_ERROR_CLOSE_FAILED)";
355 return "read() failed (E57_ERROR_READ_FAILED)";
357 return "write() failed (E57_ERROR_WRITE_FAILED)";
359 return "lseek() failed (E57_ERROR_LSEEK_FAILED)";
361 return "E57 element path well formed but not defined "
362 "(E57_ERROR_PATH_UNDEFINED)";
364 return "bad SourceDestBuffer (E57_ERROR_BAD_BUFFER)";
366 return "no buffer specified for an element in CompressedVectorNode "
368 "(E57_ERROR_NO_BUFFER_FOR_ELEMENT)";
370 return "SourceDestBuffers not all same size "
371 "(E57_ERROR_BUFFER_SIZE_MISMATCH)";
373 return "duplicate pathname in CompressedVectorNode read/write "
374 "(E57_ERROR_BUFFER_DUPLICATE_PATHNAME)";
376 return "file signature not "
378 " (E57_ERROR_BAD_FILE_SIGNATURE)";
380 return "incompatible file version (E57_ERROR_UNKNOWN_FILE_VERSION)";
382 return "size in file header not same as actual "
383 "(E57_ERROR_BAD_FILE_LENGTH)";
385 return "XML parser failed to initialize (E57_ERROR_XML_PARSER_INIT)";
387 return "namespace prefix already defined "
388 "(E57_ERROR_DUPLICATE_NAMESPACE_PREFIX)";
390 return "namespace URI already defined "
391 "(E57_ERROR_DUPLICATE_NAMESPACE_URI)";
393 return "bad prototype in CompressedVectorNode "
394 "(E57_ERROR_BAD_PROTOTYPE)";
396 return "bad codecs in CompressedVectorNode (E57_ERROR_BAD_CODECS)";
398 return "element value out of min/max bounds "
399 "(E57_ERROR_VALUE_OUT_OF_BOUNDS)";
401 return "conversion required to assign element value, but not "
403 "(E57_ERROR_CONVERSION_REQUIRED)";
405 return "E57 path name is not well formed (E57_ERROR_BAD_PATH_NAME)";
407 return "functionality not implemented (E57_ERROR_NOT_IMPLEMENTED)";
409 return "bad downcast from Node to specific node type "
410 "(E57_ERROR_BAD_NODE_DOWNCAST)";
412 return "CompressedVectorWriter is no longer open "
413 "(E57_ERROR_WRITER_NOT_OPEN)";
415 return "CompressedVectorReader is no longer open "
416 "(E57_ERROR_READER_NOT_OPEN)";
418 return "node is not yet attached to tree of ImageFile "
419 "(E57_ERROR_NODE_UNATTACHED)";
421 return "node already has a parent (E57_ERROR_ALREADY_HAS_PARENT)";
423 return "nodes were constructed with different destImageFiles "
424 "(E57_ERROR_DIFFERENT_DEST_IMAGEFILE)";
426 return "destImageFile is no longer open "
427 "(E57_ERROR_IMAGEFILE_NOT_OPEN)";
429 return "SourceDestBuffers not compatible with previously given ones "
430 "(E57_ERROR_BUFFERS_NOT_COMPATIBLE)";
432 return "too many open CompressedVectorWriters of an ImageFile "
433 "(E57_ERROR_TOO_MANY_WRITERS)";
435 return "too many open CompressedVectorReaders of an ImageFile "
436 "(E57_ERROR_TOO_MANY_READERS)";
438 return "bad configuration string (E57_ERROR_BAD_CONFIGURATION)";
440 return "class invariance constraint violation in debug mode "
441 "(E57_ERROR_INVARIANCE_VIOLATION)";
QTextStream & endl(QTextStream &stream)
E57_DLL std::string errorCodeToString(ErrorCode ecode)
Get short string description of an E57 ErrorCode.
E57_DLL void getVersions(int &astmMajor, int &astmMinor, std::string &libraryId)
Get the version of ASTM E57 standard that the API implementation supports, and library id string.
constexpr uint32_t E57_FORMAT_MAJOR
Version numbers of ASTM standard that this library supports.
ErrorCode
Numeric error identifiers used in E57Exception.
@ E57_ERROR_FILE_IS_READ_ONLY
can't modify read only file
@ E57_ERROR_TOO_MANY_READERS
too many open CompressedVectorReaders of an ImageFile
@ E57_ERROR_BUFFERS_NOT_COMPATIBLE
SourceDestBuffers not compatible with previously given ones.
@ E57_SUCCESS
operation was successful
@ E57_ERROR_CONVERSION_REQUIRED
conversion required to assign element value, but not requested
@ E57_ERROR_BUFFER_DUPLICATE_PATHNAME
duplicate pathname in CompressedVectorNode read/write
@ E57_ERROR_READ_FAILED
read() failed
@ E57_ERROR_INTERNAL
An unrecoverable inconsistent internal state was detected.
@ E57_ERROR_VALUE_OUT_OF_BOUNDS
element value out of min/max bounds
@ E57_ERROR_OPEN_FAILED
open() failed
@ E57_ERROR_BAD_NODE_DOWNCAST
bad downcast from Node to specific node type
@ E57_ERROR_SET_TWICE
attempted to set an existing child element to a new value
@ E57_ERROR_BAD_API_ARGUMENT
bad API function argument provided by user
@ E57_ERROR_BAD_FILE_SIGNATURE
file signature not "ASTM-E57"
@ E57_ERROR_WRITE_FAILED
write() failed
@ E57_ERROR_HOMOGENEOUS_VIOLATION
@ E57_ERROR_NO_BUFFER_FOR_ELEMENT
@ E57_ERROR_NODE_UNATTACHED
node is not yet attached to tree of ImageFile
@ E57_ERROR_BAD_PROTOTYPE
bad prototype in CompressedVectorNode
@ E57_ERROR_REAL64_TOO_LARGE
a 64 bit IEEE float was too large to store in a 32 bit IEEE float
@ E57_ERROR_XML_PARSER_INIT
XML parser failed to initialize.
@ E57_ERROR_BAD_CV_PACKET
a CompressedVector binary packet was bad
@ E57_ERROR_BAD_CHECKSUM
checksum mismatch, file is corrupted
@ E57_ERROR_CHILD_INDEX_OUT_OF_BOUNDS
a numerical index identifying a child was out of bounds
@ E57_ERROR_IMAGEFILE_NOT_OPEN
destImageFile is no longer open
@ E57_ERROR_BAD_XML_FORMAT
E57 primitive not encoded in XML correctly.
@ E57_ERROR_NOT_IMPLEMENTED
functionality not implemented
@ E57_ERROR_XML_PARSER
XML not well formed.
@ E57_ERROR_EXPECTING_NUMERIC
Expecting numeric representation in user's buffer, found ustring.
@ E57_ERROR_BUFFER_SIZE_MISMATCH
SourceDestBuffers not all same size.
@ E57_ERROR_BAD_CODECS
bad codecs in CompressedVectorNode
@ E57_ERROR_TOO_MANY_WRITERS
too many open CompressedVectorWriters of an ImageFile
@ E57_ERROR_BAD_FILE_LENGTH
size in file header not same as actual
@ E57_ERROR_ALREADY_HAS_PARENT
node already has a parent
@ E57_ERROR_UNKNOWN_FILE_VERSION
incompatible file version
@ E57_ERROR_INVARIANCE_VIOLATION
class invariance constraint violation in debug mode
@ E57_ERROR_READER_NOT_OPEN
CompressedVectorReader is no longer open.
@ E57_ERROR_VALUE_NOT_REPRESENTABLE
a value could not be represented in the requested type
@ E57_ERROR_BAD_CV_HEADER
a CompressedVector binary header was bad
@ E57_ERROR_CLOSE_FAILED
close() failed
@ E57_ERROR_BAD_CONFIGURATION
bad configuration string
@ E57_ERROR_DIFFERENT_DEST_IMAGEFILE
nodes were constructed with different destImageFiles
@ E57_ERROR_WRITER_NOT_OPEN
CompressedVectorWriter is no longer open.
@ E57_ERROR_SCALED_VALUE_NOT_REPRESENTABLE
@ E57_ERROR_BAD_BUFFER
bad SourceDestBuffer
@ E57_ERROR_BAD_PATH_NAME
E57 path name is not well formed.
@ E57_ERROR_EXPECTING_USTRING
Expecting string representation in user's buffer, found numeric.
@ E57_ERROR_DUPLICATE_NAMESPACE_PREFIX
namespace prefix already defined
@ E57_ERROR_LSEEK_FAILED
lseek() failed
@ E57_ERROR_PATH_UNDEFINED
E57 element path well formed but not defined.
@ E57_ERROR_DUPLICATE_NAMESPACE_URI
namespace URI already defined
constexpr uint32_t E57_FORMAT_MINOR
std::string to_string(const T &n)