1 // Copyright (C) 2007-2023 CEA, EDF, 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_AttributeTableOfInteger_i.cxx
24 // Author : Sergey RUIN
27 #include "SALOMEDS_AttributeTableOfInteger_i.hxx"
28 #include "SALOMEDS.hxx"
30 #include "Utils_ExceptHandlers.hxx"
37 UNEXPECT_CATCH(ATI_IncorrectIndex, SALOMEDS::AttributeTable::IncorrectIndex)
38 UNEXPECT_CATCH(ATI_IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectArgumentLength)
40 void SALOMEDS_AttributeTableOfInteger_i::SetTitle(const char* theTitle)
42 SALOMEDS::Locker lock;
44 CORBA::String_var aStr = CORBA::string_dup(theTitle);
45 dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->SetTitle(std::string(aStr));
48 char* SALOMEDS_AttributeTableOfInteger_i::GetTitle()
50 SALOMEDS::Locker lock;
51 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
52 CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str());
56 void SALOMEDS_AttributeTableOfInteger_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle)
58 SALOMEDS::Locker lock;
59 Unexpect aCatch (ATI_IncorrectIndex);
61 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
62 if (theIndex < 1 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
63 aTable->SetRowTitle(theIndex, std::string(theTitle));
66 char* SALOMEDS_AttributeTableOfInteger_i::GetRowTitle(CORBA::Long theIndex)
68 SALOMEDS::Locker lock;
69 Unexpect aCatch (ATI_IncorrectIndex);
71 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
72 if (theIndex < 1 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
73 CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowTitle(theIndex).c_str());
77 void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
79 SALOMEDS::Locker lock;
80 Unexpect aCatch (ATI_IncorrectArgumentLength);
82 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
83 if ((int)theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
84 for (int i = 0; i < (int)theTitles.length(); i++) {
85 SetRowTitle(i + 1, theTitles[i]);
89 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowTitles()
91 SALOMEDS::Locker lock;
92 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
93 SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
94 aTitles->length(aTable->GetNbRows());
95 for(int i = 0; i < (int)aTitles->length(); i++)
96 aTitles[i] = CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str());
97 return aTitles._retn();
100 void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
102 SALOMEDS::Locker lock;
103 Unexpect aCatch (ATI_IncorrectIndex);
105 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
106 if (theIndex < 1 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
107 CORBA::String_var aStr = CORBA::string_dup(theTitle);
108 aTable->SetColumnTitle(theIndex, std::string(aStr));
111 char* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitle(CORBA::Long theIndex)
113 SALOMEDS::Locker lock;
114 Unexpect aCatch (ATI_IncorrectIndex);
116 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
117 if (theIndex < 1 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
118 CORBA::String_var c_s = CORBA::string_dup(aTable->GetColumnTitle(theIndex).c_str());
122 void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
124 SALOMEDS::Locker lock;
125 Unexpect aCatch(ATI_IncorrectArgumentLength);
127 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_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, (char*)theTitles[i].in());
134 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitles()
136 SALOMEDS::Locker lock;
137 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_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_AttributeTableOfInteger_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
148 SALOMEDS::Locker lock;
149 Unexpect aCatch (ATI_IncorrectIndex);
151 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
152 if (theIndex < 1 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
153 aTable->SetRowUnit(theIndex, std::string(theUnit));
156 char* SALOMEDS_AttributeTableOfInteger_i::GetRowUnit(CORBA::Long theIndex)
158 SALOMEDS::Locker lock;
159 Unexpect aCatch (ATI_IncorrectIndex);
161 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
162 if (theIndex < 1 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
163 CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowUnit(theIndex).c_str());
167 void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
169 SALOMEDS::Locker lock;
170 Unexpect aCatch (ATI_IncorrectArgumentLength);
172 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_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, (char*)theUnits[i].in());
179 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowUnits()
181 SALOMEDS::Locker lock;
182 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_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();
190 CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbRows()
192 SALOMEDS::Locker lock;
193 return dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->GetNbRows();
196 CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbColumns()
198 SALOMEDS::Locker lock;
199 return dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->GetNbColumns();
202 void SALOMEDS_AttributeTableOfInteger_i::AddRow(const SALOMEDS::LongSeq& theData)
204 SALOMEDS::Locker lock;
205 Unexpect aCatch(ATI_IncorrectArgumentLength);
207 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
209 std::vector<int> aRow;
210 for (size_t i = 0; i < theData.length(); i++) aRow.push_back(theData[(CORBA::ULong)i]); //!< TODO: conversion from size_t to CORBA::ULong
212 aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
215 throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
219 void SALOMEDS_AttributeTableOfInteger_i::SetRow(CORBA::Long theRow, const SALOMEDS::LongSeq& theData)
221 SALOMEDS::Locker lock;
222 Unexpect aCatch(ATI_IncorrectArgumentLength);
224 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
226 std::vector<int> aRow;
227 for (size_t i = 0; i < theData.length(); i++) aRow.push_back(theData[(CORBA::ULong)i]); //!< TODO: conversion from size_t to CORBA::ULong
229 aTable->SetRowData(theRow, aRow);
232 throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
236 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRow(CORBA::Long theRow)
238 SALOMEDS::Locker lock;
239 Unexpect aCatch(ATI_IncorrectIndex);
240 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
241 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
243 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
244 std::vector<int> aRow = aTable->GetRowData(theRow);
245 CorbaSeq->length((CORBA::ULong)aRow.size()); //!< TODO: conversion from size_t to CORBA::ULong
246 for (int i = 0; i < (int)aRow.size(); i++) {
247 CorbaSeq[i] = aRow[i];
249 return CorbaSeq._retn();
252 void SALOMEDS_AttributeTableOfInteger_i::AddColumn(const SALOMEDS::LongSeq& theData)
254 SALOMEDS::Locker lock;
255 Unexpect aCatch(ATI_IncorrectArgumentLength);
257 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
259 std::vector<int> aColumn;
260 for (size_t i = 0; i < theData.length(); i++) aColumn.push_back(theData[(CORBA::ULong)i]); //!< TODO: conversion from size_t to CORBA::ULong
262 aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
265 throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
269 void SALOMEDS_AttributeTableOfInteger_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::LongSeq& theData)
271 SALOMEDS::Locker lock;
272 Unexpect aCatch(ATI_IncorrectArgumentLength);
274 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
276 std::vector<int> aColumn;
277 for (size_t i = 0; i < theData.length(); i++) aColumn.push_back(theData[(CORBA::ULong)i]); //!< TODO: conversion from size_t to CORBA::ULong
279 aTable->SetColumnData(theColumn, aColumn);
282 throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
286 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumn(CORBA::Long theColumn)
288 SALOMEDS::Locker lock;
289 Unexpect aCatch(ATI_IncorrectIndex);
290 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
291 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
293 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
294 std::vector<int> aColumn = aTable->GetColumnData(theColumn);
295 CorbaSeq->length((CORBA::ULong)aColumn.size()); //!< TODO: conversion from size_t to CORBA::ULong
296 for (int i = 0; i < (int)aColumn.size(); i++) {
297 CorbaSeq[i] = aColumn[i];
299 return CorbaSeq._retn();
302 void SALOMEDS_AttributeTableOfInteger_i::PutValue(CORBA::Long theValue, CORBA::Long theRow, CORBA::Long theColumn)
304 SALOMEDS::Locker lock;
305 Unexpect aCatch(ATI_IncorrectIndex);
307 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
310 aTable->PutValue(theValue, theRow, theColumn);
313 throw SALOMEDS::AttributeTable::IncorrectIndex();
317 CORBA::Boolean SALOMEDS_AttributeTableOfInteger_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn)
319 SALOMEDS::Locker lock;
320 return dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->HasValue(theRow, theColumn);
323 CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
325 SALOMEDS::Locker lock;
326 Unexpect aCatch(ATI_IncorrectIndex);
327 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
328 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
329 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
333 aValue = aTable->GetValue(theRow, theColumn);
336 throw SALOMEDS::AttributeTable::IncorrectIndex();
341 void SALOMEDS_AttributeTableOfInteger_i::RemoveValue(CORBA::Long theRow, CORBA::Long theColumn)
343 SALOMEDS::Locker lock;
344 Unexpect aCatch(ATI_IncorrectIndex);
345 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
346 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
347 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
350 aTable->RemoveValue(theRow, theColumn);
353 throw SALOMEDS::AttributeTable::IncorrectIndex();
357 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowSetIndices(CORBA::Long theRow)
359 SALOMEDS::Locker lock;
360 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
362 if(theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
364 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
365 std::vector<int> aSeq = aTable->GetSetRowIndices(theRow);
366 CorbaSeq->length((CORBA::ULong)aSeq.size()); //!< TODO: conversion from size_t to CORBA::ULong
367 for (int i = 0; i < (int)aSeq.size(); i++) { //TODO: mismatch signed/unsigned
368 CorbaSeq[i] = aSeq[i];
370 return CorbaSeq._retn();
373 void SALOMEDS_AttributeTableOfInteger_i::SetNbColumns(CORBA::Long theNbColumns)
375 SALOMEDS::Locker lock;
376 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
377 aTable->SetNbColumns(theNbColumns);
380 bool SALOMEDS_AttributeTableOfInteger_i::ReadFromFile(const SALOMEDS::TMPFile& theStream)
382 SALOMEDS::Locker lock;
383 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
385 std::string aStream((char*)&theStream[0], theStream.length());
386 aTable->Load(aStream);
390 SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfInteger_i::SaveToFile()
392 SALOMEDS::Locker lock;
393 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
395 std::string aString = aTable->Save();
397 char* aBuffer = (char*)CORBA::string_dup(aString.c_str());
398 int aBufferSize = (int)strlen((char*)aBuffer); //!< TODO: conversion from size_t to int
400 CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
402 SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
404 return aStreamFile._retn();
407 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::SortRow(CORBA::Long theRow,
408 SALOMEDS::AttributeTable::SortOrder sortOrder,
409 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
411 SALOMEDS::Locker lock;
412 Unexpect aCatch(ATI_IncorrectIndex);
414 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
415 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
417 std::vector<int> aSeq;
418 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
420 aSeq = aTable->SortRow(theRow, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
421 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
424 throw SALOMEDS::AttributeTable::IncorrectIndex();
426 CorbaSeq->length((CORBA::ULong)aSeq.size()); //!< TODO: conversion from size_t to CORBA::ULong
427 for (int i = 0; i < (int)aSeq.size(); i++) { //TODO: mismatch signed/unsigned
428 CorbaSeq[i] = aSeq[i];
430 return CorbaSeq._retn();
433 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::SortColumn(CORBA::Long theColumn,
434 SALOMEDS::AttributeTable::SortOrder sortOrder,
435 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
437 SALOMEDS::Locker lock;
438 Unexpect aCatch(ATI_IncorrectIndex);
440 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
441 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
443 std::vector<int> aSeq;
444 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
446 aSeq = aTable->SortColumn(theColumn, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
447 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
450 throw SALOMEDS::AttributeTable::IncorrectIndex();
452 CorbaSeq->length((CORBA::ULong)aSeq.size()); //!< TODO: conversion from size_t to CORBA::ULong
453 for (int i = 0; i < (int)aSeq.size(); i++) { //TODO: mismatch signed/unsigned
454 CorbaSeq[i] = aSeq[i];
456 return CorbaSeq._retn();
459 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::SortByRow(CORBA::Long theRow,
460 SALOMEDS::AttributeTable::SortOrder sortOrder,
461 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
463 SALOMEDS::Locker lock;
464 Unexpect aCatch(ATI_IncorrectIndex);
466 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
467 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
469 std::vector<int> aSeq;
470 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
472 aSeq = aTable->SortByRow(theRow, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
473 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
476 throw SALOMEDS::AttributeTable::IncorrectIndex();
478 CorbaSeq->length((CORBA::ULong)aSeq.size()); //!< TODO: conversion from size_t to CORBA::ULong
479 for (int i = 0; i < (int)aSeq.size(); i++) { //TODO: mismatch signed/unsigned
480 CorbaSeq[i] = aSeq[i];
482 return CorbaSeq._retn();
485 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::SortByColumn(CORBA::Long theColumn,
486 SALOMEDS::AttributeTable::SortOrder sortOrder,
487 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
489 SALOMEDS::Locker lock;
490 Unexpect aCatch(ATI_IncorrectIndex);
492 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
493 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
495 std::vector<int> aSeq;
496 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
498 aSeq = aTable->SortByColumn(theColumn, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
499 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
502 throw SALOMEDS::AttributeTable::IncorrectIndex();
504 CorbaSeq->length((CORBA::ULong)aSeq.size()); //!< TODO: conversion from size_t to CORBA::ULong
505 for (int i = 0; i < (int)aSeq.size(); i++) { //TODO: mismatch signed/unsigned
506 CorbaSeq[i] = aSeq[i];
508 return CorbaSeq._retn();
511 void SALOMEDS_AttributeTableOfInteger_i::SwapCells(CORBA::Long theRow1, CORBA::Long theColumn1,
512 CORBA::Long theRow2, CORBA::Long theColumn2)
514 SALOMEDS::Locker lock;
515 Unexpect aCatch(ATI_IncorrectIndex);
517 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
518 if (theRow1 < 1 || theRow1 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
519 if (theColumn1 < 1 || theColumn1 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
520 if (theRow2 < 1 || theRow2 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
521 if (theColumn2 < 1 || theColumn2 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
524 aTable->SwapCells(theRow1, theColumn1, theRow2, theColumn2);
527 throw SALOMEDS::AttributeTable::IncorrectIndex();
531 void SALOMEDS_AttributeTableOfInteger_i::SwapRows(CORBA::Long theRow1, CORBA::Long theRow2)
533 SALOMEDS::Locker lock;
534 Unexpect aCatch(ATI_IncorrectIndex);
536 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_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_AttributeTableOfInteger_i::SwapColumns(CORBA::Long theColumn1, CORBA::Long theColumn2)
550 SALOMEDS::Locker lock;
551 Unexpect aCatch(ATI_IncorrectIndex);
553 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
554 if (theColumn1 < 1 || theColumn1 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
555 if (theColumn2 < 1 || theColumn2 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
558 aTable->SwapColumns(theColumn1, theColumn2);
561 throw SALOMEDS::AttributeTable::IncorrectIndex();