/////////////////////////////////////////////////////////////////////////////// // 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 _IFC_PSD_QTO_H #define _IFC_PSD_QTO_H #include "IfcBuildOptions.h" #include "daiModel.h" #include "OdArray.h" #include "TD_PackPush.h" class PSDQTOImpl; /** \details A class that provides the interface for operations over Property/Quantity Set Definitions (PSD/QTO). */ class IFCCORETOOLS_EXPORT PSDQTO final { public: /** \details Constructor for the PSDQTO class. \param applicableVersion [in] File version allowed for loading. If no restriction to a specific version should be specified, set this argument to nullptr. */ PSDQTO(const char* applicableVersion = nullptr); /** \details Destructor for the PSDQTO class. */ ~PSDQTO(); /** \details Retrieves an underlying PSDQTO EXPRESS schema definition. \returns a smart pointer to an underlying PSDQTO EXPRESS schema definition. */ OdDAI::SchemaPtr getSchema() const; /** \details Retrieves an underlying OdDAI::Model that contains imported/loaded PSD/QTO definitions. \returns a smart pointer to an underlying PSD/QTO definitions within EXPRESS model. */ OdDAI::ModelPtr getModel() const; /** \details Retrieves the name of the object. \returns A string that contains the name of the object. */ const OdAnsiString& getName() const; /** \details Retrieves the comment of the object. \returns A string that contains the comment of the object. */ const OdAnsiString& getComment() const; /** \details Set the name of the object. \param value [in] A string value to set. */ void setName(const OdAnsiString& value); /** \details Set the comment of the object. \param value [in] A string value to set. */ void setComment(const OdAnsiString& value); /** \details Clears PSD/QTO definition instances. */ void Clear(); /** \details Imports an input XML file into appropriate PSD/QTO definition instance. \param fileName [in] Raw string that contains XML file name that should be imported into appropriate PSD/QTO definition instance. \returns eOk if operation is successfully done, otherwise returns appropriate OdResult code. */ OdResult importFromXML(const char* fileName); /** \details Exports a PSD/QTO definition instance into an output psdXML file. \param psdqtoInstance [in] Smart pointer to PSD or QTO application instance that should be exported into XML file. \param fileName [in/out] Raw string that contains output XML file name. \returns eOk if operation is successfully done, otherwise returns appropriate OdResult code. */ OdResult exportToXML(const OdDAI::ApplicationInstance* psdqtoInstance, const char* fileName); /** \details Retrieves an array of OdDAIObjectIds for property set definitions which are applicable to provided IFC instance. \param ifcInstance [in] IFC application instance to find applicable property set definitions for. \param ids [in] Array to collect object identifiers for applicable property set definition instances. \returns Returns true if at least one element has been added to the array, otherwise returns false. */ bool getApplicablePSD(const OdDAI::ApplicationInstance* ifcInstance, OdDAIObjectIds& ids) const; /** \details Retrieves an array of OdDAIObjectIds for quantity set definitions which are applicable to provided IFC instance. \param ifcInstance [in] IFC application instance to find applicable quantity set definitions for. \param ids [in/out] Array to collect object identifiers for applicable quantity set definition instances. \returns Returns true if at least one element has been added to the array, otherwise returns false. */ bool getApplicableQTO(const OdDAI::ApplicationInstance* ifcInstance, OdDAIObjectIds& ids) const; /** \details Retrieves an array of OdDAIObjectIds for PSD/QTO definitions which are applicable to provided IFC instance. \param ifcInstance [in] IFC application instance to find applicable PSD/QTO definitions for. \param ids [in/out] Array to collect object identifiers for applicable PSD/QTO definition instances. \returns Returns true if at least one element has been added to the array, otherwise returns false. */ bool getApplicable(const OdDAI::ApplicationInstance* ifcInstance, OdDAIObjectIds& ids) const; /** \details Retrieves an array of OdDAIObjectIds for PSD/QTO definitions which are applicable to provided IFC instance name and predefined type (optional). \param applicableClassName [in] IFC entity name and predefined type (optional) to find applicable PSD/QTO definitions for. \param ids [in/out] Array to collect object identifiers for applicable PSD/QTO definition instances. \returns Returns true if at least one element has been added to the array, otherwise returns false. \remarks The predefined type is placed after the entity name with a slash. Example: "IfcValve/MIXING". */ bool getApplicable(const char* applicableClassName, OdDAIObjectIds& ids) const; /** \details Retrieves an array of OdDAIObjectIds for PSD/QTO definitions which are applicable to provided IFC entity and predefined type (optional). \param ifcEntity [in] IFC entity to find applicable PSD/QTO definitions for. \param predefinedType [in] predefined type for instance or null pointer. \param ids [in/out] Array to collect object identifiers for applicable PSD/QTO definition instances. \returns Returns true if at least one element has been added to the array, otherwise returns false. */ bool getApplicable(const OdDAI::Entity* ifcEntity, const char* predefinedType, OdDAIObjectIds& ids) const; /** \details Checks whether applicable property set definitions exist for the provided IFC instance. \param ifcInstance [in] IFC application instance to find applicable property set definitions for. \returns Returns true if at least one element exists, otherwise returns false. */ bool isApplicablePSD(const OdDAI::ApplicationInstance* ifcInstance) const; /** \details Checks whether applicable quantity set definitions exist for the provided IFC instance. \param ifcInstance [in] IFC application instance to find applicable quantity set definitions for. \returns Returns true if at least one element exists, otherwise returns false. */ bool isApplicableQTO(const OdDAI::ApplicationInstance* ifcInstance) const; /** \details Reads a Step Physical File that contains PSD/QTO definitions according PSDQTO EXPRESS schema. \param fileName [in] OdString that contains input file name. \returns eOk if underlying model was successfully read from a file. */ OdResult readFile(const OdString& fileName); /** \details Writes underlying model with property/quantity sets data into Step Physical File. \param fileName [in] OdString that contains output file name. \returns eOk if underlying model was successfully written into file. */ OdResult writeFile(const OdString& fileName); private: PSDQTOImpl* m_pImpl; }; /** \details A data type that represents a smart pointer to an PSDQTO object. */ typedef OdSharedPtr PSDQTOPtr; /* PSDQTOList */ /** \details This class is a list of Property/Quantity Set Definitions (PSD/QTO). */ class IFCCORETOOLS_EXPORT PSDQTOList { public: using size_type = OdArray::size_type; /** \details Constructor. */ PSDQTOList(); /** \details Destructor. */ ~PSDQTOList(); /** \details Clears the list. */ void clear(); /** \details Returns the length of the array object. \returns The number of elements in the array object. */ size_type length() const { return m_psdqto.length(); } /** \details Indicates whether the array is empty. \returns The true value if the array is empty, or false otherwise. */ bool isEmpty() const { return m_psdqto.isEmpty(); } /** \remarks Returns the element of the array object at the specified index. \param index [in] Index of the array object. \returns Pointer to PSDQTO instance at the the specified index. */ PSDQTO* operator [](size_type index) { return m_psdqto[index].get(); } /** \remarks Returns the element of the array object at the specified index. \param index [in] Index of the array object. \returns Pointer to PSDQTO instance at the the specified index. */ const PSDQTO* operator [](size_type index) const { return m_psdqto[index].get(); } /** \details Returns the element of the array object at the specified index. \param index [in] Index of the array object. \returns Pointer to the element at the specified index. */ PSDQTO* at(size_type index) { return m_psdqto.at(index).get(); } /** \details Returns the element of the array object at the specified index. \param index [in] Index of the array object. \returns Pointer to the element at the specified index. */ const PSDQTO* at(size_type index) const { return m_psdqto.at(index).get(); } /** \details Sets the element of the array object at the specified index. \param index [in] Index of the array object element to set. \param value [in] Value to set. */ void setAt(size_type index, PSDQTO* value) { m_psdqto.setAt(index, value); } /** \details Returns the element of the array object at the specified position. \param index [in] Index of the array object element to return. \returns Reference to the element at the specified position. */ const PSDQTO* getAt(size_type index) const { return m_psdqto.getAt(index).get(); } /** \details Appends the specified value to the end of the array object. \param value [in] Value to append. \returns The index of the new last element. */ size_type append(PSDQTO* value) { return m_psdqto.append(value); } /** \details Inserts the specified value into this Array object at the specified index using move semantics. \param index [in] Array index. \param value [in] Value to insert. \remarks If the specified value supports move semantics value is moved, otherwise value is saved. Elements starting at arrayIndex will have their indices incremented.
                0 <= arrayIndex <= length()
    
