///////////////////////////////////////////////////////////////////////////////
// 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.
///////////////////////////////////////////////////////////////////////////////
#if !defined(ODA_ODMVDXMLTEMPLATERULE_H_INCLUDED_)
#define ODA_ODMVDXMLTEMPLATERULE_H_INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "IfcEntity.h"
#include "MvdXmlDefinition.h"
#include "MvdXmlConceptTemplate.h"
/** \details
Contains declarations related to Model View Definition (MVD) functionality.
*/
namespace OdMvdXml
{
SMARTPTR(OdMvdXmlTemplateRule);
/** \details
A class that implements a Template Rule with specific parameters.
A Template Rule contains a collection of applicable elements:
* materials.
* ports.
* property sets.
* units and etc.
Template Rule parameters may contain references to attribute rules and (or) entity rules within a referenced
Template Concept.
These references create instances of appropriate rules.
*/
class MVDXML_EXPORT OdMvdXmlTemplateRule : public OdMvdXmlDefinitions
{
ODRX_DECLARE_MEMBERS(OdMvdXmlTemplateRule);
public:
/** \details
Retrieves the Template Rule parameters.
\returns An ANSI string that contains Template Rule parameters.
\remarks
The MVDXML standard provides parameters string that may contain definition syntax in the form of "parameter=value" (MVDXML 1.0) or in the new grammar syntax.
New grammar syntax assumes that parameters string contains expressions where each boolean term must be completed with a parameter that refers to an attribute rule or OdMvdXmlEntityRule entity rule> within a referenced Concept Template.
Expressions can be combined with AND, OR and XOR logical operators.
*/
const OdAnsiString& getParameters() const { return m_parameters; };
/** \details
Sets the Template Rule parameters.
\param value [in] \returns An ANSI string that contains Template Rule parameters.
\remarks
The MVDXML standard provides parameters string that may contain definition syntax in the form of "parameter=value" (MVDXML 1.0) or in the new grammar syntax.
New grammar syntax assumes that parameters string contains expressions where each boolean term must be completed with a parameter that refers to an attribute rule or entity rule within a referenced Concept Template.
Expressions can be combined with AND, OR and XOR logical operators.
*/
void setParameters(const OdAnsiString &value) { m_parameters = value; };
/** \details
Executes the check-up of the template rule for a specified Concept Template object.
\param pTemplate [in] A raw pointer to the Concept Template object.
\param result [out] A placeholder for the check-up result, represented with a boolean value.
\returns eOk if the rule check-up execution was successful; otherwise, the method returns an appropriate error code.
*/
OdResult execute(const OdMvdXmlConceptTemplate* pTemplate, bool& result) const;
protected:
/** \details
Retrieves the name of the element. This name is used to write the element to a file.
\returns The name of the element.
*/
virtual OdAnsiString getElementName();
/** \details
Reads attributes from a xml element.
\param pItem [in] Pointer to a xml element containing attributes.
\returns eOk if the data was successfully read; otherwise, the method returns an appropriate error code.
*/
virtual OdResult inAttributes(TiXmlElement* pItem) override;
/** \details
Writing attributes to the xml element.
\param pItem [in] Pointer to the xml element to which you want to add attributes.
\returns eOk if the data was written successfully; otherwise, the method returns an appropriate error code.
*/
virtual OdResult outAttributes(TiXmlElement* pItem) override;
private:
/** \details
Parameters string is defined by expression where each boolean_term requires a parameter.
The parameter corresponds to the RuleID of an AttributeRule or EntityRule at the referenced ConceptTemplate.
*/
OdAnsiString m_parameters;
};
}
#endif // !defined(ODA_ODMVDXMLTEMPLATERULE_H_INCLUDED_)