Salome HOME
merge from branch BR_For40_DSC tag mergeto_BR_Dev_For_4_0_16apr07
[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 #ifdef WNT
28 # ifdef SALOMEDSIMPL_EXPORTS
29 #  define SALOMEDSIMPL_EXPORT __declspec( dllexport )
30 # else
31 #  define SALOMEDSIMPL_EXPORT __declspec( dllimport )
32 # endif
33 #else
34 # define SALOMEDSIMPL_EXPORT
35 #endif
36
37 #include <iostream>
38 class SALOMEDSIMPL_EXPORT LockProtection
39 {
40 public :
41   LockProtection(const char *message) {
42     std::cerr << message << std::endl;
43   }
44 }; 
45
46 #include "SALOMEDSImpl_GenericAttribute.hxx"
47 #include "SALOMEDSImpl_AttributeName.hxx"
48 #include "SALOMEDSImpl_AttributeComment.hxx"
49 #include "SALOMEDSImpl_AttributeInteger.hxx"
50 #include "SALOMEDSImpl_AttributeReal.hxx"
51 #include "SALOMEDSImpl_AttributeTreeNode.hxx"
52 #include "SALOMEDSImpl_AttributeUserID.hxx"
53 #include "SALOMEDSImpl_AttributeReference.hxx"
54 #include "SALOMEDSImpl_AttributeSequenceOfReal.hxx"
55 #include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx" 
56 #include "SALOMEDSImpl_AttributeIOR.hxx"
57 #include "SALOMEDSImpl_AttributePersistentRef.hxx" 
58 #include "SALOMEDSImpl_AttributeDrawable.hxx"
59 #include "SALOMEDSImpl_AttributeSelectable.hxx"
60 #include "SALOMEDSImpl_AttributeExpandable.hxx"
61 #include "SALOMEDSImpl_AttributeOpened.hxx"
62 #include "SALOMEDSImpl_AttributeTextColor.hxx"
63 #include "SALOMEDSImpl_AttributeTextHighlightColor.hxx"
64 #include "SALOMEDSImpl_AttributePixMap.hxx"
65 #include "SALOMEDSImpl_AttributeLocalID.hxx"
66 #include "SALOMEDSImpl_AttributeTarget.hxx"
67 #include "SALOMEDSImpl_AttributeTableOfInteger.hxx"
68 #include "SALOMEDSImpl_AttributeTableOfReal.hxx"
69 #include "SALOMEDSImpl_AttributeTableOfString.hxx"
70 #include "SALOMEDSImpl_AttributeStudyProperties.hxx"
71 #include "SALOMEDSImpl_AttributePythonObject.hxx"
72 #include "SALOMEDSImpl_AttributeExternalFileDef.hxx"
73 #include "SALOMEDSImpl_AttributeFileType.hxx"
74 #include "SALOMEDSImpl_AttributeFlags.hxx"
75 #include "SALOMEDSImpl_AttributeGraphic.hxx"
76 #include "SALOMEDSImpl_AttributeParameter.hxx"
77 #include "SALOMEDSImpl_AttributeString.hxx"
78
79
80 #define __AttributeTypeToGUIDForSObject \
81         if(theType == "AttributeReal") return SALOMEDSImpl_AttributeReal::GetID(); \
82         if(theType == "AttributeInteger") return SALOMEDSImpl_AttributeInteger::GetID(); \
83         if(theType == "AttributeSequenceOfReal") return SALOMEDSImpl_AttributeSequenceOfReal::GetID(); \
84         if(theType == "AttributeSequenceOfInteger") return SALOMEDSImpl_AttributeSequenceOfInteger::GetID(); \
85         if(theType == "AttributeName") return SALOMEDSImpl_AttributeName::GetID(); \
86         if(theType == "AttributeComment") return SALOMEDSImpl_AttributeComment::GetID(); \
87         if(theType == "AttributeIOR") return SALOMEDSImpl_AttributeIOR::GetID(); \
88         if(theType == "AttributePersistentRef") return SALOMEDSImpl_AttributePersistentRef::GetID(); \
89         if(theType == "AttributeDrawable") return SALOMEDSImpl_AttributeDrawable::GetID(); \
90         if(theType == "AttributeSelectable") return SALOMEDSImpl_AttributeSelectable::GetID(); \
91         if(theType == "AttributeExpandable") return SALOMEDSImpl_AttributeExpandable::GetID(); \
92         if(theType == "AttributeOpened") return SALOMEDSImpl_AttributeOpened::GetID(); \
93         if(theType == "AttributeTextColor") return SALOMEDSImpl_AttributeTextColor::GetID(); \
94         if(theType == "AttributeTextHighlightColor") return SALOMEDSImpl_AttributeTextHighlightColor::GetID(); \
95         if(theType == "AttributePixMap") return SALOMEDSImpl_AttributePixMap::GetID(); \
96         if(theType == "AttributeLocalID") return SALOMEDSImpl_AttributeLocalID::GetID(); \
97         if(theType == "AttributeTarget") return SALOMEDSImpl_AttributeTarget::GetID(); \
98         if(theType == "AttributeTableOfInteger") return SALOMEDSImpl_AttributeTableOfInteger::GetID(); \
99         if(theType == "AttributeTableOfReal") return SALOMEDSImpl_AttributeTableOfReal::GetID();  \
100         if(theType == "AttributeTableOfString") return SALOMEDSImpl_AttributeTableOfString::GetID(); \
101         if(theType == "AttributeStudyProperties") return SALOMEDSImpl_AttributeStudyProperties::GetID(); \
102         if(theType == "AttributePythonObject") return SALOMEDSImpl_AttributePythonObject::GetID(); \
103         if(theType == "AttributeUserID") return Standard_GUID("FFFFFFFF-D9CD-11d6-945D-1050DA506788"); \
104         if(theType == "AttributeExternalFileDef") return SALOMEDSImpl_AttributeExternalFileDef::GetID(); \
105         if(theType == "AttributeFileType") return SALOMEDSImpl_AttributeFileType::GetID(); \
106         if(theType == "AttributeFlags") return SALOMEDSImpl_AttributeFlags::GetID(); \
107         if(theType == "AttributeGraphic") return SALOMEDSImpl_AttributeGraphic::GetID(); \
108         if(theType == "AttributeReference") return SALOMEDSImpl_AttributeReference::GetID(); \
109         if(theType == "AttributeParameter") return SALOMEDSImpl_AttributeParameter::GetID(); \
110         if(theType == "AttributeString") return SALOMEDSImpl_AttributeString::GetID();
111
112
113 #define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \
114     Handle(SALOMEDSImpl_##ClassName) anAttr; \
115     if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \
116       CheckLocked(); \
117       anAttr = new SALOMEDSImpl_##ClassName; \
118       Lab.AddAttribute(anAttr); \
119     } \
120     return anAttr; \
121   }   
122
123 #define __FindOrCreateAttribute(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \
124     Handle(SALOMEDSImpl_##ClassName) anAttr; \
125     if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \
126       anAttr = new SALOMEDSImpl_##ClassName; \
127       Lab.AddAttribute(anAttr); \
128     } \
129     return anAttr; \
130   }      
131
132 #define __FindOrCreateAttributeForBuilder \
133 __FindOrCreateAttributeLocked(AttributeReal) \
134 __FindOrCreateAttributeLocked(AttributeInteger) \
135 __FindOrCreateAttributeLocked(AttributeSequenceOfReal) \
136 __FindOrCreateAttributeLocked(AttributeSequenceOfInteger) \
137 __FindOrCreateAttributeLocked(AttributeName) \
138 __FindOrCreateAttributeLocked(AttributeComment) \
139 __FindOrCreateAttributeLocked(AttributeIOR) \
140 __FindOrCreateAttributeLocked(AttributePixMap) \
141 __FindOrCreateAttributeLocked(AttributeLocalID) \
142 __FindOrCreateAttributeLocked(AttributeTableOfInteger) \
143 __FindOrCreateAttributeLocked(AttributeTableOfReal) \
144 __FindOrCreateAttributeLocked(AttributeTableOfString) \
145 __FindOrCreateAttributeLocked(AttributePythonObject) \
146 __FindOrCreateAttributeLocked(AttributeParameter) \
147 __FindOrCreateAttributeLocked(AttributeString) \
148 __FindOrCreateAttribute(AttributePersistentRef) \
149 __FindOrCreateAttribute(AttributeDrawable) \
150 __FindOrCreateAttribute(AttributeSelectable) \
151 __FindOrCreateAttribute(AttributeExpandable) \
152 __FindOrCreateAttribute(AttributeOpened) \
153 __FindOrCreateAttribute(AttributeTextColor) \
154 __FindOrCreateAttribute(AttributeTextHighlightColor) \
155 __FindOrCreateAttribute(AttributeTarget) \
156 __FindOrCreateAttribute(AttributeStudyProperties) \
157 __FindOrCreateAttribute(AttributeExternalFileDef) \
158 __FindOrCreateAttribute(AttributeFileType) \
159 __FindOrCreateAttribute(AttributeFlags) \
160 __FindOrCreateAttribute(AttributeGraphic)
161
162
163 #endif