/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef _ERROR_LIST_OUTPUT_H_ #define _ERROR_LIST_OUTPUT_H_ void odPrintConsoleString(const OdChar* fmt, ...); namespace Utils { // // Result codes // enum ReadResult { readOK = 0, readINVALID_ARGUMENTS, readCAN_NOT_LOAD_SDAI, readCAN_NOT_CREATE_SESSION, readSPF_FILE_ACCESS_ERROR, readCAN_NOT_ACCESS_FILE_SCHEMA, readSCHEMA_NOT_SUPPORTED, readSCHEMA_INITIALIZATION_FAILED, readERROR, readUNEXPECTED_ERROR, }; using ResultPair = std::pair; const ResultPair res_OK(readOK, "Everything's ok"); const ResultPair res_INVALID_ARGUMENTS(readINVALID_ARGUMENTS, "Invalid arguments"); const ResultPair res_CAN_NOT_LOAD_SDAI(readCAN_NOT_LOAD_SDAI, "Can not load sdai.tx module. Investigate _TOOLKIT_IN_DLL_ and ODRX_INIT_STATIC_MODULE_MAP defines if example is started in static configuration"); const ResultPair res_CAN_NOT_CREATE_SESSION(readCAN_NOT_CREATE_SESSION, "Can not create SDAI session. Probably ODA SDK is not initialized properly"); const ResultPair res_SPF_FILE_ACCESS_ERROR(readSPF_FILE_ACCESS_ERROR, "Step Physical File access/loading error."); const ResultPair res_CAN_NOT_ACCESS_FILE_SCHEMA(readCAN_NOT_ACCESS_FILE_SCHEMA, "Can not access FILE_SCHEMA in header section of a Step Physical File"); const ResultPair res_SCHEMA_NOT_SUPPORTED(readSCHEMA_NOT_SUPPORTED, "Schema is not supported by this implementation. Additional schemas can be added in EXPRESS Runtime mode, see findSchema() function"); const ResultPair res_SCHEMA_INITIALIZATION_FAILED(readSCHEMA_INITIALIZATION_FAILED, "Schema initialization failed"); const ResultPair res_ERROR(readERROR, "Internal error"); const ResultPair res_UNEXPECTED_ERROR(readUNEXPECTED_ERROR, "Unexpected error"); const OdString actionNameErrorEvent = "[ERROR EVENT ]"; const OdString actionNameBlank = "[ ]"; const OdString actionNameErrorEventList = "[ERROR EVENT LIST ]"; const OdString actionNameSessionEventRec = "[SESSION EVENT RECORDING ]"; const OdString actionNameEventParamRead = "[EVENT PARAM READ ]"; void errorEventListOutput(OdDAI::List* errorsList) { ODA_ASSERT(errorsList); if (!errorsList) { return; } const OdArray& errorsArray = errorsList->getArray(); if (errorsArray.isEmpty()) { odPrintConsoleString(L"%s - there is not any error events.\n", actionNameErrorEventList.c_str()); } for (auto& error : errorsArray) { OdString description(error->description()); description.remove('\n'); odPrintConsoleString(L"\n%s - error event detected, see information below\n%s Error Id: %d (%hs) \n%s Description: \'%s\' \n%s Function: \'%s\'", actionNameErrorEvent.c_str(), actionNameBlank.c_str(), error->error(), OdDAI::errorCodeToStr(error->error()), actionNameBlank.c_str(), description.c_str(), actionNameBlank.c_str(), OdString(error->functionId()).c_str()); } odPrintConsoleString(L"\n"); } } #endif // _ERROR_LIST_OUTPUT_H_