1 // File: ModelAPI_Attribute.h
3 // Author: Mikhail PONIKAROV
5 #ifndef ModelAPI_Attribute_HeaderFile
6 #define ModelAPI_Attribute_HeaderFile
10 #include <boost/shared_ptr.hpp>
12 class ModelAPI_Object;
14 /**\class ModelAPI_Attribute
16 * \brief Generic attribute of the Object.
18 class ModelAPI_Attribute
20 ///< needed here to emit signal that feature changed on change of the attribute
21 boost::shared_ptr<ModelAPI_Object> myObject;
22 protected: // accessible from the attributes
26 /// Returns the type of this class of attributes, not static method
27 MODELAPI_EXPORT virtual std::string attributeType() = 0;
29 /// To virtually destroy the fields of successors
30 MODELAPI_EXPORT virtual ~ModelAPI_Attribute() {}
32 /// Sets the owner of this attribute
33 MODELAPI_EXPORT void setObject(const boost::shared_ptr<ModelAPI_Object>& theObject)
34 {myObject = theObject;}
36 /// Returns the owner of this attribute
37 MODELAPI_EXPORT const boost::shared_ptr<ModelAPI_Object>& owner()
40 /// Returns true if attribute was initialized by some value
41 MODELAPI_EXPORT bool isInitialized() {return myIsInitialized;}
43 /// Makes attribute initialized
44 MODELAPI_EXPORT void setInitialized() {myIsInitialized = true;}
47 /// Objects are created for features automatically
48 ModelAPI_Attribute() {myIsInitialized = false;}