X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelAPI%2FModelAPI_Attribute.h;h=a8abce8b855e18ecdabcb40ac9d68bfce8c3d71f;hb=031fb5e7c551e695afa72a9de299f118a40d8d88;hp=c54b395561b908739737abb7ba47674b92e11f43;hpb=85a3a34f6b8a9e925f4055e874c1e7f8833f0ac3;p=modules%2Fshaper.git diff --git a/src/ModelAPI/ModelAPI_Attribute.h b/src/ModelAPI/ModelAPI_Attribute.h index c54b39556..a8abce8b8 100644 --- a/src/ModelAPI/ModelAPI_Attribute.h +++ b/src/ModelAPI/ModelAPI_Attribute.h @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: ModelAPI_Attribute.h // Created: 2 Apr 2014 // Author: Mikhail PONIKAROV @@ -7,7 +9,7 @@ #include "ModelAPI.h" #include -#include +#include class ModelAPI_Object; @@ -18,11 +20,14 @@ class ModelAPI_Object; class ModelAPI_Attribute { ///< needed here to emit signal that feature changed on change of the attribute - boost::shared_ptr myObject; + std::shared_ptr myObject; + std::string myID; ///< identifier of this attribute in Data class protected: // accessible from the attributes - bool myIsInitialized; - bool myIsArgument; + bool myIsInitialized; ///< is some value assigned to this attribute + bool myIsArgument; ///< is this attribute used as an argument for execution + bool myIsImmutable; ///< is this attribute can be changed programmatically (e.g. by constraint) + public: /// Returns the type of this class of attributes, not static method @@ -34,13 +39,13 @@ class ModelAPI_Attribute } /// Sets the owner of this attribute - MODELAPI_EXPORT virtual void setObject(const boost::shared_ptr& theObject) + MODELAPI_EXPORT virtual void setObject(const std::shared_ptr& theObject) { myObject = theObject; } /// Returns the owner of this attribute - MODELAPI_EXPORT const boost::shared_ptr& owner() const + MODELAPI_EXPORT const std::shared_ptr& owner() const { return myObject; } @@ -70,17 +75,47 @@ 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; + } + + /// ID of the attribute in Data + MODELAPI_EXPORT const std::string& id() const + { + return myID; + } + protected: /// Objects are created for features automatically ModelAPI_Attribute() { myIsInitialized = false; myIsArgument = true; + myIsImmutable = false; + } + + /// Sets the ID of the attribute in Data (called from Data) + MODELAPI_EXPORT void setID(const std::string theID) + { + myID = theID; } + friend class Model_Data; }; //! Pointer on attribute object -typedef boost::shared_ptr AttributePtr; +typedef std::shared_ptr AttributePtr; #endif