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