1 // Copyright (C) 2007-2020 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, or (at your option) any later version.
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_AttributeTableOfString_i.cxx
24 // Author : Sergey RUIN
27 #include "SALOMEDS_AttributeTableOfString_i.hxx"
28 #include "SALOMEDS.hxx"
34 #include "Utils_ExceptHandlers.hxx"
36 UNEXPECT_CATCH(ATS_IncorrectIndex, SALOMEDS::AttributeTable::IncorrectIndex)
37 UNEXPECT_CATCH(ATS_IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectArgumentLength)
39 void SALOMEDS_AttributeTableOfString_i::SetTitle(const char* theTitle)
41 SALOMEDS::Locker lock;
43 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
44 CORBA::String_var aStr = CORBA::string_dup(theTitle);
45 aTable->SetTitle(std::string(aStr));
48 char* SALOMEDS_AttributeTableOfString_i::GetTitle()
50 SALOMEDS::Locker lock;
51 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
52 CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str());
56 void SALOMEDS_AttributeTableOfString_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle)
58 SALOMEDS::Locker lock;
59 Unexpect aCatch(ATS_IncorrectIndex);
61 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
62 if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
64 aTable->SetRowTitle(theIndex, std::string(theTitle));
67 char* SALOMEDS_AttributeTableOfString_i::GetRowTitle(CORBA::Long theIndex)
69 SALOMEDS::Locker lock;
70 Unexpect aCatch (ATS_IncorrectIndex);
72 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_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_AttributeTableOfString_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
80 SALOMEDS::Locker lock;
81 Unexpect aCatch(ATS_IncorrectArgumentLength);
83 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
84 if ((int)theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
85 for (int i = 0; i < (int)theTitles.length(); i++) {
86 aTable->SetRowTitle(i + 1, std::string((char*)theTitles[i].in()));
90 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowTitles()
92 SALOMEDS::Locker lock;
93 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
94 SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
95 aTitles->length(aTable->GetNbRows());
96 for(int i = 0; i < (int)aTitles->length(); i++)
97 aTitles[i] =CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str());
98 return aTitles._retn();
101 void SALOMEDS_AttributeTableOfString_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
103 SALOMEDS::Locker lock;
104 Unexpect aCatch(ATS_IncorrectIndex);
106 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
107 if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
108 aTable->SetColumnTitle(theIndex, std::string((char*)theTitle));
111 char* SALOMEDS_AttributeTableOfString_i::GetColumnTitle(CORBA::Long theIndex)
113 SALOMEDS::Locker lock;
114 Unexpect aCatch (ATS_IncorrectIndex);
116 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
117 if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
118 CORBA::String_var c_s = CORBA::string_dup(aTable->GetColumnTitle(theIndex).c_str());
122 void SALOMEDS_AttributeTableOfString_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
124 SALOMEDS::Locker lock;
125 Unexpect aCatch(ATS_IncorrectArgumentLength);
127 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
128 if ((int)theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
129 for (int i = 0; i < (int)theTitles.length(); i++) {
130 aTable->SetColumnTitle(i + 1, std::string((char*)theTitles[i].in()));
134 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumnTitles()
136 SALOMEDS::Locker lock;
137 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
138 SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
139 aTitles->length(aTable->GetNbColumns());
140 for(int i = 0; i < (int)aTitles->length(); i++)
141 aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str());
142 return aTitles._retn();
146 void SALOMEDS_AttributeTableOfString_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
148 SALOMEDS::Locker lock;
149 Unexpect aCatch(ATS_IncorrectIndex);
151 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
152 if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
153 aTable->SetRowUnit(theIndex, std::string((char*)theUnit));
156 char* SALOMEDS_AttributeTableOfString_i::GetRowUnit(CORBA::Long theIndex)
158 SALOMEDS::Locker lock;
159 Unexpect aCatch (ATS_IncorrectIndex);
161 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
162 if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
163 CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowUnit(theIndex).c_str());
167 void SALOMEDS_AttributeTableOfString_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
169 SALOMEDS::Locker lock;
170 Unexpect aCatch(ATS_IncorrectArgumentLength);
172 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
173 if ((int)theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
174 for (int i = 0; i < (int)theUnits.length(); i++) {
175 aTable->SetRowUnit(i + 1, std::string((char*)theUnits[i].in()));
179 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowUnits()
181 SALOMEDS::Locker lock;
182 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
183 SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq;
184 aUnits->length(aTable->GetNbRows());
185 for(int i = 0; i < (int)aUnits->length(); i++)
186 aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str());
187 return aUnits._retn();
191 CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbRows()
193 SALOMEDS::Locker lock;
194 return dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl)->GetNbRows();
197 CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbColumns()
199 SALOMEDS::Locker lock;
200 return dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl)->GetNbColumns();
203 void SALOMEDS_AttributeTableOfString_i::AddRow(const SALOMEDS::StringSeq& theData)
205 SALOMEDS::Locker lock;
206 Unexpect aCatch(ATS_IncorrectArgumentLength);
208 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
210 std::vector<std::string> aRow;
211 for (size_t i = 0; i < theData.length(); i++) aRow.push_back(std::string(CORBA::string_dup(theData[(CORBA::ULong)i]))); //!< TODO: conversion from size_t to CORBA::ULong
212 aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
215 void SALOMEDS_AttributeTableOfString_i::SetRow(CORBA::Long theRow, const SALOMEDS::StringSeq& theData)
217 SALOMEDS::Locker lock;
218 Unexpect aCatch(ATS_IncorrectArgumentLength);
220 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
222 std::vector<std::string> aRow;
223 for (size_t i = 0; i < theData.length(); i++) aRow.push_back(std::string(CORBA::string_dup(theData[(CORBA::ULong)i].in()))); //!< TODO: conversion from size_t to CORBA::ULong
224 aTable->SetRowData(theRow, aRow);
227 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRow(CORBA::Long theRow)
229 SALOMEDS::Locker lock;
230 Unexpect aCatch(ATS_IncorrectIndex);
231 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
232 if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
234 SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq;
235 std::vector<std::string> aRow = aTable->GetRowData(theRow);
236 CorbaSeq->length((CORBA::ULong)aRow.size()); //!< TODO: conversion from size_t to CORBA::ULong
237 for (int i = 0; i < (int)aRow.size(); i++) { //TODO: mismatch signed/unsigned
238 CorbaSeq[i] = CORBA::string_dup(aRow[i].c_str());
240 return CorbaSeq._retn();
243 void SALOMEDS_AttributeTableOfString_i::AddColumn(const SALOMEDS::StringSeq& theData)
245 SALOMEDS::Locker lock;
246 Unexpect aCatch(ATS_IncorrectArgumentLength);
248 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
250 std::vector<std::string> aColumn;
251 for (size_t i = 0; i < theData.length(); i++) aColumn.push_back(std::string(CORBA::string_dup(theData[(CORBA::ULong)i]))); //!< TODO: conversion from size_t to CORBA::ULong
252 aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
255 void SALOMEDS_AttributeTableOfString_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::StringSeq& theData)
257 SALOMEDS::Locker lock;
258 Unexpect aCatch(ATS_IncorrectArgumentLength);
260 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
262 std::vector<std::string> aColumn;
263 for (size_t i = 0; i < theData.length(); i++) aColumn.push_back(std::string(CORBA::string_dup(theData[(CORBA::ULong)i]))); //!< TODO: conversion from size_t to CORBA::ULong
264 aTable->SetColumnData(theColumn, aColumn);
267 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumn(CORBA::Long theColumn)
269 SALOMEDS::Locker lock;
270 Unexpect aCatch(ATS_IncorrectIndex);
271 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
272 if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
274 SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq;
275 std::vector<std::string> aColumn = aTable->GetColumnData(theColumn);
276 CorbaSeq->length((CORBA::ULong)aColumn.size()); //!< TODO: conversion from size_t to CORBA::ULong
277 for (int i = 0; i < (int)aColumn.size(); i++) { //TODO: mismatch signed/unsigned
278 CorbaSeq[i] = CORBA::string_dup(aColumn[i].c_str());
280 return CorbaSeq._retn();
283 void SALOMEDS_AttributeTableOfString_i::PutValue(const char* theValue, CORBA::Long theRow, CORBA::Long theColumn)
285 SALOMEDS::Locker lock;
286 Unexpect aCatch(ATS_IncorrectIndex);
288 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
289 char* aValue = CORBA::string_dup(theValue);
291 aTable->PutValue(aValue, theRow, theColumn);
294 CORBA::Boolean SALOMEDS_AttributeTableOfString_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn)
296 SALOMEDS::Locker lock;
297 return dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl)->HasValue(theRow, theColumn);
300 char* SALOMEDS_AttributeTableOfString_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
302 SALOMEDS::Locker lock;
303 Unexpect aCatch(ATS_IncorrectIndex);
304 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
305 if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
309 aValue = aTable->GetValue(theRow, theColumn);
312 throw SALOMEDS::AttributeTable::IncorrectIndex();
315 return CORBA::string_dup(aValue.c_str());
318 void SALOMEDS_AttributeTableOfString_i::RemoveValue(CORBA::Long theRow, CORBA::Long theColumn)
320 SALOMEDS::Locker lock;
321 Unexpect aCatch(ATS_IncorrectIndex);
322 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
323 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
324 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
327 aTable->RemoveValue(theRow, theColumn);
330 throw SALOMEDS::AttributeTable::IncorrectIndex();
334 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::GetRowSetIndices(CORBA::Long theRow)
336 SALOMEDS::Locker lock;
337 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
339 if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
341 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
342 std::vector<int> aSeq = aTable->GetSetRowIndices(theRow);
343 CorbaSeq->length((CORBA::ULong)aSeq.size()); //!< TODO: conversion from size_t to CORBA::ULong
344 for (int i = 0; i < (int)aSeq.size(); i++) { //TODO: mismatch signed/unsigned
345 CorbaSeq[i] = aSeq[i];
347 return CorbaSeq._retn();
350 void SALOMEDS_AttributeTableOfString_i::SetNbColumns(CORBA::Long theNbColumns)
352 SALOMEDS::Locker lock;
353 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
354 aTable->SetNbColumns(theNbColumns);
357 bool SALOMEDS_AttributeTableOfString_i::ReadFromFile(const SALOMEDS::TMPFile& theStream)
359 SALOMEDS::Locker lock;
360 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
362 std::string aStream((char*)&theStream[0], theStream.length());
363 aTable->Load(aStream);
367 SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfString_i::SaveToFile()
369 SALOMEDS::Locker lock;
370 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
372 std::string aString = aTable->Save();
373 char* aBuffer = (char*)CORBA::string_dup(aString.c_str());
374 int aBufferSize = (int)strlen((char*)aBuffer); //!< TODO: conversion from size_t to int
376 CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
378 SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
380 return aStreamFile._retn();
383 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::SortRow(CORBA::Long theRow,
384 SALOMEDS::AttributeTable::SortOrder sortOrder,
385 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
387 SALOMEDS::Locker lock;
388 Unexpect aCatch(ATS_IncorrectIndex);
390 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
391 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
393 std::vector<int> aSeq;
394 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
396 aSeq = aTable->SortRow(theRow, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
397 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
400 throw SALOMEDS::AttributeTable::IncorrectIndex();
402 CorbaSeq->length((CORBA::ULong)aSeq.size()); //!< TODO: conversion from size_t to CORBA::ULong
403 for (int i = 0; i < (int)aSeq.size(); i++) { //TODO: mismatch signed/unsigned
404 CorbaSeq[i] = aSeq[i];
406 return CorbaSeq._retn();
409 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::SortColumn(CORBA::Long theColumn,
410 SALOMEDS::AttributeTable::SortOrder sortOrder,
411 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
413 SALOMEDS::Locker lock;
414 Unexpect aCatch(ATS_IncorrectIndex);
416 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
417 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
419 std::vector<int> aSeq;
420 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
422 aSeq = aTable->SortColumn(theColumn, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
423 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
426 throw SALOMEDS::AttributeTable::IncorrectIndex();
428 CorbaSeq->length((CORBA::ULong)aSeq.size()); //!< TODO: conversion from size_t to CORBA::ULong
429 for (int i = 0; i < (int)aSeq.size(); i++) { //TODO: mismatch signed/unsigned
430 CorbaSeq[i] = aSeq[i];
432 return CorbaSeq._retn();
435 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::SortByRow(CORBA::Long theRow,
436 SALOMEDS::AttributeTable::SortOrder sortOrder,
437 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
439 SALOMEDS::Locker lock;
440 Unexpect aCatch(ATS_IncorrectIndex);
442 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
443 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
445 std::vector<int> aSeq;
446 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
448 aSeq = aTable->SortByRow(theRow, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
449 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
452 throw SALOMEDS::AttributeTable::IncorrectIndex();
454 CorbaSeq->length((CORBA::ULong)aSeq.size()); //!< TODO: conversion from size_t to CORBA::ULong
455 for (int i = 0; i < (int)aSeq.size(); i++) { //TODO: mismatch signed/unsigned
456 CorbaSeq[i] = aSeq[i];
458 return CorbaSeq._retn();
461 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::SortByColumn(CORBA::Long theColumn,
462 SALOMEDS::AttributeTable::SortOrder sortOrder,
463 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
465 SALOMEDS::Locker lock;
466 Unexpect aCatch(ATS_IncorrectIndex);
468 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
469 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
471 std::vector<int> aSeq;
472 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
474 aSeq = aTable->SortByColumn(theColumn, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
475 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
478 throw SALOMEDS::AttributeTable::IncorrectIndex();
480 CorbaSeq->length((CORBA::ULong)aSeq.size()); //!< TODO: conversion from size_t to CORBA::ULong
481 for (int i = 0; i < (int)aSeq.size(); i++) { //TODO: mismatch signed/unsigned
482 CorbaSeq[i] = aSeq[i];
484 return CorbaSeq._retn();
487 void SALOMEDS_AttributeTableOfString_i::SwapCells(CORBA::Long theRow1, CORBA::Long theColumn1,
488 CORBA::Long theRow2, CORBA::Long theColumn2)
490 SALOMEDS::Locker lock;
491 Unexpect aCatch(ATS_IncorrectIndex);
493 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
494 if (theRow1 < 1 || theRow1 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
495 if (theColumn1 < 1 || theColumn1 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
496 if (theRow2 < 1 || theRow2 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
497 if (theColumn2 < 1 || theColumn2 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
500 aTable->SwapCells(theRow1, theColumn1, theRow2, theColumn2);
503 throw SALOMEDS::AttributeTable::IncorrectIndex();
507 void SALOMEDS_AttributeTableOfString_i::SwapRows(CORBA::Long theRow1, CORBA::Long theRow2)
509 SALOMEDS::Locker lock;
510 Unexpect aCatch(ATS_IncorrectIndex);
512 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
513 if (theRow1 < 1 || theRow1 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
514 if (theRow2 < 1 || theRow2 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
517 aTable->SwapRows(theRow1, theRow2);
520 throw SALOMEDS::AttributeTable::IncorrectIndex();
524 void SALOMEDS_AttributeTableOfString_i::SwapColumns(CORBA::Long theColumn1, CORBA::Long theColumn2)
526 SALOMEDS::Locker lock;
527 Unexpect aCatch(ATS_IncorrectIndex);
529 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
530 if (theColumn1 < 1 || theColumn1 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
531 if (theColumn2 < 1 || theColumn2 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
534 aTable->SwapColumns(theColumn1, theColumn2);
537 throw SALOMEDS::AttributeTable::IncorrectIndex();