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)
57 throw (SALOMEDS::AttributeTable::IncorrectIndex)
59 SALOMEDS::Locker lock;
60 Unexpect aCatch(ATS_IncorrectIndex);
62 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
63 if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
65 aTable->SetRowTitle(theIndex, std::string(theTitle));
68 char* SALOMEDS_AttributeTableOfString_i::GetRowTitle(CORBA::Long theIndex)
69 throw (SALOMEDS::AttributeTable::IncorrectIndex)
71 SALOMEDS::Locker lock;
72 Unexpect aCatch (ATS_IncorrectIndex);
74 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
75 if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
76 CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowTitle(theIndex).c_str());
80 void SALOMEDS_AttributeTableOfString_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
81 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
83 SALOMEDS::Locker lock;
84 Unexpect aCatch(ATS_IncorrectArgumentLength);
86 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
87 if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
88 for (int i = 0; i < theTitles.length(); i++) {
89 aTable->SetRowTitle(i + 1, std::string((char*)theTitles[i].in()));
93 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowTitles()
95 SALOMEDS::Locker lock;
96 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
97 SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
98 aTitles->length(aTable->GetNbRows());
99 for(int i = 0; i < aTitles->length(); i++)
100 aTitles[i] =CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str());
101 return aTitles._retn();
104 void SALOMEDS_AttributeTableOfString_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
105 throw (SALOMEDS::AttributeTable::IncorrectIndex)
107 SALOMEDS::Locker lock;
108 Unexpect aCatch(ATS_IncorrectIndex);
110 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
111 if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
112 aTable->SetColumnTitle(theIndex, std::string((char*)theTitle));
115 char* SALOMEDS_AttributeTableOfString_i::GetColumnTitle(CORBA::Long theIndex)
116 throw (SALOMEDS::AttributeTable::IncorrectIndex)
118 SALOMEDS::Locker lock;
119 Unexpect aCatch (ATS_IncorrectIndex);
121 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
122 if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
123 CORBA::String_var c_s = CORBA::string_dup(aTable->GetColumnTitle(theIndex).c_str());
127 void SALOMEDS_AttributeTableOfString_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
128 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
130 SALOMEDS::Locker lock;
131 Unexpect aCatch(ATS_IncorrectArgumentLength);
133 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_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, std::string((char*)theTitles[i].in()));
140 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumnTitles()
142 SALOMEDS::Locker lock;
143 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_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_AttributeTableOfString_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
153 throw (SALOMEDS::AttributeTable::IncorrectIndex)
155 SALOMEDS::Locker lock;
156 Unexpect aCatch(ATS_IncorrectIndex);
158 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
159 if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
160 aTable->SetRowUnit(theIndex, std::string((char*)theUnit));
163 char* SALOMEDS_AttributeTableOfString_i::GetRowUnit(CORBA::Long theIndex)
164 throw (SALOMEDS::AttributeTable::IncorrectIndex)
166 SALOMEDS::Locker lock;
167 Unexpect aCatch (ATS_IncorrectIndex);
169 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
170 if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
171 CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowUnit(theIndex).c_str());
175 void SALOMEDS_AttributeTableOfString_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
176 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
178 SALOMEDS::Locker lock;
179 Unexpect aCatch(ATS_IncorrectArgumentLength);
181 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_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, std::string((char*)theUnits[i].in()));
188 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowUnits()
190 SALOMEDS::Locker lock;
191 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_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();
200 CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbRows()
202 SALOMEDS::Locker lock;
203 return dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl)->GetNbRows();
206 CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbColumns()
208 SALOMEDS::Locker lock;
209 return dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl)->GetNbColumns();
212 void SALOMEDS_AttributeTableOfString_i::AddRow(const SALOMEDS::StringSeq& theData)
213 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
215 SALOMEDS::Locker lock;
216 Unexpect aCatch(ATS_IncorrectArgumentLength);
218 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
220 std::vector<std::string> aRow;
221 for (int i = 0; i < theData.length(); i++) aRow.push_back(std::string(CORBA::string_dup(theData[i])));
222 aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
225 void SALOMEDS_AttributeTableOfString_i::SetRow(CORBA::Long theRow, const SALOMEDS::StringSeq& theData)
226 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectIndex)
228 SALOMEDS::Locker lock;
229 Unexpect aCatch(ATS_IncorrectArgumentLength);
231 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
233 std::vector<std::string> aRow;
234 for (int i = 0; i < theData.length(); i++) aRow.push_back(std::string(CORBA::string_dup(theData[i].in())));
235 aTable->SetRowData(theRow, aRow);
238 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRow(CORBA::Long theRow)
239 throw (SALOMEDS::AttributeTable::IncorrectIndex)
241 SALOMEDS::Locker lock;
242 Unexpect aCatch(ATS_IncorrectIndex);
243 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
244 if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
246 SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq;
247 std::vector<std::string> aRow = aTable->GetRowData(theRow);
248 CorbaSeq->length(aRow.size());
249 for (int i = 0; i < aRow.size(); i++) {
250 CorbaSeq[i] = CORBA::string_dup(aRow[i].c_str());
252 return CorbaSeq._retn();
255 void SALOMEDS_AttributeTableOfString_i::AddColumn(const SALOMEDS::StringSeq& theData)
256 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
258 SALOMEDS::Locker lock;
259 Unexpect aCatch(ATS_IncorrectArgumentLength);
261 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
263 std::vector<std::string> aColumn;
264 for (int i = 0; i < theData.length(); i++) aColumn.push_back(std::string(CORBA::string_dup(theData[i])));
265 aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
268 void SALOMEDS_AttributeTableOfString_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::StringSeq& theData)
269 throw (SALOMEDS::AttributeTable::IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectIndex)
271 SALOMEDS::Locker lock;
272 Unexpect aCatch(ATS_IncorrectArgumentLength);
274 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
276 std::vector<std::string> aColumn;
277 for (int i = 0; i < theData.length(); i++) aColumn.push_back(std::string(CORBA::string_dup(theData[i])));
278 aTable->SetColumnData(theColumn, aColumn);
281 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumn(CORBA::Long theColumn)
282 throw (SALOMEDS::AttributeTable::IncorrectIndex)
284 SALOMEDS::Locker lock;
285 Unexpect aCatch(ATS_IncorrectIndex);
286 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
287 if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
289 SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq;
290 std::vector<std::string> aColumn = aTable->GetColumnData(theColumn);
291 CorbaSeq->length(aColumn.size());
292 for (int i = 0; i < aColumn.size(); i++) {
293 CorbaSeq[i] = CORBA::string_dup(aColumn[i].c_str());
295 return CorbaSeq._retn();
298 void SALOMEDS_AttributeTableOfString_i::PutValue(const char* theValue, CORBA::Long theRow, CORBA::Long theColumn)
299 throw (SALOMEDS::AttributeTable::IncorrectIndex)
301 SALOMEDS::Locker lock;
302 Unexpect aCatch(ATS_IncorrectIndex);
304 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
305 char* aValue = CORBA::string_dup(theValue);
307 aTable->PutValue(aValue, theRow, theColumn);
310 CORBA::Boolean SALOMEDS_AttributeTableOfString_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn)
312 SALOMEDS::Locker lock;
313 return dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl)->HasValue(theRow, theColumn);
316 char* SALOMEDS_AttributeTableOfString_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
317 throw (SALOMEDS::AttributeTable::IncorrectIndex)
319 SALOMEDS::Locker lock;
320 Unexpect aCatch(ATS_IncorrectIndex);
321 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
322 if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
326 aValue = aTable->GetValue(theRow, theColumn);
329 throw SALOMEDS::AttributeTable::IncorrectIndex();
332 return CORBA::string_dup(aValue.c_str());
335 void SALOMEDS_AttributeTableOfString_i::RemoveValue(CORBA::Long theRow, CORBA::Long theColumn)
336 throw (SALOMEDS::AttributeTable::IncorrectIndex)
338 SALOMEDS::Locker lock;
339 Unexpect aCatch(ATS_IncorrectIndex);
340 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
341 if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
342 if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
345 aTable->RemoveValue(theRow, theColumn);
348 throw SALOMEDS::AttributeTable::IncorrectIndex();
352 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::GetRowSetIndices(CORBA::Long theRow)
354 SALOMEDS::Locker lock;
355 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
357 if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
359 SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
360 std::vector<int> aSeq = aTable->GetSetRowIndices(theRow);
361 CorbaSeq->length(aSeq.size());
362 for (int i = 0; i < aSeq.size(); i++) {
363 CorbaSeq[i] = aSeq[i];
365 return CorbaSeq._retn();
368 void SALOMEDS_AttributeTableOfString_i::SetNbColumns(CORBA::Long theNbColumns)
370 SALOMEDS::Locker lock;
371 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
372 aTable->SetNbColumns(theNbColumns);
375 bool SALOMEDS_AttributeTableOfString_i::ReadFromFile(const SALOMEDS::TMPFile& theStream)
377 SALOMEDS::Locker lock;
378 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
380 std::string aStream((char*)&theStream[0], theStream.length());
381 aTable->Load(aStream);
385 SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfString_i::SaveToFile()
387 SALOMEDS::Locker lock;
388 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_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_AttributeTableOfString_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(ATS_IncorrectIndex);
409 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_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_AttributeTableOfString_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(ATS_IncorrectIndex);
436 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_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_AttributeTableOfString_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(ATS_IncorrectIndex);
463 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_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_AttributeTableOfString_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(ATS_IncorrectIndex);
490 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_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_AttributeTableOfString_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(ATS_IncorrectIndex);
516 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_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_AttributeTableOfString_i::SwapRows(CORBA::Long theRow1, CORBA::Long theRow2)
531 throw (SALOMEDS::AttributeTable::IncorrectIndex)
533 SALOMEDS::Locker lock;
534 Unexpect aCatch(ATS_IncorrectIndex);
536 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_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_AttributeTableOfString_i::SwapColumns(CORBA::Long theColumn1, CORBA::Long theColumn2)
549 throw (SALOMEDS::AttributeTable::IncorrectIndex)
551 SALOMEDS::Locker lock;
552 Unexpect aCatch(ATS_IncorrectIndex);
554 SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_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();