]> SALOME platform Git repositories - modules/kernel.git/blob - src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx
Salome HOME
Copyright update 2020
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttributeTableOfString.cxx
1 // Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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, or (at your option) any later version.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  File   : SALOMEDS_AttributeTableOfString.cxx
24 //  Author : Sergey RUIN
25 //  Module : SALOME
26 //
27 #include "SALOMEDS_AttributeTableOfString.hxx"
28 #include "SALOMEDS.hxx"
29
30 #include <string>
31
32 SALOMEDS_AttributeTableOfString::SALOMEDS_AttributeTableOfString
33                   (SALOMEDSImpl_AttributeTableOfString* theAttr)
34 :SALOMEDS_GenericAttribute(theAttr)
35 {}
36
37 SALOMEDS_AttributeTableOfString::SALOMEDS_AttributeTableOfString
38                   (SALOMEDS::AttributeTableOfString_ptr theAttr)
39 :SALOMEDS_GenericAttribute(theAttr)
40 {}
41
42 SALOMEDS_AttributeTableOfString::~SALOMEDS_AttributeTableOfString()
43 {}
44
45
46 void SALOMEDS_AttributeTableOfString::SetTitle(const std::string& theTitle)
47 {
48   if (_isLocal) {
49     CheckLocked();
50     SALOMEDS::Locker lock;
51     dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetTitle(theTitle);
52   }
53   else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetTitle(theTitle.c_str());
54 }
55
56 std::string SALOMEDS_AttributeTableOfString::GetTitle()
57 {
58   std::string aStr;
59   if (_isLocal) {
60     SALOMEDS::Locker lock;
61     aStr = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetTitle();
62   }
63   else aStr = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetTitle();
64   return aStr;
65 }
66
67 void SALOMEDS_AttributeTableOfString::SetRowTitle(int theIndex, const std::string& theTitle)
68 {
69   if (_isLocal) {
70     CheckLocked();
71     SALOMEDS::Locker lock;
72     dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetRowTitle(theIndex, theTitle);
73   }
74   else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str());
75 }
76
77 std::string SALOMEDS_AttributeTableOfString::GetRowTitle(int theIndex)
78 {
79   std::string aTitle;
80   if (_isLocal) {
81     SALOMEDS::Locker lock;
82     try {
83       aTitle = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetRowTitle(theIndex);
84     }
85     catch(...) {
86       throw SALOMEDS::AttributeTable::IncorrectIndex();
87     }
88   }
89   else {
90     aTitle = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowTitle(theIndex);
91   }
92   return aTitle;
93 }
94
95 void SALOMEDS_AttributeTableOfString::SetRowTitles(const std::vector<std::string>& theTitles)
96 {
97   int aLength = theTitles.size(), i;
98   if (_isLocal) {
99     CheckLocked();
100     SALOMEDS::Locker lock;
101     dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetRowTitles(theTitles);
102   }
103   else {
104     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
105     aSeq->length(aLength);
106     for (i = 0; i < aLength; i++) aSeq[i] = theTitles[i].c_str();
107     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitles(aSeq);
108   }
109 }
110
111 std::vector<std::string> SALOMEDS_AttributeTableOfString::GetRowTitles()
112 {
113   std::vector<std::string> aVector;
114   int aLength, i;
115   if (_isLocal) {
116     SALOMEDS::Locker lock;
117     aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetRowTitles();
118   }
119   else {
120     SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowTitles();
121     aLength = aSeq->length();
122     for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
123   }
124   return aVector;
125 }
126
127 void SALOMEDS_AttributeTableOfString::SetColumnTitle(int theIndex, const std::string& theTitle)
128 {
129   if (_isLocal) {
130     CheckLocked();
131     SALOMEDS::Locker lock;
132     dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetColumnTitle(theIndex, theTitle);
133   }
134   else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str());
135 }
136
137 std::string SALOMEDS_AttributeTableOfString::GetColumnTitle(int theIndex)
138 {
139   std::string aTitle;
140   if (_isLocal) {
141     SALOMEDS::Locker lock;
142     try {
143       aTitle = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetColumnTitle(theIndex);
144     }
145     catch(...) {
146       throw SALOMEDS::AttributeTable::IncorrectIndex();
147     }
148   }
149   else {
150     aTitle = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumnTitle(theIndex);
151   }
152   return aTitle;
153 }
154
155 void SALOMEDS_AttributeTableOfString::SetColumnTitles(const std::vector<std::string>& theTitles)
156 {
157   int aLength = theTitles.size(), i;
158   if (_isLocal) {
159     CheckLocked();
160     SALOMEDS::Locker lock;
161     dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetColumnTitles(theTitles);
162   }
163   else {
164     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
165     aSeq->length(aLength);
166     for (i = 0; i < aLength; i++) aSeq[i] = theTitles[i].c_str();
167     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitles(aSeq);
168   }
169 }
170
171 std::vector<std::string> SALOMEDS_AttributeTableOfString::GetColumnTitles()
172 {
173   std::vector<std::string> aVector;
174   int aLength, i;
175   if (_isLocal) {
176     SALOMEDS::Locker lock;
177     aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetColumnTitles();
178   }
179   else {
180     SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumnTitles();
181     aLength = aSeq->length();
182     for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
183   }
184   return aVector;
185 }
186
187 void SALOMEDS_AttributeTableOfString::SetRowUnit(int theIndex, const std::string& theUnit)
188 {
189   if (_isLocal) {
190     CheckLocked();
191     SALOMEDS::Locker lock;
192     dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetRowUnit(theIndex, theUnit);
193   }
194   else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str());
195 }
196
197 std::string SALOMEDS_AttributeTableOfString::GetRowUnit(int theIndex)
198 {
199   std::string aTitle;
200   if (_isLocal) {
201     SALOMEDS::Locker lock;
202     try {
203       aTitle = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetRowUnit(theIndex);
204     }
205     catch(...) {
206       throw SALOMEDS::AttributeTable::IncorrectIndex();
207     }
208   }
209   else {
210     aTitle = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowUnit(theIndex);
211   }
212   return aTitle;
213 }
214
215 void SALOMEDS_AttributeTableOfString::SetRowUnits(const std::vector<std::string>& theUnits)
216 {
217   int aLength = theUnits.size(), i;
218   if (_isLocal) {
219     CheckLocked();
220     SALOMEDS::Locker lock;
221     dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetRowUnits(theUnits);
222   }
223   else {
224     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
225     aSeq->length(aLength);
226     for (i = 0; i < aLength; i++) aSeq[i] = theUnits[i].c_str();
227     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnits(aSeq);
228   }
229 }
230
231 std::vector<std::string> SALOMEDS_AttributeTableOfString::GetRowUnits()
232 {
233   std::vector<std::string> aVector;
234   int aLength, i;
235   if (_isLocal) {
236     SALOMEDS::Locker lock;
237     aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetRowUnits();
238   }
239   else {
240     SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowUnits();
241     aLength = aSeq->length();
242     for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
243   }
244   return aVector;
245 }
246
247 int SALOMEDS_AttributeTableOfString::GetNbRows()
248 {
249   int aNb;
250   if (_isLocal) {
251     SALOMEDS::Locker lock;
252     aNb = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetNbRows();
253   }
254   else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbRows();
255   return aNb;
256 }
257
258 int SALOMEDS_AttributeTableOfString::GetNbColumns()
259 {  
260   int aNb;
261   if (_isLocal) {
262     SALOMEDS::Locker lock;
263     aNb = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetNbColumns();
264   }
265   else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbColumns();
266   return aNb;
267 }
268
269 void SALOMEDS_AttributeTableOfString::AddRow(const std::vector<std::string>& theData)
270 {
271   int aLength = theData.size(), i;
272   if (_isLocal) {
273     CheckLocked();
274     SALOMEDS::Locker lock;
275     SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl);
276     try {
277       aTable->SetRowData(aTable->GetNbRows() + 1, theData);
278     }   
279     catch(...) {
280       throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
281     }
282   }
283   else {
284     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
285     aSeq->length(aLength);
286     for (i = 0; i < aLength; i++) aSeq[i] = theData[i].c_str();
287     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->AddRow(aSeq);
288   }
289 }
290
291 void SALOMEDS_AttributeTableOfString::SetRow(int theRow, const std::vector<std::string>& theData)
292 {
293   int aLength = theData.size(), i;
294   if (_isLocal) {
295     CheckLocked();
296     SALOMEDS::Locker lock;
297     SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl);
298     try {
299       aTable->SetRowData(theRow, theData);
300     }   
301     catch(...) {
302       throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
303     }
304   }
305   else {
306     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
307     aSeq->length(aLength);
308     for (i = 0; i < aLength; i++) aSeq[i] = theData[i].c_str();
309     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRow(theRow, aSeq);
310   }
311 }
312
313 std::vector<std::string> SALOMEDS_AttributeTableOfString::GetRow(int theRow)
314 {
315   std::vector<std::string> aVector;
316   int aLength, i;
317   if (_isLocal) {
318     SALOMEDS::Locker lock;
319     aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetRowData(theRow);
320   }
321   else {
322     SALOMEDS::StringSeq_var aRow = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRow(theRow);
323     aLength = aRow->length();
324     for (i = 0; i < aLength; i++) aVector.push_back((char*)aRow[i].in());
325   }
326
327   return aVector;
328 }
329
330 void SALOMEDS_AttributeTableOfString::AddColumn(const std::vector<std::string>& theData)
331 {
332   int aLength = theData.size(), i;
333   if (_isLocal) {
334     CheckLocked();
335     SALOMEDS::Locker lock;
336     SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl);
337     try {
338       aTable->SetColumnData(aTable->GetNbColumns() + 1, theData);
339     }   
340     catch(...) {
341       throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
342     }
343   }
344   else {
345     SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq();
346     aColumn->length(aLength);
347     for (i = 0; i < aLength; i++) aColumn[i] = theData[i].c_str();
348     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->AddColumn(aColumn);
349   }
350 }
351
352 void SALOMEDS_AttributeTableOfString::SetColumn(int theColumn, const std::vector<std::string>& theData)
353 {
354   int aLength = theData.size(), i;
355   if (_isLocal) {
356     CheckLocked();
357     SALOMEDS::Locker lock;
358     SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl);
359     try {
360       aTable->SetColumnData(theColumn, theData);
361     }   
362     catch(...) {
363       throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
364     }
365   }
366   else {
367     SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq();
368     aColumn->length(aLength);
369     for (i = 0; i < aLength; i++) aColumn[i] = theData[i].c_str();
370     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumn(theColumn, aColumn);
371   }
372 }
373
374 std::vector<std::string> SALOMEDS_AttributeTableOfString::GetColumn(int theColumn)
375 {
376   std::vector<std::string> aVector;
377   int aLength, i;
378   if (_isLocal) {
379     SALOMEDS::Locker lock;
380     aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetColumnData(theColumn);
381   }
382   else {
383     SALOMEDS::StringSeq_var aColumn =
384       SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumn(theColumn);
385     aLength = aColumn->length();  
386     for (i = 0; i < aLength; i++) aVector.push_back(aColumn[i].in());
387   }
388   return aVector;
389 }
390
391 void SALOMEDS_AttributeTableOfString::PutValue(const std::string& theValue, int theRow, int theColumn)
392 {
393   if (_isLocal) {
394     CheckLocked();
395     SALOMEDS::Locker lock;
396     try {
397       dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->PutValue(theValue, theRow, theColumn);
398     }   
399     catch(...) {
400       throw SALOMEDS::AttributeTable::IncorrectIndex();
401     }
402   }
403   else {
404     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->PutValue(theValue.c_str(), theRow, theColumn);
405   }
406 }
407
408 bool SALOMEDS_AttributeTableOfString::HasValue(int theRow, int theColumn)
409 {
410   bool ret;
411   if (_isLocal) {
412     SALOMEDS::Locker lock;
413     ret = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->HasValue(theRow, theColumn);
414   }
415   else ret = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->HasValue(theRow, theColumn);
416   return ret;
417 }
418
419 std::string SALOMEDS_AttributeTableOfString::GetValue(int theRow, int theColumn)
420 {
421   std::string aValue;
422   if (_isLocal) {
423     SALOMEDS::Locker lock;
424     try {
425       aValue = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetValue(theRow, theColumn);
426     }   
427     catch(...) {
428       throw SALOMEDS::AttributeTable::IncorrectIndex();
429     }
430   }
431   else {
432     aValue = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetValue(theRow, theColumn);
433   }
434   return aValue;
435 }
436
437 void SALOMEDS_AttributeTableOfString::RemoveValue(int theRow, int theColumn)
438 {
439   if (_isLocal) {
440     SALOMEDS::Locker lock;
441     try {
442       dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->RemoveValue(theRow, theColumn);
443     }   
444     catch(...) {
445       throw SALOMEDS::AttributeTable::IncorrectIndex();
446     }
447   }
448   else {
449     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->RemoveValue(theRow, theColumn);
450   }
451 }
452
453 std::vector<int> SALOMEDS_AttributeTableOfString::GetRowSetIndices(int theRow)
454 {
455   std::vector<int> aVector;
456   int aLength, i;
457   if (_isLocal) {
458     SALOMEDS::Locker lock;
459     aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetSetRowIndices(theRow);
460   }
461   else {
462     SALOMEDS::LongSeq_var aSet =
463       SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowSetIndices(theRow);
464     aLength = aSet->length();
465     for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
466   }
467   return aVector;
468 }
469
470 void SALOMEDS_AttributeTableOfString::SetNbColumns(int theNbColumns)
471 {
472   if (_isLocal) {
473     SALOMEDS::Locker lock;
474     dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetNbColumns(theNbColumns);
475   }
476   else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetNbColumns(theNbColumns);
477 }
478
479 std::vector<int> SALOMEDS_AttributeTableOfString::SortRow(int theRow, SortOrder theOrder, SortPolicy thePolicy)
480 {
481   std::vector<int> aVector;
482   int aLength, i;
483   if (_isLocal) {
484     SALOMEDS::Locker lock;
485     try {
486       aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SortRow(theRow, 
487                                                                                          (SALOMEDSImpl_AttributeTable::SortOrder)theOrder, 
488                                                                                          (SALOMEDSImpl_AttributeTable::SortPolicy)thePolicy);
489     }   
490     catch(...) {
491       throw SALOMEDS::AttributeTable::IncorrectIndex();
492     }
493   }
494   else {
495     SALOMEDS::LongSeq_var aSet =
496       SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SortRow(theRow, 
497                                                                       (SALOMEDS::AttributeTable::SortOrder)theOrder, 
498                                                                       (SALOMEDS::AttributeTable::SortPolicy)thePolicy);
499     aLength = aSet->length();  
500     for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
501   }
502   return aVector;
503 }
504
505 std::vector<int> SALOMEDS_AttributeTableOfString::SortColumn(int theColumn, SortOrder theOrder, SortPolicy thePolicy)
506 {
507   std::vector<int> aVector;
508   int aLength, i;
509   if (_isLocal) {
510     SALOMEDS::Locker lock;
511     try {
512       aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SortColumn(theColumn, 
513                                                                                             (SALOMEDSImpl_AttributeTable::SortOrder)theOrder, 
514                                                                                             (SALOMEDSImpl_AttributeTable::SortPolicy)thePolicy);
515     }   
516     catch(...) {
517       throw SALOMEDS::AttributeTable::IncorrectIndex();
518     }
519   }
520   else {
521     SALOMEDS::LongSeq_var aSet =
522       SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SortColumn(theColumn, 
523                                                                          (SALOMEDS::AttributeTable::SortOrder)theOrder, 
524                                                                          (SALOMEDS::AttributeTable::SortPolicy)thePolicy);
525     aLength = aSet->length();  
526     for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
527   }
528   return aVector;
529 }
530
531 std::vector<int> SALOMEDS_AttributeTableOfString::SortByRow(int theRow, SortOrder theOrder, SortPolicy thePolicy)
532 {
533   std::vector<int> aVector;
534   int aLength, i;
535   if (_isLocal) {
536     SALOMEDS::Locker lock;
537     try {
538       aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SortByRow(theRow, 
539                                                                                            (SALOMEDSImpl_AttributeTable::SortOrder)theOrder, 
540                                                                                            (SALOMEDSImpl_AttributeTable::SortPolicy)thePolicy);
541     }   
542     catch(...) {
543       throw SALOMEDS::AttributeTable::IncorrectIndex();
544     }
545   }
546   else {
547     SALOMEDS::LongSeq_var aSet =
548       SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SortByRow(theRow, 
549                                                                         (SALOMEDS::AttributeTable::SortOrder)theOrder, 
550                                                                         (SALOMEDS::AttributeTable::SortPolicy)thePolicy);
551     aLength = aSet->length();  
552     for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
553   }
554   return aVector;
555 }
556
557 std::vector<int> SALOMEDS_AttributeTableOfString::SortByColumn(int theColumn, SortOrder theOrder, SortPolicy thePolicy)
558 {
559   std::vector<int> aVector;
560   int aLength, i;
561   if (_isLocal) {
562     SALOMEDS::Locker lock;
563     try {
564       aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SortByColumn(theColumn, 
565                                                                                               (SALOMEDSImpl_AttributeTable::SortOrder)theOrder, 
566                                                                                               (SALOMEDSImpl_AttributeTable::SortPolicy)thePolicy);
567     }   
568     catch(...) {
569       throw SALOMEDS::AttributeTable::IncorrectIndex();
570     }
571   }
572   else {
573     SALOMEDS::LongSeq_var aSet =
574       SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SortByColumn(theColumn, 
575                                                                            (SALOMEDS::AttributeTable::SortOrder)theOrder, 
576                                                                            (SALOMEDS::AttributeTable::SortPolicy)thePolicy);
577     aLength = aSet->length();  
578     for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]);
579   }
580   return aVector;
581 }
582
583 void SALOMEDS_AttributeTableOfString::SwapCells(int theRow1, int theColumn1, int theRow2, int theColumn2)
584 {
585   if (_isLocal) {
586     SALOMEDS::Locker lock;
587     try {
588       dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SwapCells(theRow1, theColumn1, theRow2, theColumn2);
589     }   
590     catch(...) {
591       throw SALOMEDS::AttributeTable::IncorrectIndex();
592     }
593   }
594   else {
595     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SwapCells(theRow1, theColumn1, theRow2, theColumn2);
596   }
597 }
598
599 void SALOMEDS_AttributeTableOfString::SwapRows(int theRow1, int theRow2)
600 {
601   if (_isLocal) {
602     SALOMEDS::Locker lock;
603     try {
604       dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SwapRows(theRow1, theRow2);
605     }   
606     catch(...) {
607       throw SALOMEDS::AttributeTable::IncorrectIndex();
608     }
609   }
610   else {
611     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SwapRows(theRow1, theRow2);
612   }
613 }
614
615 void SALOMEDS_AttributeTableOfString::SwapColumns(int theColumn1, int theColumn2)
616 {
617   if (_isLocal) {
618     SALOMEDS::Locker lock;
619     try {
620       dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SwapColumns(theColumn1, theColumn2);
621     }   
622     catch(...) {
623       throw SALOMEDS::AttributeTable::IncorrectIndex();
624     }
625   }
626   else {
627     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SwapColumns(theColumn1, theColumn2);
628   }
629 }