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
28 /// Returns the type of this class of attributes, not static method
29 MODELAPI_EXPORT virtual std::string attributeType() = 0;
31 /// To virtually destroy the fields of successors
32 MODELAPI_EXPORT virtual ~ModelAPI_Attribute()
36 /// Sets the owner of this attribute
37 MODELAPI_EXPORT void setObject(const boost::shared_ptr<ModelAPI_Object>& theObject)
42 /// Returns the owner of this attribute
43 MODELAPI_EXPORT const boost::shared_ptr<ModelAPI_Object>& owner() const
48 /// Returns true if attribute was initialized by some value
49 MODELAPI_EXPORT bool isInitialized()
51 return myIsInitialized;
54 /// Makes attribute initialized
55 MODELAPI_EXPORT void setInitialized()
57 myIsInitialized = true;
60 /// Set this attribute is argument for result (change of this attribute requires update of result).
61 /// By default it is true.
62 MODELAPI_EXPORT void setIsArgument(const bool theFlag)
64 myIsArgument = theFlag;
67 /// Returns true if attribute causes the result change
68 MODELAPI_EXPORT bool isArgument()
74 /// Objects are created for features automatically
77 myIsInitialized = false;
83 //! Pointer on attribute object
84 typedef boost::shared_ptr<ModelAPI_Attribute> AttributePtr;