Salome HOME
Merge branch 'Pre_2.8.0_development'
[modules/shaper.git] / src / ModelAPI / ModelAPI_Attribute.cpp
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #include <ModelAPI_Attribute.h>
22
23 ModelAPI_Attribute::~ModelAPI_Attribute()
24 {
25 }
26
27   /// Sets the owner of this attribute
28 void ModelAPI_Attribute::setObject(const std::shared_ptr<ModelAPI_Object>& theObject)
29 {
30   myObject = theObject;
31 }
32
33   /// Returns the owner of this attribute
34 const std::shared_ptr<ModelAPI_Object>& ModelAPI_Attribute::owner() const
35 {
36   return myObject;
37 }
38
39   /// Returns true if attribute was  initialized by some value
40 bool ModelAPI_Attribute::isInitialized()
41 {
42   return myIsInitialized;
43 }
44
45 void ModelAPI_Attribute::setInitialized()
46 {
47   if (!mySetInitializedBlocked)
48     myIsInitialized = true;
49 }
50
51 bool ModelAPI_Attribute::blockSetInitialized(const bool theBlock)
52 {
53   bool aBlocked = mySetInitializedBlocked;
54
55   mySetInitializedBlocked = theBlock;
56
57   return aBlocked;
58 }
59
60 void ModelAPI_Attribute::setIsArgument(const bool theFlag)
61 {
62   myIsArgument = theFlag;
63 }
64
65 bool ModelAPI_Attribute::isArgument()
66 {
67   return myIsArgument;
68 }
69
70 bool ModelAPI_Attribute::setImmutable(const bool theFlag)
71 {
72   bool aResult = myIsImmutable;
73   myIsImmutable = theFlag;
74   return aResult;
75 }
76
77 bool ModelAPI_Attribute::isImmutable()
78 {
79   return myIsImmutable;
80 }
81
82 const std::string& ModelAPI_Attribute::id() const
83 {
84   return myID;
85 }
86
87 ModelAPI_Attribute::ModelAPI_Attribute()
88 {
89   mySetInitializedBlocked = false;
90   myIsInitialized = false;
91   myIsArgument = true;
92   myIsImmutable = false;
93 }
94
95   /// Sets the ID of the attribute in Data (called from Data)
96 void ModelAPI_Attribute::setID(const std::string theID)
97 {
98   myID = theID;
99 }
100
101 void ModelAPI_Attribute::reinit() {}
102
103 void ModelAPI_Attribute::reset()
104 {
105   myIsInitialized = false;
106 }