///////////////////////////////////////////////////////////////////////////////
// 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_VALIDATION_NOTIFIER_H
#define _DAI_VALIDATION_NOTIFIER_H
#include "daiInstanceValidationTask.h"
#include "daiApplicationInstance.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
{
/** \details
A structure that stores extra information sent within a validation notification.
*/
struct NotifierExtraInfo
{
/** \details
The name of the file that contains data that is being validated.
*/
OdAnsiString fileName;
/** \details
The name of the model's underlying schema.
*/
OdAnsiString schemaName;
/** \details
Elapsed validation time.
*/
unsigned long validationTime;
/** \details
Creates a new instance of the storage for extra information about validation with default parameters.
*/
NotifierExtraInfo() {}
/** \details
Creates a new instance of the storage for extra information about validation.
\param _fileName [in] An ANSI string that contains the name of the file with data to be validated.
\param _schemaName [in] An ANSI string that contains the name of the model's underlying schema.
\param _validationTime [in] A time that the validation took in milliseconds.
*/
NotifierExtraInfo(const OdAnsiString& _fileName, const OdAnsiString& _schemaName, const unsigned long _validationTime = OdDAI::Consts::OdUIntUnset) : fileName(_fileName), schemaName(_schemaName), validationTime(_validationTime) {}
};
/** \details
The base class that implements sending notification with information about the status of a validation task.
*/
class DAI_EXPORT ValidationNotifier : public OdRxObject
{
//DOM-IGNORE-BEGIN
ODRX_DECLARE_MEMBERS(ValidationNotifier);
//DOM-IGNORE-END
public:
/** \details
Destroys the notifier object.
*/
virtual ~ValidationNotifier();
/** \details
Sends a notification with specific validation information.
\param instanceId [in] An of the entity instance that is being validated.
\param validationTask [in] A smart pointer to the object.
\param invalidParams [in] A shared pointer to the instance
that contains an array of pointers to instances, which didn't pass the validation check.
\param result [in] A validation check .
*/
virtual void onValidationResult(OdDAIObjectId instanceId, ValidationTaskPtr validationTask, OdSharedPtr invalidParams, OdDAI::Logical result) = 0;
/** \details
Sends a notification with specific validation information.
\param validationTask [in] A smart pointer to the object.
\param invalidObjects [in] An array of of the entity instances which didn't pass the validation check.
\param result [in] A validation check .
*/
virtual void onValidationResult(ValidationTaskPtr validationTask, const OdDAIObjectIds& invalidObjects, OdDAI::Logical result) = 0;
/** \details
Sends a notification when the validation procedure starts.
*/
virtual void onStartValidation();
/** \details
Sends a notification when the validation procedure ends.
*/
virtual void onEndValidation();
/** \details
Sends a notification that contains the validation time.
\param time [in] An unsigned long value that represents the validation time in milliseconds.
*/
virtual void onTimeReport(const OdUInt32 time);
/** \details
Sets an extra validation information for the notification.
\param modelInfo [in] A raw pointer to the that stores the extra information.
*/
void setModelInfo(NotifierExtraInfo* modelInfo);
/** \details
Retrieves an extra validation information to be sent within the notification.
\returns A raw pointer to an that stores the extra information.
*/
NotifierExtraInfo* getModelInfo();
protected:
OdAnsiString result2string(const OdDAI::Logical result) const;
NotifierExtraInfo* m_extraInfo = nullptr;
};
/** \details
A data type that represents a smart pointer to an object.
*/
typedef OdSmartPtr ValidationNotifierPtr;
}
#include "TD_PackPop.h"
#endif //_DAI_VALIDATION_NOTIFIER_H