Salome HOME
PAL13002: EDF231 Salome ask if we want to save the study even if it was just done.
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_Attributes.hxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //  File   : SALOMEDSImpl_Attributes.hxx
21 //  Author : Sergey RUIN
22 //  Module : SALOME
23
24 #ifndef __SALOMEDSIMPL_ATTRIBUTES__H__
25 #define __SALOMEDSIMPL_ATTRIBUTES__H__
26
27 #include <iostream>
28 class LockProtection
29 {
30 public :
31   LockProtection(const char *message) {
32     std::cerr << message << std::endl;
33   }
34 }; 
35
36 #include "SALOMEDSImpl_GenericAttribute.hxx"
37 #include "SALOMEDSImpl_AttributeName.hxx"
38 #include "SALOMEDSImpl_AttributeComment.hxx"
39 #include "SALOMEDSImpl_AttributeInteger.hxx"
40 #include "SALOMEDSImpl_AttributeReal.hxx"
41 #include "SALOMEDSImpl_AttributeTreeNode.hxx"
42 #include "SALOMEDSImpl_AttributeUserID.hxx"
43 #include "SALOMEDSImpl_AttributeReference.hxx"
44 #include "SALOMEDSImpl_AttributeSequenceOfReal.hxx"
45 #include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx" 
46 #include "SALOMEDSImpl_AttributeIOR.hxx"
47 #include "SALOMEDSImpl_AttributePersistentRef.hxx" 
48 #include "SALOMEDSImpl_AttributeDrawable.hxx"
49 #include "SALOMEDSImpl_AttributeSelectable.hxx"
50 #include "SALOMEDSImpl_AttributeExpandable.hxx"
51 #include "SALOMEDSImpl_AttributeOpened.hxx"
52 #include "SALOMEDSImpl_AttributeTextColor.hxx"
53 #include "SALOMEDSImpl_AttributeTextHighlightColor.hxx"
54 #include "SALOMEDSImpl_AttributePixMap.hxx"
55 #include "SALOMEDSImpl_AttributeLocalID.hxx"
56 #include "SALOMEDSImpl_AttributeTarget.hxx"
57 #include "SALOMEDSImpl_AttributeTableOfInteger.hxx"
58 #include "SALOMEDSImpl_AttributeTableOfReal.hxx"
59 #include "SALOMEDSImpl_AttributeTableOfString.hxx"
60 #include "SALOMEDSImpl_AttributeStudyProperties.hxx"
61 #include "SALOMEDSImpl_AttributePythonObject.hxx"
62 #include "SALOMEDSImpl_AttributeExternalFileDef.hxx"
63 #include "SALOMEDSImpl_AttributeFileType.hxx"
64 #include "SALOMEDSImpl_AttributeFlags.hxx"
65 #include "SALOMEDSImpl_AttributeGraphic.hxx"
66 #include "SALOMEDSImpl_AttributeParameter.hxx"
67
68
69 #define __AttributeTypeToGUIDForSObject \
70         if(theType == "AttributeReal") return SALOMEDSImpl_AttributeReal::GetID(); \
71         if(theType == "AttributeInteger") return SALOMEDSImpl_AttributeInteger::GetID(); \
72         if(theType == "AttributeSequenceOfReal") return SALOMEDSImpl_AttributeSequenceOfReal::GetID(); \
73         if(theType == "AttributeSequenceOfInteger") return SALOMEDSImpl_AttributeSequenceOfInteger::GetID(); \
74         if(theType == "AttributeName") return SALOMEDSImpl_AttributeName::GetID(); \
75         if(theType == "AttributeComment") return SALOMEDSImpl_AttributeComment::GetID(); \
76         if(theType == "AttributeIOR") return SALOMEDSImpl_AttributeIOR::GetID(); \
77         if(theType == "AttributePersistentRef") return SALOMEDSImpl_AttributePersistentRef::GetID(); \
78         if(theType == "AttributeDrawable") return SALOMEDSImpl_AttributeDrawable::GetID(); \
79         if(theType == "AttributeSelectable") return SALOMEDSImpl_AttributeSelectable::GetID(); \
80         if(theType == "AttributeExpandable") return SALOMEDSImpl_AttributeExpandable::GetID(); \
81         if(theType == "AttributeOpened") return SALOMEDSImpl_AttributeOpened::GetID(); \
82         if(theType == "AttributeTextColor") return SALOMEDSImpl_AttributeTextColor::GetID(); \
83         if(theType == "AttributeTextHighlightColor") return SALOMEDSImpl_AttributeTextHighlightColor::GetID(); \
84         if(theType == "AttributePixMap") return SALOMEDSImpl_AttributePixMap::GetID(); \
85         if(theType == "AttributeLocalID") return SALOMEDSImpl_AttributeLocalID::GetID(); \
86         if(theType == "AttributeTarget") return SALOMEDSImpl_AttributeTarget::GetID(); \
87         if(theType == "AttributeTableOfInteger") return SALOMEDSImpl_AttributeTableOfInteger::GetID(); \
88         if(theType == "AttributeTableOfReal") return SALOMEDSImpl_AttributeTableOfReal::GetID();  \
89         if(theType == "AttributeTableOfString") return SALOMEDSImpl_AttributeTableOfString::GetID(); \
90         if(theType == "AttributeStudyProperties") return SALOMEDSImpl_AttributeStudyProperties::GetID(); \
91         if(theType == "AttributePythonObject") return SALOMEDSImpl_AttributePythonObject::GetID(); \
92         if(theType == "AttributeUserID") return Standard_GUID("FFFFFFFF-D9CD-11d6-945D-1050DA506788"); \
93         if(theType == "AttributeExternalFileDef") return SALOMEDSImpl_AttributeExternalFileDef::GetID(); \
94         if(theType == "AttributeFileType") return SALOMEDSImpl_AttributeFileType::GetID(); \
95         if(theType == "AttributeFlags") return SALOMEDSImpl_AttributeFlags::GetID(); \
96         if(theType == "AttributeGraphic") return SALOMEDSImpl_AttributeGraphic::GetID(); \
97         if(theType == "AttributeReference") return SALOMEDSImpl_AttributeReference::GetID(); \
98         if(theType == "AttributeParameter") return SALOMEDSImpl_AttributeParameter::GetID();
99
100
101 #define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \
102     Handle(SALOMEDSImpl_##ClassName) anAttr; \
103     if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \
104       CheckLocked(); \
105       anAttr = new SALOMEDSImpl_##ClassName; \
106       Lab.AddAttribute(anAttr); \
107     } \
108     return anAttr; \
109   }   
110
111 #define __FindOrCreateAttribute(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \
112     Handle(SALOMEDSImpl_##ClassName) anAttr; \
113     if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \
114       anAttr = new SALOMEDSImpl_##ClassName; \
115       Lab.AddAttribute(anAttr); \
116     } \
117     return anAttr; \
118   }      
119
120 #define __FindOrCreateAttributeForBuilder \
121 __FindOrCreateAttributeLocked(AttributeReal) \
122 __FindOrCreateAttributeLocked(AttributeInteger) \
123 __FindOrCreateAttributeLocked(AttributeSequenceOfReal) \
124 __FindOrCreateAttributeLocked(AttributeSequenceOfInteger) \
125 __FindOrCreateAttributeLocked(AttributeName) \
126 __FindOrCreateAttributeLocked(AttributeComment) \
127 __FindOrCreateAttributeLocked(AttributeIOR) \
128 __FindOrCreateAttributeLocked(AttributePixMap) \
129 __FindOrCreateAttributeLocked(AttributeLocalID) \
130 __FindOrCreateAttributeLocked(AttributeTableOfInteger) \
131 __FindOrCreateAttributeLocked(AttributeTableOfReal) \
132 __FindOrCreateAttributeLocked(AttributeTableOfString) \
133 __FindOrCreateAttributeLocked(AttributePythonObject) \
134 __FindOrCreateAttributeLocked(AttributeParameter) \
135 __FindOrCreateAttribute(AttributePersistentRef) \
136 __FindOrCreateAttribute(AttributeDrawable) \
137 __FindOrCreateAttribute(AttributeSelectable) \
138 __FindOrCreateAttribute(AttributeExpandable) \
139 __FindOrCreateAttribute(AttributeOpened) \
140 __FindOrCreateAttribute(AttributeTextColor) \
141 __FindOrCreateAttribute(AttributeTextHighlightColor) \
142 __FindOrCreateAttribute(AttributeTarget) \
143 __FindOrCreateAttribute(AttributeStudyProperties) \
144 __FindOrCreateAttribute(AttributeExternalFileDef) \
145 __FindOrCreateAttribute(AttributeFileType) \
146 __FindOrCreateAttribute(AttributeFlags) \
147 __FindOrCreateAttribute(AttributeGraphic)
148
149
150 #endif