Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / ModelAPI / ModelAPI_Attribute.h
index 8e2051ac253773a0b824ffb666e12a9ca6e8a16f..cfef5172421791a08ebd6958ca018a3000be1378 100644 (file)
@@ -23,6 +23,8 @@ class ModelAPI_Attribute
   // accessible from the attributes
   bool myIsInitialized;
   bool myIsArgument;
+  bool myIsImmutable;
+
  public:
 
   /// Returns the type of this class of attributes, not static method
@@ -34,13 +36,13 @@ class ModelAPI_Attribute
   }
 
   /// Sets the owner of this attribute
-  MODELAPI_EXPORT void setObject(const boost::shared_ptr<ModelAPI_Object>& theObject)
+  MODELAPI_EXPORT virtual void setObject(const boost::shared_ptr<ModelAPI_Object>& theObject)
   {
     myObject = theObject;
   }
 
   /// Returns the owner of this attribute
-  MODELAPI_EXPORT const boost::shared_ptr<ModelAPI_Object>& owner()
+  MODELAPI_EXPORT const boost::shared_ptr<ModelAPI_Object>& owner() const
   {
     return myObject;
   }
@@ -70,12 +72,29 @@ class ModelAPI_Attribute
     return myIsArgument;
   }
 
+  /// Immutable argument can not be changed programaticaly (e.g. by constraint)
+  /// By default it is false.
+  /// Returns the previous state of the attribute's immutability.
+  MODELAPI_EXPORT bool setImmutable(const bool theFlag)
+  {
+    bool aResult = myIsImmutable;
+    myIsImmutable = theFlag;
+    return aResult;
+  }
+
+  /// Returns true if can not be changed programaticaly
+  MODELAPI_EXPORT bool isImmutable()
+  {
+    return myIsImmutable;
+  }
+
  protected:
   /// Objects are created for features automatically
   ModelAPI_Attribute()
   {
     myIsInitialized = false;
     myIsArgument = true;
+    myIsImmutable = false;
   }
 
 };