/////////////////////////////////////////////////////////////////////////////// // 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_GLOBAL_RULE_H_ #define _DAI_GLOBAL_RULE_H_ #include "daiDictionaryInstance.h" #include "daiWhereRule.h" #include "daiValueTypes.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 Model; typedef OdSmartPtr ModelPtr; class Entity; typedef OdSmartPtr EntityPtr; //class WhereRule; //typedef OdSmartPtr WhereRulePtr; class NamedType; class ApplicationInstance; typedef OdSmartPtr ApplicationInstancePtr; /** \details The class represents functionality for a Global Rule for a model validation purposes. */ class DAI_EXPORT GlobalRule : public DictionaryInstance { public: //DOM-IGNORE-BEGIN ODRX_DECLARE_MEMBERS(GlobalRule); //DOM-IGNORE-END /** \details Creates a new Global Rule object with specified parameters. \param schema [in] A object that owns the created Global Rule object. \param name [in] An ANSI string that contains the name of the Global Rule. \param entities [in] An array of smart pointers to definitions the created Global Rule affects. \param ast [in] A token that contains the expression of the Global Rule. \returns A smart pointer to the created Global Rule. */ static OdSmartPtr createObject(OdDAI::Schema *schema, const OdAnsiString &name, const OdArray &entities, AST *ast); /** \details Destroys the Global Rule object. */ ~GlobalRule(); /** \details Retrieves the name of the Global Rule object. \returns An ANSI string that contains the Global Rule name. */ const OdAnsiString& name() const { return m_name; } /** \details Retrieves the original name of the Global Rule object. The original name is a name of the Global Rule how it is represented in the . \returns An ANSI string that contains the Global Rule original name. */ const OdAnsiString& originalName() const { return m_originalName; } /** \details Retrieves an array of definitions the Global Rule affects. \returns An array of smart pointers to instances affected by the Global Rule object. */ const OdArray& entities() const { return m_entities; } /** \details Retrieves the parent of the Global Rule object. \returns A raw pointer to the parent instance. */ Schema* parentSchema() const { return m_parentSchema; } /** \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 Global Rule within a specified and forms the list of aggregates, which violates it. \param model [in] A smart pointer to the . \param aggr [out] A list of ANSI strings that contains the names of aggregates, which violates the Global Rule. \returns * if the validation has been completed successfully. * if any violation of the Global Rule occurs. * when the Global Rule expression is not defined or is incorrect or other error occurs. */ OdDAI::Logical validate(ModelPtr model, ListOfOdAnsiString &aggr) const; /** \details Retrieves a list associated with the Global Rule object. \returns Returns a list of smart pointers to . */ const ListOfWhereRule& whereRules() const { return m_whereRules; }; /** \details Retrieves an expression of the Global Rule object. \returns An ANSI string that contains the expression of the Global Rule object. */ const OdAnsiString expression() const; //DOM-IGNORE-BEGIN /** \details Append Where Rule to the Named Type. \param ruleDef [in] Smart pointer to rule definition. */ void appendWhereRule(WhereRule *ruleDef); AST* ast() const { return m_expression; }; //DOM-IGNORE-END private: OdAnsiString m_name; OdAnsiString m_originalName; OdArray m_entities; ListOfWhereRule m_whereRules; Schema *m_parentSchema; AST *m_expression; friend class Session; }; /** \details A data type that represents a smart pointer to a object. */ typedef OdSmartPtr GlobalRulePtr; } #include "TD_PackPop.h" #endif // _DAI_GLOBAL_RULE_H_