Returns a reference to this Array object. */ void insertAt(size_type index, PSDQTO* value) { m_psdqto.insertAt(index, value); } /** \details Removes the element at the specified index from the array object. \param index [in] Index of the element to remove. \remarks
                0 <= arrayIndex < length()
    
Elements starting at arrayIndex+1 will have their indices decremented. */ void removeAt(size_type index) { m_psdqto.removeAt(index); } /** \details Swaps the specified elements in the array object. \param firstIndex [in] Index of first element. \param secondIndex [in] Index of second element. */ void swap(size_type firstIndex, size_type secondIndex) { m_psdqto.swap(firstIndex, secondIndex); } /** \details Reads a Step Physical File that contains PSD/QTO definitions according PSDQTO EXPRESS schema. \param fileName [in] OdString that contains input file name. \param name [in] The name to assign to the object (optional). \param comment [in] The comment to assign to the object (optional). \param applicableVersion [in] File version allowed for loading (optional). \returns Reference to the new PSDQTO element loaded from the file, otherwise returns null. */ PSDQTO* loadFromFile( const OdString& fileName, const char* name = nullptr, const char* comment = nullptr, const char* applicableVersion = nullptr); private: OdArray m_psdqto; }; /** \details A data type that represents a smart pointer to an PSDQTOList object. */ typedef OdSharedPtr PSDQTOListPtr; #include "TD_PackPop.h" #endif //_IFC_PSD_QTO_H