///////////////////////////////////////////////////////////////////////////////
// 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_PROCESSOR_H_
#define _DAI_SPF_FILER_ERROR_PROCESSOR_H_
#include "OdaCommon.h"
#include "daiBaseType.h"
#include "daiFilerErrorHandlers.h"
#include "RxObject.h"
#include "RxObjectImpl.h"
#include "TD_PackPush.h"
/** \details
Implements the Data Access Interface (DAI) that provides functionality for manipulating data that is defined within the EXPRESS SCHEMA format.
*/
namespace OdDAI
{
class Model;
/** \details
A base class that should be used during read file error.
*/
class DAI_EXPORT FilerErrorProcessorPE
: public OdRxObject
{
public:
ODRX_DECLARE_MEMBERS(FilerErrorProcessorPE);
/** \details
Handles unknown entity name state.
\param entityTypeName [in] Abnormal entity name from read buffer.
\param fixTool [in] Tools for fixing abnormal situation.
\returns an enum HandleWorkOrder.
*/
virtual HandleWorkOrder unknownTypeEntity(const char* entityTypeName, IWrongEntityFixTool& fixTool) = 0;
/** \details
Handles none instanctiable entity state.
\param entityTypeName [in] None instantiable entity name from read buffer.
\param fixTool [in] Tools for fixing this abnormal situation.
\returns an enum HandleWorkOrder.
*/
virtual HandleWorkOrder nonInstantiableEntity(const char* entityTypeName, IWrongEntityFixTool& fixTool) = 0;
/** \details
Provides a handler to process corrupted start parameters state.
\param instanceToFill [in] Instance for what we can not read parameters.
\param model [in] Model to get access to other created instances and schema objects.
\param readOnlyFileBuffer [in] Read only buffer to try read manually or fix parameters reading.
\returns an enum HandleWorkOrder.
*/
virtual CorruptedParametersWorkOrder corruptedParametersCustomRead(OdDAI::ApplicationInstancePtr& instanceToFill,
OdDAI::Model* model,
IBufferDataProvider& readOnlyFileBuffer) = 0;
/** \details
Tries to process situation with duplicate instance.
\param model [in] The filling model.
\param handle [in] Not unique handle.
\param alreadyAdded [in] The instance already added.
\param instanceToAdd [in] The new instance with the same handle.
\returns true if the file reading should be continued
and false otherwise.
*/
virtual HandleWorkOrder duplicateHandle(OdDAI::Model* model,
OdDbHandle& handle,
OdDAI::ApplicationInstancePtr& alreadyAdded,
OdDAI::ApplicationInstancePtr& instanceToAdd) = 0;
/** \details
Provides a handler to process syntax error state
\returns a handler to process error. If the function
returns nullptr the handling does not run and exception occurs.
*/
virtual HandleWorkOrder syntaxErrorAction(IBufferDataProvider& readOnlyFileBuffer) = 0;
/** \details
This function should be called before the file reading.
\param model [in] A model read to.
*/
virtual void onStartReading(Model* model) = 0;
/** \details
This function should be called after the file reading.
\param model [in] A model read to.
\param executionResult [out] Receives the result code of the method execution.
*/
virtual void onFinishReading(Model* model, OdResult executionResult) = 0;
};
/** \details
A data type that represents a smart pointer to an object.
*/
typedef OdSmartPtr FilerErrorProcessorPEPtr;
}
#include "TD_PackPop.h"
#endif // _DAI_SPF_FILER_ERROR_PROCESSOR_H_