/////////////////////////////////////////////////////////////////////////////// // 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_ATTRIBUTE_KEY_H_ #define _DAI_ATTRIBUTE_KEY_H_ #include "OdaCommon.h" #include "TD_PackPush.h" #include "daiTypeCode.h" #define STL_USING_FUNCTIONAL #define STL_USING_VECTOR #include "OdaSTL.h" namespace OdDAI { class Attribute; class Entity; class OdSpfFilerBase; //DOM-IGNORE-BEGIN /** \details This class provides a set of operations for working with attribute data. */ class AttributeDataLogic { public: /** \details Virtual destructor. */ virtual ~AttributeDataLogic() {} /** \details Compares left data to right data of an attribute. \param left [in] Left data to compare. \param right [in] Right data to compare. \param attribute [in] Attribute. \returns true if the provided data is equal; otherwise the method returns false; */ virtual bool compare(void* left, void* right, const OdDAI::Attribute* attribute) = 0; /** \details Copies attribute data. \param from [in] Source. \param to [in] Destination. \param attribute [in] Attribute. \returns true if copied successfully; otherwise the method returns false; */ virtual bool copy(void* from, void* to, const OdDAI::Attribute* attribute) = 0; /** \details Reads data from a filer. \param what [in/out] Data of a specific type for a filer to read. \param rdFiler [in] Filer to read from. \param attribute [in] Attribute. */ virtual void read(void* what, OdDAI::OdSpfFilerBase* rdFiler, const OdDAI::Attribute* attribute) = 0; /** \details Writes data to a filer. \param what [in] Data to write. \param rdFiler [in/out] Filer to write to. \param attribute [in] Attribute. */ virtual void write(void* what, OdDAI::OdSpfFilerBase* wrFiler, const OdDAI::Attribute* attribute) = 0; /** \details Gets data from the specified value. \param from [in] Source. \param to [out] Destination. \param attribute [in] Attribute. */ virtual void get(void* from, OdRxValue& to, const OdDAI::Attribute* attribute) const = 0; /** \details Sets data from the specified value. \param from [in] Source. \param to [out] Destination. \param attribute [in] Attribute. \returns true if set successfully; otherwise the method returns false. */ virtual bool set(const OdRxValue& from, void* to, const OdDAI::Attribute* attribute) const = 0; /** \details Unsets the specified data. \param what [in] Data to unset. \param attribute [in] Attribute. */ virtual void unset(void* what, const OdDAI::Attribute* attribute) const = 0; /** \details Checks whether the specified data is unset. \param what [in] Data to test. \param attribute [in] Attribute. \returns true if the provided data is not unset; otherwise the method returns false. */ virtual bool test(void* what, const OdDAI::Attribute* attribute) const = 0; virtual void create(void* allocatedMemory, const OdDAI::Attribute* attribute) const= 0; /** \details Calls destructor on the object defined by its type. \param createdObjectMemory [in] Object to destroy. */ virtual void destroy(void* createdObjectMemory) const = 0; }; /** \details This structure contains data related to an attribute key that is a part of an attribute key collection. */ struct DAI_EXPORT AttributeKey { /** Index of an attribute key.*/ unsigned int declareOrderIndex = 0; /** Type offset of an attribute key.*/ unsigned int typeOffset = 0; /** Type size of an attribute key.*/ unsigned int typeSize = 0; /** Associated attribute.*/ const OdDAI::Attribute* attribute = nullptr; /** Indicates whether the attribute is derived.*/ bool isDerived = false; /** Indicates whether the attribute is complex.*/ bool isComplex = false; /** Associated attribute data logic.*/ AttributeDataLogic* dataLogic = nullptr; /** \details Compares this attribute key with the specified attribute key by names. \param other [in] Other attribute key to compare with. \returns true if this attribute key has starting character with a lesser ASCII value than the corresponding character in other attribute key; otherwise the method returns false. */ bool operator< (const AttributeKey& other) const; /** \details Compares this attribute key with the specified attribute key by names. \param keyName [in] Key name of other attribute key to compare with. \returns true if this attribute key has starting character with a lesser ASCII value than the corresponding character in other attribute key; otherwise the method returns false. */ bool operator< (const OdAnsiString& keyName) const; }; } //DOM-IGNORE-END #include "TD_PackPop.h" #endif // _DAI_ATTRIBUTE_KEY_H_