/////////////////////////////////////////////////////////////////////////////// // 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_WHERE_RULE_H_ #define _DAI_WHERE_RULE_H_ #include "daiTypeOrRule.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 A class that implements a Where-Rule constraint for instance validation purposes. */ class DAI_EXPORT WhereRule : public DictionaryInstance { public: //DOM-IGNORE-BEGIN ODRX_DECLARE_MEMBERS(WhereRule); static OdSmartPtr createObject(OdDAI::Schema *schema, const OdAnsiString &label, const TypeOrRulePtr& parentItem, const OdAnsiString &expression); /** \details Creates a new instance of the Where-Rule class with specified parameters. \param schema [in] A raw pointer to a that contains the created Where-Rule constraint. \param label [in] An ANSI string that contains the label text. \param ast [in] A raw pointer to the token object that represents the expression of the Where-Rule object. \returns A smart pointer to the created Where-Rule object. */ static OdSmartPtr createObject(OdDAI::Schema *schema, const OdAnsiString &label, const TypeOrRulePtr& parentItem, AST *ast); //DOM-IGNORE-END /** \details Destroys the Where-Rule object. */ ~WhereRule(); /** \details Retrieves the Where Rule label. \returns An ANSI string that contains the label text. */ const OdAnsiString& label() const { return m_label; } /** \details Retrieves the original Where Rule label. The original label text has the same form as it appears in the . \returns An ANSI string that contains the original label text. */ const OdAnsiString& originalLabel() const { return m_originalLabel; } /** \details Retrieves the current value of an 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 . \remarks The method provides the late binding access to the value by its name. of Select and Aggregate data types are also supported. */ virtual OdRxValue getAttr(const char * attrName) const; /** \details Checks the Where-Rule for a specified . \param inst [in] A smart pointer to the to validate. \returns * True if the Where-Rule constraint check was passed. * False if the Where-Rule constraint was violated. * Unknown if the Where-Rule expression is incorrect or is not defined. */ OdDAI::Logical validate(const ApplicationInstancePtr inst) const; /** \details Checks the Where-Rule for a specified value within a particular . \param val [in] An OdRxValue object that contains the value to check. \param schema [in] A raw pointer to a . \returns * True if the Where-Rule constraint check was passed. * False if the Where-Rule constraint was violated. * Unknown if the Where-Rule expression is incorrect or is not defined. */ OdDAI::Logical validate(const OdRxValue &val, const OdDAI::Schema *schema) const; /** \details Retrieves the expression of the Where-Rule constraint. \returns An ANSI string that contains the expression of the Where-Rule object. */ const OdAnsiString expression() const; /** \details Retrieves the expression of the Where-Rule constraint, represented as a set of tokens. \returns A raw pointer to a set of tokens, which represent the expression of the Where-Rule object. */ AST* getAST() const { return m_expression; }; /** \details Retrieves a parent item of the Where Rule instance. \returns A raw pointer to selection of NamedType or GlobalRule. */ const TypeOrRule* parentItem() const; //DOM-IGNORE-BEGIN private: OdAnsiString m_label; OdAnsiString m_originalLabel; TypeOrRulePtr m_parentItem; AST *m_expression = nullptr; friend class Session; //DOM-IGNORE-END }; /** \details A data type that represents a smart pointer to a object. */ typedef OdSmartPtr WhereRulePtr; } #include "TD_PackPop.h" #endif // _DAI_WHERE_RULE_H_