/////////////////////////////////////////////////////////////////////////////// // 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 _DAI_SPF_FILER_ERROR_HANDLERS_H_ #define _DAI_SPF_FILER_ERROR_HANDLERS_H_ #include "OdaCommon.h" #include "daiBaseType.h" #include "TD_PackPush.h" namespace OdDAI { /** \details Defines the type or error handling */ enum class HandleWorkOrder { /** Fails and stop file reading. */ failAndStop, /** Just continue file reading. */ continueWorking, }; /** \details Defines the type or error handling */ enum class CorruptedParametersWorkOrder { /** Fails and stop file reading. */ failAndStop, /** Parameters parsed manually. Continue reading.*/ instanceFixed, /** Drop instances after processing. Continue reading. */ dropInstance, }; } namespace OdDAI { /** \details An interface that provides functionality for working with read data stream in readonly mode. */ class IBufferDataProvider { public: /** \details Reads current char \returns a char from the current cursor */ virtual char getCurrentChar() const = 0; /** \details Moves cursor to the next position. \returns EoF state. False if current position in not at EoF, otherwise false. */ virtual bool goToNextChar() = 0; }; /** \details A interface that handles wrong entity state. Handles the abnormal situation when we read name of the entity but can not create entity instance for it. */ class IWrongEntityFixTool { public: /** \details Provides the model for the error handling. \returns the model for the error handling. */ virtual OdDAI::Model& getModel() = 0; /** \details Provides the read only data buffer provider. \returns read only data buffer provider. */ virtual IBufferDataProvider& getBufferDataProvider() = 0; /** \details Continies read instance using entity name. \param fixedTypeName [in] fixed instance type name. \returns true if suceeded; otherwise false. */ virtual bool tryCreateAndReadInstanceByName(const char* fixedTypeName) = 0; /** \details Continies read instance using created entity instance. \param instanceReadTo [in] created entity instance. \returns true if suceeded; otherwise false. */ virtual bool justReadInstanceParams(OdDAI::ApplicationInstancePtr instanceReadTo) = 0; /** \details Just add created instacen to model. Instance should be added with handle from file. \param fixedInstance [in] Instance to add. \returns true if suceeded; otherwise false. */ virtual bool addInstance(OdDAI::ApplicationInstancePtr fixedInstance) = 0; }; } #include "TD_PackPop.h" #endif // _DAI_SPF_FILER_ERROR_PROCESSOR_H_