1 #ifndef HYDROData_Object_HeaderFile
2 #define HYDROData_Object_HeaderFile
6 #include <TDF_Label.hxx>
9 ///! Kind of an object in a document
10 typedef int ObjectKind;
11 ///! Unrecognized object
12 const ObjectKind KIND_UNKNOWN = 0;
13 const ObjectKind KIND_IMAGE = 1;
15 DEFINE_STANDARD_HANDLE(HYDROData_Object, MMgt_TShared)
17 /**\class HYDROData_Object
18 * \brief Generic class of any object in the data model.
20 * Interface for getting access to the object that belong to the data model.
21 * Managed by Document. Provides access to the common properties:
22 * kind of an object, name.
24 class HYDROData_Object : public MMgt_TShared
27 DEFINE_STANDARD_RTTI(HYDROData_Object);
30 * Returns the kind of this object. Must be redefined in all objects of known type.
32 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_UNKNOWN;}
35 * Returns the name of this object.
37 HYDRODATA_EXPORT QString GetName() const;
40 * Updates the name of this object.
42 HYDRODATA_EXPORT void SetName(const QString& theName);
45 * Checks is object exists in the data structure.
46 * \returns true is object is not exists in the data model
48 HYDRODATA_EXPORT bool IsRemoved() const;
51 * Removes object from the data structure.
53 HYDRODATA_EXPORT void Remove();
56 * Returns unique integer identifier of the object (may be used for ordering of objects)
58 HYDRODATA_EXPORT inline int ID() const {return myLab.Tag();}
61 * Copies all properties of this to the destinated object.
62 * Objects must be the same type.
63 * \param theDestination initialized object (from any document) - target of copying
65 HYDRODATA_EXPORT void CopyTo(Handle_HYDROData_Object theDestination) const;
69 friend class HYDROData_Iterator;
72 * Creates new object in the internal data structure. Use higher level objects
73 * to create objects with real content.
75 HYDRODATA_EXPORT HYDROData_Object();
78 * Destructs properties of the object and object itself, removes it from the document.
80 virtual HYDRODATA_EXPORT ~HYDROData_Object();
83 * Put the object to the label of the document.
84 * \param theLabel new label of the object
86 HYDRODATA_EXPORT virtual void SetLabel(TDF_Label theLabel);
89 * Returns the label of this object.
91 TDF_Label& Label() {return myLab;}
94 * Internal method that used to store the byte array attribute
95 * \param theTag tag of a label to store attribute (for 0 this is myLab)
96 * \param theData pointer to bytes array
97 * \param theLen number of bytes in byte array that must be stored
99 void SaveByteArray(const int theTag, const char* theData, const int theLen);
102 * Internal method that used to retreive the content of byte array attribute
103 * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
104 * \param theLen number of bytes in byte array
105 * \returns pointer to the internal data structure wit harray content,
106 * or NULL if array size is zero
108 const char* ByteArray(const int theTag, int& theLen);
111 /// Array of pointers to the properties of this object; index in this array is returned by \a AddProperty.
112 TDF_Label myLab; ///< label of this object
115 ///! Is Equal for HYDROData_Object mapping
116 HYDRODATA_EXPORT bool IsEqual(const Handle_HYDROData_Object& theObj1, const Handle_HYDROData_Object& theObj2);