/////////////////////////////////////////////////////////////////////////////// // 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_UNIQUENESS_RULE_H_ #define _DAI_UNIQUENESS_RULE_H_ #include "daiDictionaryInstance.h" #include "daiPrimitive.h" #include "TD_PackPush.h" //DOM-IGNORE-BEGIN class AST; //DOM-IGNORE-END /** \details Implements the Data Access Interface (DAI) that provides functionality for manipulating data that is defined within the EXPRESS SCHEMA format. */ namespace OdDAI { class Schema; class NamedType; class ApplicationInstance; typedef OdSmartPtr ApplicationInstancePtr; /** \details This class represents a Uniqueness Rule constraint for instance validation purposes. */ class DAI_EXPORT UniquenessRule : public DictionaryInstance { public: //DOM-IGNORE-BEGIN ODRX_DECLARE_MEMBERS(UniquenessRule); //DOM-IGNORE-END /** \details Creates a new Uniqueness Rule object with specified parameters. \param schema [in] A object that owns the created Uniqueness Rule object. \param label [in] An ANSI string that contains the label text for the Uniqueness Rule. \param expression [in] An ANSI string that contains the expression of the Uniqueness Rule. \returns A smart pointer to the created Uniqueness Rule. */ static OdSmartPtr createObject(OdDAI::Schema *schema, const OdAnsiString &label, const OdAnsiString &expression); /** \details Creates a new Uniqueness Rule object with specified parameters. \param schema [in] A object that owns the created Uniqueness Rule object. \param label [in] An ANSI string that contains the label text for the Uniqueness Rule. \param ast [in] A token that contains the expression of the Uniqueness Rule. \returns A smart pointer to the created Uniqueness Rule. */ static OdSmartPtr createObject(OdDAI::Schema *schema, const OdAnsiString &label, AST *ast); /** \details Destroys the Uniqueness Rule object. */ ~UniquenessRule(); /** \details Retrieves the label of the Uniqueness Rule object. \returns An ANSI string that contains the label text for the Uniqueness Rule. */ const OdAnsiString& label() const { return m_label; } /** \details Retrieves the current value of an attribute specified by its name. \param attrName [in] An ANSI string that contains the attribute name. \returns An OdRxValue object that contains the current value of the attribute. \remarks The method provides the late binding access to the attribute value by its name. Attributes of select and aggregate data types are also supported. */ virtual OdRxValue getAttr(const char * attrName) const; /** \details Checks the Uniqueness Rule within a specified . \param inst [in] A smart pointer to the . \returns * if the validation has been completed successfully. * if any violation of the Uniqueness Rule occurs. * when the Uniqueness Rule expression is not defined or is incorrect or other error occurs. */ OdDAI::Logical validate(const ApplicationInstancePtr inst) const; /** \details Checks the Uniqueness Rule within a specified for a specified value. \param val [in] An OdRxValue object that contains the attribute value to be validated within the specified . \param schema [in] A raw pointer to the . \returns * if the validation has been completed successfully. * if any violation of the Uniqueness Rule occurs. * when the Uniqueness Rule expression is not defined or is incorrect or other error occurs. */ OdDAI::Logical validate(const OdRxValue &val, OdDAI::Schema *schema) const; /** \details Retrieves the expression of the Uniqueness Rule object. \returns An ANSI string that contains the expression of the Uniqueness Rule. */ const OdAnsiString expression() const; //DOM-IGNORE-BEGIN private: OdAnsiString m_label; AST *m_expression = nullptr; // TypeOrRule m_parentItem; friend class Session; //DOM-IGNORE-END }; /** \details A data type that represents a smart pointer to a object. */ typedef OdSmartPtr UniquenessRulePtr; } #include "TD_PackPop.h" #endif // _DAI_UNIQUENESS_RULE_H_