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_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)
57 throw (SALOMEDS::AttributeTable::IncorrectIndex)
59 SALOMEDS::Locker lock;
60 Unexpect aCatch (ATI_IncorrectIndex);
62 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
63 if (theIndex < 1 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
64 aTable->SetRowTitle(theIndex, std::string(theTitle));
67 char* SALOMEDS_AttributeTableOfInteger_i::GetRowTitle(CORBA::Long theIndex)
68 throw (SALOMEDS::AttributeTable::IncorrectIndex)
70 SALOMEDS::Locker lock;
71 Unexpect aCatch (ATI_IncorrectIndex);
73 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
74 if (theIndex < 1 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
75 CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowTitle(theIndex).c_str());
79 void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
80 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
82 SALOMEDS::Locker lock;
83 Unexpect aCatch (ATI_IncorrectArgumentLength);
85 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
86 if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
87 for (int i = 0; i < theTitles.length(); i++) {
88 SetRowTitle(i + 1, theTitles[i]);
92 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowTitles()
94 SALOMEDS::Locker lock;
95 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
96 SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
97 aTitles->length(aTable->GetNbRows());
98 for(int i = 0; i < aTitles->length(); i++)
99 aTitles[i] = CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str());
100 return aTitles._retn();
103 void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
104 throw (SALOMEDS::AttributeTable::IncorrectIndex)
106 SALOMEDS::Locker lock;
107 Unexpect aCatch (ATI_IncorrectIndex);
109 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
110 if (theIndex < 1 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
111 CORBA::String_var aStr = CORBA::string_dup(theTitle);
112 aTable->SetColumnTitle(theIndex, std::string(aStr));
115 char* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitle(CORBA::Long theIndex)
116 throw (SALOMEDS::AttributeTable::IncorrectIndex)
118 SALOMEDS::Locker lock;
119 Unexpect aCatch (ATI_IncorrectIndex);
121 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
122 if (theIndex < 1 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
123 CORBA::String_var c_s = CORBA::string_dup(aTable->GetColumnTitle(theIndex).c_str());
127 void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
128 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
130 SALOMEDS::Locker lock;
131 Unexpect aCatch(ATI_IncorrectArgumentLength);
133 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
134 if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
135 for (int i = 0; i < theTitles.length(); i++) {
136 aTable->SetColumnTitle(i + 1, (char*)theTitles[i].in());
140 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitles()
142 SALOMEDS::Locker lock;
143 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
144 SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
145 aTitles->length(aTable->GetNbColumns());
146 for(int i = 0; i < aTitles->length(); i++)
147 aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str());
148 return aTitles._retn();
152 void SALOMEDS_AttributeTableOfInteger_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
153 throw (SALOMEDS::AttributeTable::IncorrectIndex)
155 SALOMEDS::Locker lock;
156 Unexpect aCatch (ATI_IncorrectIndex);
158 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
159 if (theIndex < 1 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
160 aTable->SetRowUnit(theIndex, std::string(theUnit));
163 char* SALOMEDS_AttributeTableOfInteger_i::GetRowUnit(CORBA::Long theIndex)
164 throw (SALOMEDS::AttributeTable::IncorrectIndex)
166 SALOMEDS::Locker lock;
167 Unexpect aCatch (ATI_IncorrectIndex);
169 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
170 if (theIndex < 1 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
171 CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowUnit(theIndex).c_str());
175 void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
176 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
178 SALOMEDS::Locker lock;
179 Unexpect aCatch (ATI_IncorrectArgumentLength);
181 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
182 if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
183 for (int i = 0; i < theUnits.length(); i++) {
184 aTable->SetRowUnit(i + 1, (char*)theUnits[i].in());
188 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowUnits()
190 SALOMEDS::Locker lock;
191 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
192 SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq;
193 aUnits->length(aTable->GetNbRows());
194 for(int i = 0; i < aUnits->length(); i++)
195 aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str());
196 return aUnits._retn();
199 CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbRows()
201 SALOMEDS::Locker lock;
202 return dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->GetNbRows();
205 CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbColumns()
207 SALOMEDS::Locker lock;
208 return dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->GetNbColumns();
211 void SALOMEDS_AttributeTableOfInteger_i::AddRow(const SALOMEDS::LongSeq& theData)
212 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
214 SALOMEDS::Locker lock;
215 Unexpect aCatch(ATI_IncorrectArgumentLength);
217 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
219 std::vector<int> aRow;
220 for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]);
222 aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
225 throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
229 void SALOMEDS_AttributeTableOfInteger_i::SetRow(CORBA::Long theRow, const SALOMEDS::LongSeq& theData)
230 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectIndex)
232 SALOMEDS::Locker lock;
233 Unexpect aCatch(ATI_IncorrectArgumentLength);
235 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
237 std::vector<int> aRow;
238 for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]);
240 aTable->SetRowData(theRow, aRow);
243 throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
247 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRow(CORBA::Long theRow)
248 throw (SALOMEDS::AttributeTable::IncorrectIndex)
250 SALOMEDS::Locker lock;
251 Unexpect aCatch(ATI_IncorrectIndex);
252 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
253 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
255 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
256 std::vector<int> aRow = aTable->GetRowData(theRow);
257 CorbaSeq->length(aRow.size());
258 for (int i = 0; i < aRow.size(); i++) {
259 CorbaSeq[i] = aRow[i];
261 return CorbaSeq._retn();
264 void SALOMEDS_AttributeTableOfInteger_i::AddColumn(const SALOMEDS::LongSeq& theData)
265 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
267 SALOMEDS::Locker lock;
268 Unexpect aCatch(ATI_IncorrectArgumentLength);
270 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
272 std::vector<int> aColumn;
273 for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]);
275 aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
278 throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
282 void SALOMEDS_AttributeTableOfInteger_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::LongSeq& theData)
283 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectIndex)
285 SALOMEDS::Locker lock;
286 Unexpect aCatch(ATI_IncorrectArgumentLength);
288 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
290 std::vector<int> aColumn;
291 for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]);
293 aTable->SetColumnData(theColumn, aColumn);
296 throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
300 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumn(CORBA::Long theColumn)
301 throw (SALOMEDS::AttributeTable::IncorrectIndex)
303 SALOMEDS::Locker lock;
304 Unexpect aCatch(ATI_IncorrectIndex);
305 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
306 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
308 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
309 std::vector<int> aColumn = aTable->GetColumnData(theColumn);
310 CorbaSeq->length(aColumn.size());
311 for (int i = 0; i < aColumn.size(); i++) {
312 CorbaSeq[i] = aColumn[i];
314 return CorbaSeq._retn();
317 void SALOMEDS_AttributeTableOfInteger_i::PutValue(CORBA::Long theValue, CORBA::Long theRow, CORBA::Long theColumn)
318 throw (SALOMEDS::AttributeTable::IncorrectIndex)
320 SALOMEDS::Locker lock;
321 Unexpect aCatch(ATI_IncorrectIndex);
323 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
326 aTable->PutValue(theValue, theRow, theColumn);
329 throw SALOMEDS::AttributeTable::IncorrectIndex();
333 CORBA::Boolean SALOMEDS_AttributeTableOfInteger_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn)
335 SALOMEDS::Locker lock;
336 return dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->HasValue(theRow, theColumn);
339 CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
340 throw (SALOMEDS::AttributeTable::IncorrectIndex)
342 SALOMEDS::Locker lock;
343 Unexpect aCatch(ATI_IncorrectIndex);
344 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
345 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
346 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
350 aValue = aTable->GetValue(theRow, theColumn);
353 throw SALOMEDS::AttributeTable::IncorrectIndex();
358 void SALOMEDS_AttributeTableOfInteger_i::RemoveValue(CORBA::Long theRow, CORBA::Long theColumn)
359 throw (SALOMEDS::AttributeTable::IncorrectIndex)
361 SALOMEDS::Locker lock;
362 Unexpect aCatch(ATI_IncorrectIndex);
363 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
364 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
365 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
368 aTable->RemoveValue(theRow, theColumn);
371 throw SALOMEDS::AttributeTable::IncorrectIndex();
375 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowSetIndices(CORBA::Long theRow)
377 SALOMEDS::Locker lock;
378 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
380 if(theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
382 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
383 std::vector<int> aSeq = aTable->GetSetRowIndices(theRow);
384 CorbaSeq->length(aSeq.size());
385 for (int i = 0; i < aSeq.size(); i++) {
386 CorbaSeq[i] = aSeq[i];
388 return CorbaSeq._retn();
391 void SALOMEDS_AttributeTableOfInteger_i::SetNbColumns(CORBA::Long theNbColumns)
393 SALOMEDS::Locker lock;
394 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
395 aTable->SetNbColumns(theNbColumns);
398 bool SALOMEDS_AttributeTableOfInteger_i::ReadFromFile(const SALOMEDS::TMPFile& theStream)
400 SALOMEDS::Locker lock;
401 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
403 std::string aStream((char*)&theStream[0], theStream.length());
404 aTable->Load(aStream);
408 SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfInteger_i::SaveToFile()
410 SALOMEDS::Locker lock;
411 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
413 std::string aString = aTable->Save();
415 char* aBuffer = (char*)CORBA::string_dup(aString.c_str());
416 int aBufferSize = strlen((char*)aBuffer);
418 CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
420 SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
422 return aStreamFile._retn();
425 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::SortRow(CORBA::Long theRow,
426 SALOMEDS::AttributeTable::SortOrder sortOrder,
427 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
428 throw (SALOMEDS::AttributeTable::IncorrectIndex)
430 SALOMEDS::Locker lock;
431 Unexpect aCatch(ATI_IncorrectIndex);
433 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
434 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
436 std::vector<int> aSeq;
437 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
439 aSeq = aTable->SortRow(theRow, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
440 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
443 throw SALOMEDS::AttributeTable::IncorrectIndex();
445 CorbaSeq->length(aSeq.size());
446 for (int i = 0; i < aSeq.size(); i++) {
447 CorbaSeq[i] = aSeq[i];
449 return CorbaSeq._retn();
452 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::SortColumn(CORBA::Long theColumn,
453 SALOMEDS::AttributeTable::SortOrder sortOrder,
454 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
455 throw (SALOMEDS::AttributeTable::IncorrectIndex)
457 SALOMEDS::Locker lock;
458 Unexpect aCatch(ATI_IncorrectIndex);
460 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
461 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
463 std::vector<int> aSeq;
464 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
466 aSeq = aTable->SortColumn(theColumn, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
467 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
470 throw SALOMEDS::AttributeTable::IncorrectIndex();
472 CorbaSeq->length(aSeq.size());
473 for (int i = 0; i < aSeq.size(); i++) {
474 CorbaSeq[i] = aSeq[i];
476 return CorbaSeq._retn();
479 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::SortByRow(CORBA::Long theRow,
480 SALOMEDS::AttributeTable::SortOrder sortOrder,
481 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
482 throw (SALOMEDS::AttributeTable::IncorrectIndex)
484 SALOMEDS::Locker lock;
485 Unexpect aCatch(ATI_IncorrectIndex);
487 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
488 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
490 std::vector<int> aSeq;
491 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
493 aSeq = aTable->SortByRow(theRow, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
494 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
497 throw SALOMEDS::AttributeTable::IncorrectIndex();
499 CorbaSeq->length(aSeq.size());
500 for (int i = 0; i < aSeq.size(); i++) {
501 CorbaSeq[i] = aSeq[i];
503 return CorbaSeq._retn();
506 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::SortByColumn(CORBA::Long theColumn,
507 SALOMEDS::AttributeTable::SortOrder sortOrder,
508 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
509 throw (SALOMEDS::AttributeTable::IncorrectIndex)
511 SALOMEDS::Locker lock;
512 Unexpect aCatch(ATI_IncorrectIndex);
514 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
515 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
517 std::vector<int> aSeq;
518 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
520 aSeq = aTable->SortByColumn(theColumn, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder,
521 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
524 throw SALOMEDS::AttributeTable::IncorrectIndex();
526 CorbaSeq->length(aSeq.size());
527 for (int i = 0; i < aSeq.size(); i++) {
528 CorbaSeq[i] = aSeq[i];
530 return CorbaSeq._retn();
533 void SALOMEDS_AttributeTableOfInteger_i::SwapCells(CORBA::Long theRow1, CORBA::Long theColumn1,
534 CORBA::Long theRow2, CORBA::Long theColumn2)
535 throw (SALOMEDS::AttributeTable::IncorrectIndex)
537 SALOMEDS::Locker lock;
538 Unexpect aCatch(ATI_IncorrectIndex);
540 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
541 if (theRow1 < 1 || theRow1 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
542 if (theColumn1 < 1 || theColumn1 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
543 if (theRow2 < 1 || theRow2 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
544 if (theColumn2 < 1 || theColumn2 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
547 aTable->SwapCells(theRow1, theColumn1, theRow2, theColumn2);
550 throw SALOMEDS::AttributeTable::IncorrectIndex();
554 void SALOMEDS_AttributeTableOfInteger_i::SwapRows(CORBA::Long theRow1, CORBA::Long theRow2)
555 throw (SALOMEDS::AttributeTable::IncorrectIndex)
557 SALOMEDS::Locker lock;
558 Unexpect aCatch(ATI_IncorrectIndex);
560 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
561 if (theRow1 < 1 || theRow1 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
562 if (theRow2 < 1 || theRow2 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
565 aTable->SwapRows(theRow1, theRow2);
568 throw SALOMEDS::AttributeTable::IncorrectIndex();
572 void SALOMEDS_AttributeTableOfInteger_i::SwapColumns(CORBA::Long theColumn1, CORBA::Long theColumn2)
573 throw (SALOMEDS::AttributeTable::IncorrectIndex)
575 SALOMEDS::Locker lock;
576 Unexpect aCatch(ATI_IncorrectIndex);
578 SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
579 if (theColumn1 < 1 || theColumn1 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
580 if (theColumn2 < 1 || theColumn2 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
583 aTable->SwapColumns(theColumn1, theColumn2);
586 throw SALOMEDS::AttributeTable::IncorrectIndex();