1 // SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOMEDS_SObject_i.cxx
25 // Author : Yves FRICAUD
30 #include "utilities.h"
31 #include "SALOMEDS_SObject_i.hxx"
33 #include "SALOMEDS_SComponent_i.hxx"
34 #include "SALOMEDS_IORAttribute.hxx"
35 #include "SALOMEDS_PersRefAttribute.hxx"
36 #include "SALOMEDS_SequenceOfRealAttribute.hxx"
37 #include "SALOMEDS_SequenceOfIntegerAttribute.hxx"
38 #include "SALOMEDS_TableOfRealAttribute.hxx"
39 #include "SALOMEDS_TableOfIntegerAttribute.hxx"
40 #include "SALOMEDS_IORAttribute.hxx"
41 #include "SALOMEDS_PersRefAttribute.hxx"
42 #include "SALOMEDS_StudyPropertiesAttribute.hxx"
43 #include "SALOMEDS_PythonObjectAttribute.hxx"
44 #include "SALOMEDS_AttributePersistentRef_i.hxx"
45 #include "SALOMEDS_AttributeIOR_i.hxx"
46 #include "SALOMEDS_AttributeComment_i.hxx"
47 #include "SALOMEDS_AttributeName_i.hxx"
48 #include "SALOMEDS_AttributeSequenceOfInteger_i.hxx"
49 #include "SALOMEDS_AttributeSequenceOfReal_i.hxx"
50 #include "SALOMEDS_AttributeInteger_i.hxx"
51 #include "SALOMEDS_AttributeReal_i.hxx"
52 #include "SALOMEDS_AttributeDrawable_i.hxx"
53 #include "SALOMEDS_AttributeSelectable_i.hxx"
54 #include "SALOMEDS_AttributeExpandable_i.hxx"
55 #include "SALOMEDS_AttributeOpened_i.hxx"
56 #include "SALOMEDS_AttributeTextColor_i.hxx"
57 #include "SALOMEDS_AttributeTextHighlightColor_i.hxx"
58 #include "SALOMEDS_AttributePixMap_i.hxx"
59 #include "SALOMEDS_AttributeTreeNode_i.hxx"
60 #include "SALOMEDS_AttributeLocalID_i.hxx"
61 #include "SALOMEDS_AttributeUserID_i.hxx"
62 #include "SALOMEDS_AttributeTarget_i.hxx"
63 #include "SALOMEDS_AttributeTableOfInteger_i.hxx"
64 #include "SALOMEDS_AttributeTableOfReal_i.hxx"
65 #include "SALOMEDS_AttributeTableOfString_i.hxx"
66 #include "SALOMEDS_AttributeStudyProperties_i.hxx"
67 #include "SALOMEDS_AttributePythonObject_i.hxx"
68 #include <TDF_AttributeIterator.hxx>
70 //============================================================================
71 /*! Function : ReturnGUIDForAttribute
74 //============================================================================
77 SALOMEDS_SObject_i::ReturnGUIDForAttribute(const char* aTypeOfAttribute)
81 if (strcmp(aTypeOfAttribute, "AttributeReal") == 0 ) return TDataStd_Real::GetID();
82 else if (strcmp(aTypeOfAttribute, "AttributeInteger") == 0 ) return TDataStd_Integer::GetID();
83 else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfReal") == 0 ) return SALOMEDS_SequenceOfRealAttribute::GetID();
84 else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfInteger") == 0 ) return SALOMEDS_SequenceOfIntegerAttribute::GetID();
85 else if (strcmp(aTypeOfAttribute, "AttributeName") == 0 ) return TDataStd_Name::GetID();
86 else if (strcmp(aTypeOfAttribute, "AttributeComment") == 0 ) return TDataStd_Comment::GetID();
87 else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) return SALOMEDS_IORAttribute::GetID();
88 else if (strcmp(aTypeOfAttribute, "AttributePersistentRef") == 0 ) return SALOMEDS_PersRefAttribute::GetID();
89 else if (strcmp(aTypeOfAttribute, "AttributeDrawable") == 0 ) return SALOMEDS_DrawableAttribute::GetID();
90 else if (strcmp(aTypeOfAttribute, "AttributeSelectable") == 0 ) return SALOMEDS_SelectableAttribute::GetID();
91 else if (strcmp(aTypeOfAttribute, "AttributeExpandable") == 0 ) return SALOMEDS_ExpandableAttribute::GetID();
92 else if (strcmp(aTypeOfAttribute, "AttributeOpened") == 0 ) return SALOMEDS_OpenedAttribute::GetID();
93 else if (strcmp(aTypeOfAttribute, "AttributeTextColor") == 0 ) return SALOMEDS_TextColorAttribute::GetID();
94 else if (strcmp(aTypeOfAttribute, "AttributeTextHighlightColor") == 0 ) return SALOMEDS_TextHighlightColorAttribute::GetID();
95 else if (strcmp(aTypeOfAttribute, "AttributePixMap") == 0 ) return SALOMEDS_PixMapAttribute::GetID();
96 else if (strcmp(aTypeOfAttribute, "AttributeTreeNode") == 0 ) return TDataStd_TreeNode::GetDefaultTreeID();
97 else if (strcmp(aTypeOfAttribute, "AttributeLocalID") == 0 ) return SALOMEDS_LocalIDAttribute::GetID();
98 else if (strcmp(aTypeOfAttribute, "AttributeTarget") == 0 ) return SALOMEDS_TargetAttribute::GetID();
99 else if (strcmp(aTypeOfAttribute, "AttributeTableOfInteger") == 0 ) return SALOMEDS_TableOfIntegerAttribute::GetID();
100 else if (strcmp(aTypeOfAttribute, "AttributeTableOfReal") == 0 ) return SALOMEDS_TableOfRealAttribute::GetID();
101 else if (strcmp(aTypeOfAttribute, "AttributeTableOfString") == 0 ) return SALOMEDS_TableOfStringAttribute::GetID();
102 else if (strcmp(aTypeOfAttribute, "AttributeStudyProperties") == 0 ) return SALOMEDS_StudyPropertiesAttribute::GetID();
103 else if (strcmp(aTypeOfAttribute, "AttributePythonObject") == 0 ) return SALOMEDS_PythonObjectAttribute::GetID();
104 else if (strcmp(aTypeOfAttribute, "AttributeUserID") == 0 ) return SALOMEDS_AttributeUserID_i::DefaultID();
105 else if (strncmp(aTypeOfAttribute,"AttributeTreeNodeGUID",21) == 0) {
106 char* aGUIDString = new char[40];
107 sprintf(aGUIDString, &(aTypeOfAttribute[21]));
108 Standard_GUID aGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
112 else Standard_NoSuchObject::Raise("SALOMEDS_SObject_i::ReturnGUIDForAttribute");
115 //============================================================================
116 /*! Function : AttributeIDToType
119 //============================================================================
120 char* SALOMEDS_SObject_i::AttributeIDToType(Standard_GUID ID)
122 if (ID == TDataStd_Name::GetID()) return "AttributeName";
123 else if (ID == TDataStd_Comment::GetID()) return "AttributeComment";
124 else if (ID == SALOMEDS_IORAttribute::GetID()) return "AttributeIOR";
125 else if (ID == SALOMEDS_PersRefAttribute::GetID()) return "AttributePersistentRef";
126 else if (ID == TDataStd_Real::GetID()) return "AttributeReal";
127 else if (ID == TDataStd_Integer::GetID()) return "AttributeInteger";
128 else if (ID == SALOMEDS_SequenceOfRealAttribute::GetID()) return "AttributeSequenceOfReal";
129 else if (ID == SALOMEDS_SequenceOfIntegerAttribute::GetID()) return "AttributeSequenceOfInteger";
130 else if (ID == SALOMEDS_DrawableAttribute::GetID()) return "AttributeDrawable";
131 else if (ID == SALOMEDS_SelectableAttribute::GetID()) return "AttributeSelectable";
132 else if (ID == SALOMEDS_ExpandableAttribute::GetID()) return "AttributeExpandable";
133 else if (ID == SALOMEDS_OpenedAttribute::GetID()) return "AttributeOpened";
134 else if (ID == SALOMEDS_TextColorAttribute::GetID()) return "AttributeTextColor";
135 else if (ID == SALOMEDS_TextHighlightColorAttribute::GetID()) return "AttributeTextHighlightColor";
136 else if (ID == SALOMEDS_PixMapAttribute::GetID()) return "AttributePixMap";
137 else if (ID == TDataStd_TreeNode::GetDefaultTreeID()) return "AttributeTreeNode";
138 else if (ID == SALOMEDS_LocalIDAttribute::GetID()) return "AttributeLocalID";
139 else if (ID == SALOMEDS_TargetAttribute::GetID()) return "AttributeTarget";
140 else if (ID == SALOMEDS_TableOfIntegerAttribute::GetID()) return "AttributeTableOfInteger";
141 else if (ID == SALOMEDS_TableOfRealAttribute::GetID()) return "AttributeTableOfReal";
142 else if (ID == SALOMEDS_TableOfStringAttribute::GetID()) return "AttributeTableOfString";
143 else if (ID == SALOMEDS_StudyPropertiesAttribute::GetID()) return "AttributeStudyProperties";
144 else if (ID == SALOMEDS_PythonObjectAttribute::GetID()) return "AttributePythonObject";
145 else if (ID == SALOMEDS_AttributeUserID_i::DefaultID()) return "AttributeUserID";
146 // 08.01.2003 mpv: this method must be called only for attributes with constant GUID
147 else Standard_NoSuchObject::Raise("SALOMEDS_SObject_i::AttributeIDToType");
151 //============================================================================
152 /*! Function : constructor
155 //============================================================================
156 SALOMEDS_SObject_i::SALOMEDS_SObject_i(const TDF_Label lab, CORBA::ORB_ptr orb)
159 _orb = CORBA::ORB::_duplicate(orb);
163 _liste_ba_type.resize(0);
167 //============================================================================
168 /*! Function : destructor
171 //============================================================================
172 SALOMEDS_SObject_i::~SALOMEDS_SObject_i()
174 CORBA::string_free(_value);
175 CORBA::string_free(_type);
176 CORBA::string_free(_name);
180 //============================================================================
184 //============================================================================
185 char* SALOMEDS_SObject_i::GetID()
187 TCollection_AsciiString anEntry;
188 TDF_Tool::Entry (_lab,anEntry);
189 return CORBA::string_dup(anEntry.ToCString());
192 //============================================================================
196 //============================================================================
197 SALOMEDS::SComponent_ptr SALOMEDS_SObject_i::GetFatherComponent()
200 while (!SALOMEDS_SComponent_i::IsA(LF) && !LF.IsRoot()) {
203 SALOMEDS_SComponent_i * so_servant = new SALOMEDS_SComponent_i (LF,_orb);
204 SALOMEDS::SComponent_var so;
205 so= SALOMEDS::SComponent::_narrow(so_servant->SComponent::_this());
209 //============================================================================
213 //============================================================================
214 SALOMEDS::SObject_ptr SALOMEDS_SObject_i::GetFather()
216 TDF_Label LF = _lab.Father();
218 SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (LF,_orb);
219 SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this());
223 //============================================================================
227 //============================================================================
228 SALOMEDS::Study_ptr SALOMEDS_SObject_i::GetStudy()
230 TDF_Label Root = _lab.Root();
231 Handle(SALOMEDS_IORAttribute) Att;
233 if (Root.FindAttribute(SALOMEDS_IORAttribute::GetID(),Att)){
234 TCollection_AsciiString ch(Att->Get());
235 IOR = CORBA::string_dup(ch.ToCString());
236 CORBA::Object_var obj = _orb->string_to_object(IOR);
237 SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(obj) ;
238 ASSERT(!CORBA::is_nil(Study));
239 return SALOMEDS::Study::_duplicate(Study); //return Study = abort...
241 INFOS("Problem GetStudy");
242 return SALOMEDS::Study::_nil();
245 //============================================================================
246 /*! Function : FindAttribute
247 * Purpose : Find attribute of given type on this SObject
249 //============================================================================
250 CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out anAttribute,
251 const char* aTypeOfAttribute)
253 Handle(TDF_Attribute) anAttr;
254 Standard_Boolean found = _lab.FindAttribute(SALOMEDS_SObject_i::ReturnGUIDForAttribute(aTypeOfAttribute), anAttr);
256 if (strcmp(aTypeOfAttribute, "AttributeReal") == 0 ) {
257 SALOMEDS_AttributeReal_i* Attr = new SALOMEDS_AttributeReal_i(Handle(TDataStd_Real)::DownCast(anAttr), _orb);
258 anAttribute = Attr->AttributeReal::_this();
259 return Standard_True;
261 else if (strcmp(aTypeOfAttribute, "AttributeInteger") == 0 ) {
262 SALOMEDS_AttributeInteger_i* Attr = new SALOMEDS_AttributeInteger_i(Handle(TDataStd_Integer)::DownCast(anAttr), _orb);
263 anAttribute = Attr->AttributeInteger::_this();
264 return Standard_True;
266 else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfReal") == 0 ) {
267 SALOMEDS_AttributeSequenceOfReal_i* Attr = new SALOMEDS_AttributeSequenceOfReal_i(Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(anAttr), _orb);
268 anAttribute = Attr->AttributeSequenceOfReal::_this();
269 return Standard_True;
271 else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfInteger") == 0 ) {
272 SALOMEDS_AttributeSequenceOfInteger_i* Attr = new SALOMEDS_AttributeSequenceOfInteger_i(Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(anAttr), _orb);
273 anAttribute = Attr->AttributeSequenceOfInteger::_this();
274 return Standard_True;
276 else if (strcmp(aTypeOfAttribute, "AttributeName") == 0 ) {
277 SALOMEDS_AttributeName_i* Attr = new SALOMEDS_AttributeName_i(Handle(TDataStd_Name)::DownCast(anAttr), _orb);
278 anAttribute = Attr->AttributeName::_this();
279 return Standard_True;
281 else if (strcmp(aTypeOfAttribute, "AttributeComment") == 0 ) {
282 SALOMEDS_AttributeComment_i* Attr = new SALOMEDS_AttributeComment_i(Handle(TDataStd_Comment)::DownCast(anAttr), _orb);
283 anAttribute = Attr->AttributeComment::_this();
284 return Standard_True;
286 else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) {
287 SALOMEDS_AttributeIOR_i* Attr = new SALOMEDS_AttributeIOR_i(Handle(SALOMEDS_IORAttribute)::DownCast(anAttr), _orb);
288 anAttribute = Attr->AttributeIOR::_this();
289 return Standard_True;
291 else if (strcmp(aTypeOfAttribute, "AttributePersistentRef") == 0 ) {
292 SALOMEDS_AttributePersistentRef_i* Attr = new SALOMEDS_AttributePersistentRef_i(Handle(SALOMEDS_PersRefAttribute)::DownCast(anAttr), _orb);
293 anAttribute = Attr->AttributePersistentRef::_this();
294 return Standard_True;
296 else if (strcmp(aTypeOfAttribute, "AttributeDrawable") == 0 ) {
297 SALOMEDS_AttributeDrawable_i* Attr = new SALOMEDS_AttributeDrawable_i(Handle(SALOMEDS_DrawableAttribute)::DownCast(anAttr), _orb);
298 anAttribute = Attr->AttributeDrawable::_this();
299 return Standard_True;
301 else if (strcmp(aTypeOfAttribute, "AttributeSelectable") == 0 ) {
302 SALOMEDS_AttributeSelectable_i* Attr= new SALOMEDS_AttributeSelectable_i(Handle(SALOMEDS_SelectableAttribute)::DownCast(anAttr), _orb);
303 anAttribute = Attr->AttributeSelectable::_this();
304 return Standard_True;
306 else if (strcmp(aTypeOfAttribute, "AttributeExpandable") == 0 ) {
307 SALOMEDS_AttributeExpandable_i* Attr = new SALOMEDS_AttributeExpandable_i(Handle(SALOMEDS_ExpandableAttribute)::DownCast(anAttr), _orb);
308 anAttribute = Attr->AttributeExpandable::_this();
309 return Standard_True;
311 else if (strcmp(aTypeOfAttribute, "AttributeOpened") == 0 ) {
312 SALOMEDS_AttributeOpened_i* Attr= new SALOMEDS_AttributeOpened_i(Handle(SALOMEDS_OpenedAttribute)::DownCast(anAttr), _orb);
313 anAttribute = Attr->AttributeOpened::_this();
314 return Standard_True;
316 else if (strcmp(aTypeOfAttribute, "AttributeTextColor") == 0 ) {
317 SALOMEDS_AttributeTextColor_i* Attr= new SALOMEDS_AttributeTextColor_i(Handle(SALOMEDS_TextColorAttribute)::DownCast(anAttr), _orb);
318 anAttribute = Attr->AttributeTextColor::_this();
319 return Standard_True;
321 else if (strcmp(aTypeOfAttribute, "AttributeTextHighlightColor") == 0 ) {
322 SALOMEDS_AttributeTextHighlightColor_i* Attr= new SALOMEDS_AttributeTextHighlightColor_i(Handle(SALOMEDS_TextHighlightColorAttribute)::DownCast(anAttr), _orb);
323 anAttribute = Attr->AttributeTextHighlightColor::_this();
324 return Standard_True;
326 else if (strcmp(aTypeOfAttribute, "AttributePixMap") == 0 ) {
327 SALOMEDS_AttributePixMap_i* Attr= new SALOMEDS_AttributePixMap_i(Handle(SALOMEDS_PixMapAttribute)::DownCast(anAttr), _orb);
328 anAttribute = Attr->AttributePixMap::_this();
329 return Standard_True;
331 else if (strncmp(aTypeOfAttribute, "AttributeTreeNode",17) == 0 ) {
332 SALOMEDS_AttributeTreeNode_i* Attr= new SALOMEDS_AttributeTreeNode_i(Handle(TDataStd_TreeNode)::DownCast(anAttr), _orb);
333 anAttribute = Attr->AttributeTreeNode::_this();
334 return Standard_True;
336 else if (strcmp(aTypeOfAttribute, "AttributeLocalID") == 0 ) {
337 SALOMEDS_AttributeLocalID_i* Attr= new SALOMEDS_AttributeLocalID_i(Handle(SALOMEDS_LocalIDAttribute)::DownCast(anAttr), _orb);
338 anAttribute = Attr->AttributeLocalID::_this();
339 return Standard_True;
341 else if (strncmp(aTypeOfAttribute, "AttributeUserID",15) == 0 ) {
342 SALOMEDS_AttributeUserID_i* Attr= new SALOMEDS_AttributeUserID_i(Handle(TDataStd_UAttribute)::DownCast(anAttr), _orb);
343 anAttribute = Attr->AttributeUserID::_this();
344 return Standard_True;
346 else if (strcmp(aTypeOfAttribute, "AttributeTarget") == 0 ) {
347 SALOMEDS_AttributeTarget_i* Attr= new SALOMEDS_AttributeTarget_i(Handle(SALOMEDS_TargetAttribute)::DownCast(anAttr), _orb);
348 anAttribute = Attr->AttributeTarget::_this();
349 return Standard_True;
351 else if (strcmp(aTypeOfAttribute, "AttributeTableOfInteger") == 0 ) {
352 SALOMEDS_AttributeTableOfInteger_i* Attr = new SALOMEDS_AttributeTableOfInteger_i(Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(anAttr), _orb);
353 anAttribute = Attr->AttributeTableOfInteger::_this();
354 return Standard_True;
356 else if (strcmp(aTypeOfAttribute, "AttributeTableOfReal") == 0 ) {
357 SALOMEDS_AttributeTableOfReal_i* Attr = new SALOMEDS_AttributeTableOfReal_i(Handle(SALOMEDS_TableOfRealAttribute)::DownCast(anAttr), _orb);
358 anAttribute = Attr->AttributeTableOfReal::_this();
359 return Standard_True;
361 else if (strcmp(aTypeOfAttribute, "AttributeTableOfString") == 0 ) {
362 SALOMEDS_AttributeTableOfString_i* Attr = new SALOMEDS_AttributeTableOfString_i(Handle(SALOMEDS_TableOfStringAttribute)::DownCast(anAttr), _orb);
363 anAttribute = Attr->AttributeTableOfString::_this();
364 return Standard_True;
366 else if (strcmp(aTypeOfAttribute, "AttributeStudyProperties") == 0 ) {
367 SALOMEDS_AttributeStudyProperties_i* Attr = new SALOMEDS_AttributeStudyProperties_i(Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(anAttr), _orb);
368 anAttribute = Attr->AttributeStudyProperties::_this();
369 return Standard_True;
371 else if (strcmp(aTypeOfAttribute, "AttributePythonObject") == 0 ) {
372 SALOMEDS_AttributePythonObject_i* Attr = new SALOMEDS_AttributePythonObject_i(Handle(SALOMEDS_PythonObjectAttribute)::DownCast(anAttr), _orb);
373 anAttribute = Attr->AttributePythonObject::_this();
374 return Standard_True;
376 } else return Standard_False;
379 //============================================================================
380 /*! Function : GetAllAttributes
381 * Purpose : Returns list of all attributes for this sobject
383 //============================================================================
385 SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes()
387 Standard_Integer NumAttr = _lab.NbAttributes();
388 SALOMEDS::ListOfAttributes_var SeqOfAttr = new SALOMEDS::ListOfAttributes;
389 SeqOfAttr->length(NumAttr);
391 Standard_Integer i = 0;
392 for(TDF_AttributeIterator iter(_lab);iter.More();iter.Next()) {
393 Handle(TDF_Attribute) anAttr = iter.Value();
394 SALOMEDS::GenericAttribute_var anAttribute;
395 if (ReturnGUIDForAttribute("AttributeReal") == anAttr->ID()) {
396 SALOMEDS_AttributeReal_i* Attr= new SALOMEDS_AttributeReal_i(Handle(TDataStd_Real)::DownCast(anAttr), _orb);
397 anAttribute = Attr->AttributeReal::_this();
399 else if (ReturnGUIDForAttribute("AttributeInteger") == anAttr->ID()) {
400 SALOMEDS_AttributeInteger_i* Attr= new SALOMEDS_AttributeInteger_i(Handle(TDataStd_Integer)::DownCast(anAttr), _orb);
401 anAttribute = Attr->AttributeInteger::_this();
403 else if (ReturnGUIDForAttribute("AttributeSequenceOfReal") == anAttr->ID()) {
404 SALOMEDS_AttributeSequenceOfReal_i* Attr= new SALOMEDS_AttributeSequenceOfReal_i(Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(anAttr), _orb);
405 anAttribute = Attr->AttributeSequenceOfReal::_this();
407 else if (ReturnGUIDForAttribute("AttributeSequenceOfInteger") == anAttr->ID()) {
408 SALOMEDS_AttributeSequenceOfInteger_i* Attr= new SALOMEDS_AttributeSequenceOfInteger_i(Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(anAttr), _orb);
409 anAttribute = Attr->AttributeSequenceOfInteger::_this();
411 else if (ReturnGUIDForAttribute("AttributeName") == anAttr->ID()) {
412 SALOMEDS_AttributeName_i* Attr= new SALOMEDS_AttributeName_i(Handle(TDataStd_Name)::DownCast(anAttr), _orb);
413 anAttribute = Attr->AttributeName::_this();
415 else if (ReturnGUIDForAttribute("AttributeComment") == anAttr->ID()) {
416 SALOMEDS_AttributeComment_i* Attr= new SALOMEDS_AttributeComment_i(Handle(TDataStd_Comment)::DownCast(anAttr), _orb);
417 anAttribute = Attr->AttributeComment::_this();
419 else if (ReturnGUIDForAttribute("AttributeIOR") == anAttr->ID()) {
420 SALOMEDS_AttributeIOR_i* Attr= new SALOMEDS_AttributeIOR_i(Handle(SALOMEDS_IORAttribute)::DownCast(anAttr), _orb);
421 anAttribute = Attr->AttributeIOR::_this();
423 else if (ReturnGUIDForAttribute("AttributePersistentRef") == anAttr->ID()) {
424 SALOMEDS_AttributePersistentRef_i* Attr= new SALOMEDS_AttributePersistentRef_i(Handle(SALOMEDS_PersRefAttribute)::DownCast(anAttr), _orb);
425 anAttribute = Attr->AttributePersistentRef::_this();
427 else if (ReturnGUIDForAttribute("AttributeDrawable") == anAttr->ID()) {
428 SALOMEDS_AttributeDrawable_i* Attr= new SALOMEDS_AttributeDrawable_i(Handle(SALOMEDS_DrawableAttribute)::DownCast(anAttr), _orb);
429 anAttribute = Attr->AttributeDrawable::_this();
431 else if (ReturnGUIDForAttribute("AttributeSelectable") == anAttr->ID()) {
432 SALOMEDS_AttributeSelectable_i* Attr= new SALOMEDS_AttributeSelectable_i(Handle(SALOMEDS_SelectableAttribute)::DownCast(anAttr), _orb);
433 anAttribute = Attr->AttributeSelectable::_this();
435 else if (ReturnGUIDForAttribute("AttributeExpandable") == anAttr->ID()) {
436 SALOMEDS_AttributeExpandable_i* Attr= new SALOMEDS_AttributeExpandable_i(Handle(SALOMEDS_ExpandableAttribute)::DownCast(anAttr), _orb);
437 anAttribute = Attr->AttributeExpandable::_this();
439 else if (ReturnGUIDForAttribute("AttributeOpened") == anAttr->ID()) {
440 SALOMEDS_AttributeOpened_i* Attr= new SALOMEDS_AttributeOpened_i(Handle(SALOMEDS_OpenedAttribute)::DownCast(anAttr), _orb);
441 anAttribute = Attr->AttributeOpened::_this();
443 else if (ReturnGUIDForAttribute("AttributeTextColor") == anAttr->ID()) {
444 SALOMEDS_AttributeTextColor_i* Attr= new SALOMEDS_AttributeTextColor_i(Handle(SALOMEDS_TextColorAttribute)::DownCast(anAttr), _orb);
445 anAttribute = Attr->AttributeTextColor::_this();
447 else if (ReturnGUIDForAttribute("AttributeTextHighlightColor") == anAttr->ID()) {
448 SALOMEDS_AttributeTextHighlightColor_i* Attr= new SALOMEDS_AttributeTextHighlightColor_i(Handle(SALOMEDS_TextHighlightColorAttribute)::DownCast(anAttr), _orb);
449 anAttribute = Attr->AttributeTextHighlightColor::_this();
451 else if (ReturnGUIDForAttribute("AttributePixMap") == anAttr->ID()) {
452 SALOMEDS_AttributePixMap_i* Attr= new SALOMEDS_AttributePixMap_i(Handle(SALOMEDS_PixMapAttribute)::DownCast(anAttr), _orb);
453 anAttribute = Attr->AttributePixMap::_this();
455 else if (ReturnGUIDForAttribute("AttributeTreeNode") == anAttr->ID()) {
456 SALOMEDS_AttributeTreeNode_i* Attr= new SALOMEDS_AttributeTreeNode_i(Handle(TDataStd_TreeNode)::DownCast(anAttr), _orb);
457 anAttribute = Attr->AttributeTreeNode::_this();
459 else if (ReturnGUIDForAttribute("AttributeLocalID") == anAttr->ID()) {
460 SALOMEDS_AttributeLocalID_i* Attr= new SALOMEDS_AttributeLocalID_i(Handle(SALOMEDS_LocalIDAttribute)::DownCast(anAttr), _orb);
461 anAttribute = Attr->AttributeLocalID::_this();
463 else if (ReturnGUIDForAttribute("AttributeTarget") == anAttr->ID()) {
464 SALOMEDS_AttributeTarget_i* Attr= new SALOMEDS_AttributeTarget_i(Handle(SALOMEDS_TargetAttribute)::DownCast(anAttr), _orb);
465 anAttribute = Attr->AttributeTarget::_this();
467 else if (ReturnGUIDForAttribute("AttributeTableOfInteger") == anAttr->ID()) {
468 SALOMEDS_AttributeTableOfInteger_i* Attr= new SALOMEDS_AttributeTableOfInteger_i(Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(anAttr), _orb);
469 anAttribute = Attr->AttributeTableOfInteger::_this();
471 else if (ReturnGUIDForAttribute("AttributeTableOfReal") == anAttr->ID()) {
472 SALOMEDS_AttributeTableOfReal_i* Attr= new SALOMEDS_AttributeTableOfReal_i(Handle(SALOMEDS_TableOfRealAttribute)::DownCast(anAttr), _orb);
473 anAttribute = Attr->AttributeTableOfReal::_this();
475 else if (ReturnGUIDForAttribute("AttributeTableOfString") == anAttr->ID()) {
476 SALOMEDS_AttributeTableOfString_i* Attr= new SALOMEDS_AttributeTableOfString_i(Handle(SALOMEDS_TableOfStringAttribute)::DownCast(anAttr), _orb);
477 anAttribute = Attr->AttributeTableOfString::_this();
479 else if (ReturnGUIDForAttribute("AttributeStudyProperties") == anAttr->ID()) {
480 SALOMEDS_AttributeStudyProperties_i* Attr= new SALOMEDS_AttributeStudyProperties_i(Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(anAttr), _orb);
481 anAttribute = Attr->AttributeStudyProperties::_this();
483 else if (ReturnGUIDForAttribute("AttributePythonObject") == anAttr->ID()) {
484 SALOMEDS_AttributePythonObject_i* Attr= new SALOMEDS_AttributePythonObject_i(Handle(SALOMEDS_PythonObjectAttribute)::DownCast(anAttr), _orb);
485 anAttribute = Attr->AttributePythonObject::_this();
487 else if (!Handle(TDataStd_UAttribute)::DownCast(anAttr).IsNull()) {
488 SALOMEDS_AttributeUserID_i* Attr= new SALOMEDS_AttributeUserID_i(Handle(TDataStd_UAttribute)::DownCast(anAttr), _orb);
489 anAttribute = Attr->AttributeUserID::_this();
491 else if (!Handle(TDataStd_TreeNode)::DownCast(anAttr).IsNull()) {
492 SALOMEDS_AttributeTreeNode_i* Attr= new SALOMEDS_AttributeTreeNode_i(Handle(TDataStd_TreeNode)::DownCast(anAttr), _orb);
493 anAttribute = Attr->AttributeTreeNode::_this();
495 // references attributes, for an example, never returns
499 SeqOfAttr[i] = anAttribute;
503 return SeqOfAttr._retn();
507 //============================================================================
508 /*! Function : ReferencedObject
511 //============================================================================
512 CORBA::Boolean SALOMEDS_SObject_i::ReferencedObject(SALOMEDS::SObject_out obj)
514 Handle(TDF_Reference) Ref;
515 if (!_lab.FindAttribute(TDF_Reference::GetID(),Ref))
518 SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (Ref->Get(),_orb);
519 obj = SALOMEDS::SObject::_narrow(so_servant->_this());
523 //============================================================================
527 //============================================================================
528 CORBA::Boolean SALOMEDS_SObject_i::FindSubObject(long atag, SALOMEDS::SObject_out obj)
530 TDF_Label L = _lab.FindChild(atag,false);
531 if (L.IsNull()) return false;
533 SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (L,_orb);
534 obj = SALOMEDS::SObject::_narrow(so_servant->_this());
539 //============================================================================
543 //============================================================================
544 char* SALOMEDS_SObject_i::Name()
546 return CORBA::string_dup(_name);
549 //============================================================================
553 //============================================================================
554 void SALOMEDS_SObject_i::Name(const char* name)
556 _name = CORBA::string_dup(name);
559 //============================================================================
563 //============================================================================
564 CORBA::Short SALOMEDS_SObject_i::Tag()