Salome HOME
ab9d54eb1cab9721cbb12a6a90b018b930e358b3
[modules/shaper.git] / src / ModelAPI / ModelAPI_Attribute.cpp
1 // Copyright (C) 2014-2023  CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include <ModelAPI_Attribute.h>
21
22 ModelAPI_Attribute::~ModelAPI_Attribute()
23 {
24 }
25
26   /// Sets the owner of this attribute
27 void ModelAPI_Attribute::setObject(const std::shared_ptr<ModelAPI_Object>& theObject)
28 {
29   myObject = theObject;
30 }
31
32   /// Returns the owner of this attribute
33 const std::shared_ptr<ModelAPI_Object>& ModelAPI_Attribute::owner() const
34 {
35   return myObject;
36 }
37
38   /// Returns true if attribute was  initialized by some value
39 bool ModelAPI_Attribute::isInitialized()
40 {
41   return myIsInitialized;
42 }
43
44 void ModelAPI_Attribute::setInitialized()
45 {
46   if (!mySetInitializedBlocked)
47     myIsInitialized = true;
48 }
49
50 bool ModelAPI_Attribute::blockSetInitialized(const bool theBlock)
51 {
52   bool aBlocked = mySetInitializedBlocked;
53
54   mySetInitializedBlocked = theBlock;
55
56   return aBlocked;
57 }
58
59 void ModelAPI_Attribute::setIsArgument(const bool theFlag)
60 {
61   myIsArgument = theFlag;
62 }
63
64 bool ModelAPI_Attribute::isArgument()
65 {
66   return myIsArgument;
67 }
68
69 bool ModelAPI_Attribute::setImmutable(const bool theFlag)
70 {
71   bool aResult = myIsImmutable;
72   myIsImmutable = theFlag;
73   return aResult;
74 }
75
76 bool ModelAPI_Attribute::isImmutable()
77 {
78   return myIsImmutable;
79 }
80
81 const std::string& ModelAPI_Attribute::id() const
82 {
83   return myID;
84 }
85
86 ModelAPI_Attribute::ModelAPI_Attribute()
87 {
88   mySetInitializedBlocked = false;
89   myIsInitialized = false;
90   myIsArgument = true;
91   myIsImmutable = false;
92 }
93
94   /// Sets the ID of the attribute in Data (called from Data)
95 void ModelAPI_Attribute::setID(const std::string theID)
96 {
97   myID = theID;
98 }
99
100 void ModelAPI_Attribute::reinit() {}
101
102 void ModelAPI_Attribute::reset()
103 {
104   myIsInitialized = false;
105 }