1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : SALOMEDS_AttributeTableOfReal_i.cxx
24 // Author : Sergey RUIN
27 #include "SALOMEDS_AttributeTableOfReal_i.hxx"
28 #include "SALOMEDS.hxx"
34 #include "Utils_ExceptHandlers.hxx"
35 UNEXPECT_CATCH(ATR_IncorrectIndex, SALOMEDS::AttributeTable::IncorrectIndex);
36 UNEXPECT_CATCH(ATR_IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectArgumentLength);
38 void SALOMEDS_AttributeTableOfReal_i::SetTitle(const char* theTitle)
40 SALOMEDS::Locker lock;
42 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
43 CORBA::String_var aStr = CORBA::string_dup(theTitle);
44 aTable->SetTitle(std::string(aStr));
47 char* SALOMEDS_AttributeTableOfReal_i::GetTitle()
49 SALOMEDS::Locker lock;
50 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
51 CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str());
55 void SALOMEDS_AttributeTableOfReal_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle)
56 throw (SALOMEDS::AttributeTable::IncorrectIndex)
58 SALOMEDS::Locker lock;
59 Unexpect aCatch (ATR_IncorrectIndex);
61 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
62 if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
63 aTable->SetRowTitle(theIndex, std::string(theTitle));
66 char* SALOMEDS_AttributeTableOfReal_i::GetRowTitle(CORBA::Long theIndex)
67 throw (SALOMEDS::AttributeTable::IncorrectIndex)
69 SALOMEDS::Locker lock;
70 Unexpect aCatch (ATR_IncorrectIndex);
72 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
73 if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
74 CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowTitle(theIndex).c_str());
78 void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
79 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
81 SALOMEDS::Locker lock;
82 Unexpect aCatch (ATR_IncorrectArgumentLength);
84 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
85 if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
86 for (int i = 0; i < theTitles.length(); i++) {
87 aTable->SetRowTitle(i + 1, (char*)theTitles[i].in());
91 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowTitles()
93 SALOMEDS::Locker lock;
94 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
95 SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
96 aTitles->length(aTable->GetNbRows());
97 for(int i = 0; i < aTitles->length(); i++)
98 aTitles[i] = CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str());
99 return aTitles._retn();
102 void SALOMEDS_AttributeTableOfReal_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
103 throw (SALOMEDS::AttributeTable::IncorrectIndex)
105 SALOMEDS::Locker lock;
106 Unexpect aCatch (ATR_IncorrectIndex);
108 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
109 if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
110 CORBA::String_var aStr = CORBA::string_dup(theTitle);
111 aTable->SetColumnTitle(theIndex, std::string(aStr));
114 char* SALOMEDS_AttributeTableOfReal_i::GetColumnTitle(CORBA::Long theIndex)
115 throw (SALOMEDS::AttributeTable::IncorrectIndex)
117 SALOMEDS::Locker lock;
118 Unexpect aCatch (ATR_IncorrectIndex);
120 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
121 if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
122 CORBA::String_var c_s = CORBA::string_dup(aTable->GetColumnTitle(theIndex).c_str());
126 void SALOMEDS_AttributeTableOfReal_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
127 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
129 SALOMEDS::Locker lock;
130 Unexpect aCatch(ATR_IncorrectArgumentLength);
132 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
133 if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
134 for (int i = 0; i < theTitles.length(); i++) {
135 aTable->SetColumnTitle(i + 1, (char*)theTitles[i].in());
139 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetColumnTitles()
141 SALOMEDS::Locker lock;
142 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
143 SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
144 aTitles->length(aTable->GetNbColumns());
145 for(int i = 0; i < aTitles->length(); i++)
146 aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str());
147 return aTitles._retn();
151 void SALOMEDS_AttributeTableOfReal_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
152 throw (SALOMEDS::AttributeTable::IncorrectIndex)
154 SALOMEDS::Locker lock;
155 Unexpect aCatch (ATR_IncorrectIndex);
157 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
158 if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
159 aTable->SetRowUnit(theIndex, std::string(theUnit));
162 char* SALOMEDS_AttributeTableOfReal_i::GetRowUnit(CORBA::Long theIndex)
163 throw (SALOMEDS::AttributeTable::IncorrectIndex)
165 SALOMEDS::Locker lock;
166 Unexpect aCatch (ATR_IncorrectIndex);
168 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
169 if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
170 CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowUnit(theIndex).c_str());
174 void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
175 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
177 SALOMEDS::Locker lock;
178 Unexpect aCatch (ATR_IncorrectArgumentLength);
180 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
181 if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
182 for (int i = 0; i < theUnits.length(); i++) {
183 aTable->SetRowUnit(i + 1, (char*)theUnits[i].in());
187 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowUnits()
189 SALOMEDS::Locker lock;
190 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
191 SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq;
192 aUnits->length(aTable->GetNbRows());
193 for(int i = 0; i < aUnits->length(); i++)
194 aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str());
195 return aUnits._retn();
199 CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbRows()
201 SALOMEDS::Locker lock;
202 return dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl)->GetNbRows();
205 CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbColumns()
207 SALOMEDS::Locker lock;
208 return dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl)->GetNbColumns();
211 void SALOMEDS_AttributeTableOfReal_i::AddRow(const SALOMEDS::DoubleSeq& theData)
212 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
214 SALOMEDS::Locker lock;
215 Unexpect aCatch(ATR_IncorrectArgumentLength);
217 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
219 std::vector<double> aRow;
220 for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]);
221 aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
224 void SALOMEDS_AttributeTableOfReal_i::SetRow(CORBA::Long theRow, const SALOMEDS::DoubleSeq& theData)
225 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectIndex)
227 SALOMEDS::Locker lock;
228 Unexpect aCatch(ATR_IncorrectArgumentLength);
230 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
232 std::vector<double> aRow;
233 for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]);
234 aTable->SetRowData(theRow, aRow);
237 SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetRow(CORBA::Long theRow)
238 throw (SALOMEDS::AttributeTable::IncorrectIndex)
240 SALOMEDS::Locker lock;
241 Unexpect aCatch(ATR_IncorrectIndex);
242 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
243 if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
245 SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq;
246 std::vector<double> aRow = aTable->GetRowData(theRow);
247 CorbaSeq->length(aRow.size());
248 for (int i = 0; i < aRow.size(); i++) {
249 CorbaSeq[i] = aRow[i];
251 return CorbaSeq._retn();
254 void SALOMEDS_AttributeTableOfReal_i::AddColumn(const SALOMEDS::DoubleSeq& theData)
255 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
257 SALOMEDS::Locker lock;
258 Unexpect aCatch(ATR_IncorrectArgumentLength);
260 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
262 std::vector<double> aColumn;
263 for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]);
264 aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
267 void SALOMEDS_AttributeTableOfReal_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::DoubleSeq& theData)
268 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectIndex)
270 SALOMEDS::Locker lock;
271 Unexpect aCatch(ATR_IncorrectArgumentLength);
273 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
275 std::vector<double> aColumn;
276 for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]);
277 aTable->SetColumnData(theColumn, aColumn);
280 SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetColumn(CORBA::Long theColumn)
281 throw (SALOMEDS::AttributeTable::IncorrectIndex)
283 SALOMEDS::Locker lock;
284 Unexpect aCatch(ATR_IncorrectIndex);
285 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
286 if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
288 SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq;
289 std::vector<double> aColumn = aTable->GetColumnData(theColumn);
290 CorbaSeq->length(aColumn.size());
291 for (int i = 0; i < aColumn.size(); i++) {
292 CorbaSeq[i] = aColumn[i];
294 return CorbaSeq._retn();
297 void SALOMEDS_AttributeTableOfReal_i::PutValue(CORBA::Double theValue, CORBA::Long theRow, CORBA::Long theColumn)
298 throw (SALOMEDS::AttributeTable::IncorrectIndex)
300 SALOMEDS::Locker lock;
301 Unexpect aCatch(ATR_IncorrectIndex);
303 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
305 aTable->PutValue(theValue, theRow, theColumn);
308 CORBA::Boolean SALOMEDS_AttributeTableOfReal_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn)
310 SALOMEDS::Locker lock;
311 return dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl)->HasValue(theRow, theColumn);
314 CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
315 throw (SALOMEDS::AttributeTable::IncorrectIndex)
317 SALOMEDS::Locker lock;
318 Unexpect aCatch(ATR_IncorrectIndex);
319 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
320 if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
322 CORBA::Double aValue;
325 aValue = aTable->GetValue(theRow, theColumn);
328 throw SALOMEDS::AttributeTable::IncorrectIndex();
334 void SALOMEDS_AttributeTableOfReal_i::RemoveValue(CORBA::Long theRow, CORBA::Long theColumn)
335 throw (SALOMEDS::AttributeTable::IncorrectIndex)
337 SALOMEDS::Locker lock;
338 Unexpect aCatch(ATR_IncorrectIndex);
339 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
340 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
341 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
344 aTable->RemoveValue(theRow, theColumn);
347 throw SALOMEDS::AttributeTable::IncorrectIndex();
351 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::GetRowSetIndices(CORBA::Long theRow)
353 SALOMEDS::Locker lock;
354 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
356 if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
358 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
359 std::vector<int> aSeq = aTable->GetSetRowIndices(theRow);
360 int len = aSeq.size();
361 CorbaSeq->length(len);
362 for (int i = 0; i < len; i++) {
363 CorbaSeq[i] = aSeq[i];
365 return CorbaSeq._retn();
368 void SALOMEDS_AttributeTableOfReal_i::SetNbColumns(CORBA::Long theNbColumns)
370 SALOMEDS::Locker lock;
371 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
372 aTable->SetNbColumns(theNbColumns);
375 bool SALOMEDS_AttributeTableOfReal_i::ReadFromFile(const SALOMEDS::TMPFile& theStream)
377 SALOMEDS::Locker lock;
378 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
380 std::string aStream((char*)&theStream[0], theStream.length());
381 aTable->Load(aStream);
385 SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfReal_i::SaveToFile()
387 SALOMEDS::Locker lock;
388 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
390 std::string aString = aTable->Save();
391 char* aBuffer = (char*)CORBA::string_dup(aString.c_str());
392 int aBufferSize = strlen((char*)aBuffer);
394 CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
396 SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
398 return aStreamFile._retn();
401 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::SortRow(CORBA::Long theRow,
402 SALOMEDS::AttributeTable::SortOrder sortOrder,
403 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
404 throw (SALOMEDS::AttributeTable::IncorrectIndex)
406 SALOMEDS::Locker lock;
407 Unexpect aCatch(ATR_IncorrectIndex);
409 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
410 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
412 std::vector<int> aSeq;
413 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
415 aSeq = aTable->SortRow(theRow, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
416 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
419 throw SALOMEDS::AttributeTable::IncorrectIndex();
421 CorbaSeq->length(aSeq.size());
422 for (int i = 0; i < aSeq.size(); i++) {
423 CorbaSeq[i] = aSeq[i];
425 return CorbaSeq._retn();
428 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::SortColumn(CORBA::Long theColumn,
429 SALOMEDS::AttributeTable::SortOrder sortOrder,
430 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
431 throw (SALOMEDS::AttributeTable::IncorrectIndex)
433 SALOMEDS::Locker lock;
434 Unexpect aCatch(ATR_IncorrectIndex);
436 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
437 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
439 std::vector<int> aSeq;
440 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
442 aSeq = aTable->SortColumn(theColumn, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
443 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
446 throw SALOMEDS::AttributeTable::IncorrectIndex();
448 CorbaSeq->length(aSeq.size());
449 for (int i = 0; i < aSeq.size(); i++) {
450 CorbaSeq[i] = aSeq[i];
452 return CorbaSeq._retn();
455 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::SortByRow(CORBA::Long theRow,
456 SALOMEDS::AttributeTable::SortOrder sortOrder,
457 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
458 throw (SALOMEDS::AttributeTable::IncorrectIndex)
460 SALOMEDS::Locker lock;
461 Unexpect aCatch(ATR_IncorrectIndex);
463 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
464 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
466 std::vector<int> aSeq;
467 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
469 aSeq = aTable->SortByRow(theRow, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
470 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
473 throw SALOMEDS::AttributeTable::IncorrectIndex();
475 CorbaSeq->length(aSeq.size());
476 for (int i = 0; i < aSeq.size(); i++) {
477 CorbaSeq[i] = aSeq[i];
479 return CorbaSeq._retn();
482 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::SortByColumn(CORBA::Long theColumn,
483 SALOMEDS::AttributeTable::SortOrder sortOrder,
484 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
485 throw (SALOMEDS::AttributeTable::IncorrectIndex)
487 SALOMEDS::Locker lock;
488 Unexpect aCatch(ATR_IncorrectIndex);
490 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
491 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
493 std::vector<int> aSeq;
494 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
496 aSeq = aTable->SortByColumn(theColumn, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
497 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
500 throw SALOMEDS::AttributeTable::IncorrectIndex();
502 CorbaSeq->length(aSeq.size());
503 for (int i = 0; i < aSeq.size(); i++) {
504 CorbaSeq[i] = aSeq[i];
506 return CorbaSeq._retn();
509 void SALOMEDS_AttributeTableOfReal_i::SwapCells(CORBA::Long theRow1, CORBA::Long theColumn1,
510 CORBA::Long theRow2, CORBA::Long theColumn2)
511 throw (SALOMEDS::AttributeTable::IncorrectIndex)
513 SALOMEDS::Locker lock;
514 Unexpect aCatch(ATR_IncorrectIndex);
516 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
517 if (theRow1 < 1 || theRow1 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
518 if (theColumn1 < 1 || theColumn1 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
519 if (theRow2 < 1 || theRow2 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
520 if (theColumn2 < 1 || theColumn2 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
523 aTable->SwapCells(theRow1, theColumn1, theRow2, theColumn2);
526 throw SALOMEDS::AttributeTable::IncorrectIndex();
530 void SALOMEDS_AttributeTableOfReal_i::SwapRows(CORBA::Long theRow1, CORBA::Long theRow2)
531 throw (SALOMEDS::AttributeTable::IncorrectIndex)
533 SALOMEDS::Locker lock;
534 Unexpect aCatch(ATR_IncorrectIndex);
536 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
537 if (theRow1 < 1 || theRow1 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
538 if (theRow2 < 1 || theRow2 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
541 aTable->SwapRows(theRow1, theRow2);
544 throw SALOMEDS::AttributeTable::IncorrectIndex();
548 void SALOMEDS_AttributeTableOfReal_i::SwapColumns(CORBA::Long theColumn1, CORBA::Long theColumn2)
549 throw (SALOMEDS::AttributeTable::IncorrectIndex)
551 SALOMEDS::Locker lock;
552 Unexpect aCatch(ATR_IncorrectIndex);
554 SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
555 if (theColumn1 < 1 || theColumn1 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
556 if (theColumn2 < 1 || theColumn2 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
559 aTable->SwapColumns(theColumn1, theColumn2);
562 throw SALOMEDS::AttributeTable::IncorrectIndex();