Salome HOME
Issue #2024: Redesign of circle and arc of circle
[modules/shaper.git] / src / ModelAPI / ModelAPI_Attribute.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_Attribute.cpp
4 // Created:     2 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #include <ModelAPI_Attribute.h>
8
9 ModelAPI_Attribute::~ModelAPI_Attribute()
10 {
11 }
12
13   /// Sets the owner of this attribute
14 void ModelAPI_Attribute::setObject(const std::shared_ptr<ModelAPI_Object>& theObject)
15 {
16   myObject = theObject;
17 }
18
19   /// Returns the owner of this attribute
20 const std::shared_ptr<ModelAPI_Object>& ModelAPI_Attribute::owner() const
21 {
22   return myObject;
23 }
24
25   /// Returns true if attribute was  initialized by some value
26 bool ModelAPI_Attribute::isInitialized()
27 {
28   return myIsInitialized;
29 }
30
31 void ModelAPI_Attribute::setInitialized()
32 {
33   if (!mySetInitializedBlocked)
34     myIsInitialized = true;
35 }
36
37 bool ModelAPI_Attribute::blockSetInitialized(const bool theBlock)
38 {
39   bool aBlocked = mySetInitializedBlocked;
40
41   mySetInitializedBlocked = theBlock;
42
43   return aBlocked;
44 }
45
46 void ModelAPI_Attribute::setIsArgument(const bool theFlag)
47 {
48   myIsArgument = theFlag;
49 }
50
51 bool ModelAPI_Attribute::isArgument()
52 {
53   return myIsArgument;
54 }
55
56 bool ModelAPI_Attribute::setImmutable(const bool theFlag)
57 {
58   bool aResult = myIsImmutable;
59   myIsImmutable = theFlag;
60   return aResult;
61 }
62
63 bool ModelAPI_Attribute::isImmutable()
64 {
65   return myIsImmutable;
66 }
67
68 const std::string& ModelAPI_Attribute::id() const
69 {
70   return myID;
71 }
72
73 ModelAPI_Attribute::ModelAPI_Attribute()
74 {
75   mySetInitializedBlocked = false;
76   myIsInitialized = false;
77   myIsArgument = true;
78   myIsImmutable = false;
79 }
80
81   /// Sets the ID of the attribute in Data (called from Data)
82 void ModelAPI_Attribute::setID(const std::string theID)
83 {
84   myID = theID;
85 }
86
87 void ModelAPI_Attribute::reinit() {}
88
89 void ModelAPI_Attribute::reset()
90 {
91   myIsInitialized = false;
92 }