1 // File: ModelAPI_Attribute.h
3 // Author: Mikhail PONIKAROV
5 #ifndef ModelAPI_Attribute_H_
6 #define ModelAPI_Attribute_H_
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;
23 // accessible from the attributes
25 bool myIsComputedDefault;
29 /// Returns the type of this class of attributes, not static method
30 MODELAPI_EXPORT virtual std::string attributeType() = 0;
32 /// To virtually destroy the fields of successors
33 MODELAPI_EXPORT virtual ~ModelAPI_Attribute()
37 /// Sets the owner of this attribute
38 MODELAPI_EXPORT void setObject(const boost::shared_ptr<ModelAPI_Object>& theObject)
43 /// Returns the owner of this attribute
44 MODELAPI_EXPORT const boost::shared_ptr<ModelAPI_Object>& owner() const
49 /// Returns true if attribute was initialized by some value
50 MODELAPI_EXPORT bool isInitialized()
52 return myIsInitialized;
55 /// Makes attribute initialized
56 MODELAPI_EXPORT void setInitialized()
58 myIsInitialized = true;
61 /// Returns true if attribute's default value was computed
62 MODELAPI_EXPORT bool isComputedDefault()
64 return myIsComputedDefault;
67 /// Tells that attribute's default value was computed
68 MODELAPI_EXPORT void setComputedDefault()
70 myIsComputedDefault = true;
71 myIsInitialized = false;
74 /// Set this attribute is argument for result (change of this attribute requires update of result).
75 /// By default it is true.
76 MODELAPI_EXPORT void setIsArgument(const bool theFlag)
78 myIsArgument = theFlag;
81 /// Returns true if attribute causes the result change
82 MODELAPI_EXPORT bool isArgument()
88 /// Objects are created for features automatically
91 myIsInitialized = false;
92 myIsComputedDefault = false;
98 //! Pointer on attribute object
99 typedef boost::shared_ptr<ModelAPI_Attribute> AttributePtr;