Back to index

salome-kernel  6.5.0
SALOMEDS_AttributeTableOfString_i.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  File   : SALOMEDS_AttributeTableOfString_i.cxx
00024 //  Author : Sergey RUIN
00025 //  Module : SALOME
00026 //
00027 #include "SALOMEDS_AttributeTableOfString_i.hxx"
00028 #include "SALOMEDS.hxx"
00029 
00030 #include <sstream>
00031 #include <string>
00032 #include <vector>
00033 
00034 #include "Utils_ExceptHandlers.hxx"
00035 
00036 UNEXPECT_CATCH(ATS_IncorrectIndex, SALOMEDS::AttributeTable::IncorrectIndex);
00037 UNEXPECT_CATCH(ATS_IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectArgumentLength);
00038 
00039 void SALOMEDS_AttributeTableOfString_i::SetTitle(const char* theTitle) 
00040 {
00041   SALOMEDS::Locker lock;
00042   CheckLocked();
00043   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00044   CORBA::String_var aStr = CORBA::string_dup(theTitle);
00045   aTable->SetTitle(std::string(aStr));
00046 }
00047 
00048 char* SALOMEDS_AttributeTableOfString_i::GetTitle() 
00049 {
00050   SALOMEDS::Locker lock;
00051   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00052   CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str());
00053   return c_s._retn();
00054 }
00055 
00056 void SALOMEDS_AttributeTableOfString_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle)
00057      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00058 {
00059   SALOMEDS::Locker lock;
00060   Unexpect aCatch(ATS_IncorrectIndex);
00061   CheckLocked();
00062   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00063   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00064 
00065   aTable->SetRowTitle(theIndex, std::string(theTitle));
00066 }
00067 
00068 char* SALOMEDS_AttributeTableOfString_i::GetRowTitle(CORBA::Long theIndex)
00069      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00070 {
00071   SALOMEDS::Locker lock;
00072   Unexpect aCatch (ATS_IncorrectIndex);
00073   CheckLocked();
00074   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00075   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00076   CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowTitle(theIndex).c_str());
00077   return c_s._retn();
00078 }
00079 
00080 void SALOMEDS_AttributeTableOfString_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
00081      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00082 {
00083   SALOMEDS::Locker lock;
00084   Unexpect aCatch(ATS_IncorrectArgumentLength);
00085   CheckLocked();
00086   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00087   if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
00088   for (int i = 0; i < theTitles.length(); i++) {
00089     aTable->SetRowTitle(i + 1, std::string((char*)theTitles[i].in()));
00090   }
00091 }
00092 
00093 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowTitles() 
00094 {
00095   SALOMEDS::Locker lock;
00096   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00097   SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
00098   aTitles->length(aTable->GetNbRows());
00099   for(int i = 0; i < aTitles->length(); i++)
00100     aTitles[i] =CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str());
00101   return aTitles._retn();
00102 }
00103 
00104 void SALOMEDS_AttributeTableOfString_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
00105      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00106 {
00107   SALOMEDS::Locker lock;
00108   Unexpect aCatch(ATS_IncorrectIndex);
00109   CheckLocked();
00110   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00111   if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00112   aTable->SetColumnTitle(theIndex, std::string((char*)theTitle));
00113 }
00114 
00115 char* SALOMEDS_AttributeTableOfString_i::GetColumnTitle(CORBA::Long theIndex)
00116      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00117 {
00118   SALOMEDS::Locker lock;
00119   Unexpect aCatch (ATS_IncorrectIndex);
00120   CheckLocked();
00121   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00122   if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00123   CORBA::String_var c_s = CORBA::string_dup(aTable->GetColumnTitle(theIndex).c_str());
00124   return c_s._retn();
00125 }
00126 
00127 void SALOMEDS_AttributeTableOfString_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
00128      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00129 {
00130   SALOMEDS::Locker lock;
00131   Unexpect aCatch(ATS_IncorrectArgumentLength);
00132   CheckLocked();
00133   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00134   if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
00135   for (int i = 0; i < theTitles.length(); i++) {
00136     aTable->SetColumnTitle(i + 1, std::string((char*)theTitles[i].in()));
00137   }
00138 }
00139 
00140 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumnTitles() 
00141 {
00142   SALOMEDS::Locker lock;
00143   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00144   SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
00145   aTitles->length(aTable->GetNbColumns());
00146   for(int i = 0; i < aTitles->length(); i++)
00147     aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str());
00148   return aTitles._retn();
00149 }
00150 
00151 //Units support
00152 void SALOMEDS_AttributeTableOfString_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
00153      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00154 {
00155   SALOMEDS::Locker lock;
00156   Unexpect aCatch(ATS_IncorrectIndex);
00157   CheckLocked();
00158   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00159   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00160   aTable->SetRowUnit(theIndex, std::string((char*)theUnit));
00161 }
00162 
00163 char* SALOMEDS_AttributeTableOfString_i::GetRowUnit(CORBA::Long theIndex)
00164      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00165 {
00166   SALOMEDS::Locker lock;
00167   Unexpect aCatch (ATS_IncorrectIndex);
00168   CheckLocked();
00169   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00170   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00171   CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowUnit(theIndex).c_str());
00172   return c_s._retn();
00173 }
00174 
00175 void SALOMEDS_AttributeTableOfString_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
00176      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00177 {
00178   SALOMEDS::Locker lock;
00179   Unexpect aCatch(ATS_IncorrectArgumentLength);
00180   CheckLocked();
00181   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00182   if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
00183   for (int i = 0; i < theUnits.length(); i++) {
00184     aTable->SetRowUnit(i + 1, std::string((char*)theUnits[i].in()));
00185   }
00186 }
00187 
00188 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowUnits() 
00189 {
00190   SALOMEDS::Locker lock;
00191   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00192   SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq;
00193   aUnits->length(aTable->GetNbRows());
00194   for(int i = 0; i < aUnits->length(); i++)
00195     aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str());
00196   return aUnits._retn();
00197 }
00198 
00199 
00200 CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbRows() 
00201 {
00202   SALOMEDS::Locker lock;
00203   return dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl)->GetNbRows();
00204 }
00205 
00206 CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbColumns() 
00207 {
00208   SALOMEDS::Locker lock;
00209   return dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl)->GetNbColumns();
00210 }
00211 
00212 void SALOMEDS_AttributeTableOfString_i::AddRow(const SALOMEDS::StringSeq& theData)
00213      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00214 {
00215   SALOMEDS::Locker lock;
00216   Unexpect aCatch(ATS_IncorrectArgumentLength);
00217   CheckLocked();
00218   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00219   
00220   std::vector<std::string> aRow;
00221   for (int i = 0; i < theData.length(); i++) aRow.push_back(std::string(CORBA::string_dup(theData[i])));
00222   aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
00223 }
00224 
00225 void SALOMEDS_AttributeTableOfString_i::SetRow(CORBA::Long theRow, const SALOMEDS::StringSeq& theData)
00226      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectIndex)
00227 {
00228   SALOMEDS::Locker lock;
00229   Unexpect aCatch(ATS_IncorrectArgumentLength);
00230   CheckLocked();
00231   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00232   
00233   std::vector<std::string> aRow;
00234   for (int i = 0; i < theData.length(); i++) aRow.push_back(std::string(CORBA::string_dup(theData[i].in())));
00235   aTable->SetRowData(theRow, aRow);
00236 }
00237 
00238 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRow(CORBA::Long theRow)
00239      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00240 {
00241   SALOMEDS::Locker lock;
00242   Unexpect aCatch(ATS_IncorrectIndex);
00243   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00244   if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00245 
00246   SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq;
00247   std::vector<std::string> aRow = aTable->GetRowData(theRow);
00248   CorbaSeq->length(aRow.size());
00249   for (int i = 0; i < aRow.size(); i++) {
00250     CorbaSeq[i] = CORBA::string_dup(aRow[i].c_str());
00251   }
00252   return CorbaSeq._retn();
00253 }
00254 
00255 void SALOMEDS_AttributeTableOfString_i::AddColumn(const SALOMEDS::StringSeq& theData)
00256      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00257 {
00258   SALOMEDS::Locker lock;
00259   Unexpect aCatch(ATS_IncorrectArgumentLength);
00260   CheckLocked();
00261   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00262   
00263   std::vector<std::string> aColumn;
00264   for (int i = 0; i < theData.length(); i++) aColumn.push_back(std::string(CORBA::string_dup(theData[i])));
00265   aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
00266 }
00267 
00268 void SALOMEDS_AttributeTableOfString_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::StringSeq& theData)
00269      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectIndex)
00270 {
00271   SALOMEDS::Locker lock;
00272   Unexpect aCatch(ATS_IncorrectArgumentLength);
00273   CheckLocked();
00274   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00275   
00276   std::vector<std::string> aColumn;
00277   for (int i = 0; i < theData.length(); i++) aColumn.push_back(std::string(CORBA::string_dup(theData[i])));
00278   aTable->SetColumnData(theColumn, aColumn);
00279 }
00280 
00281 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumn(CORBA::Long theColumn)
00282      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00283 {
00284   SALOMEDS::Locker lock;
00285   Unexpect aCatch(ATS_IncorrectIndex);
00286   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00287   if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00288 
00289   SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq;
00290   std::vector<std::string> aColumn = aTable->GetColumnData(theColumn);
00291   CorbaSeq->length(aColumn.size());
00292   for (int i = 0; i < aColumn.size(); i++) {
00293     CorbaSeq[i] = CORBA::string_dup(aColumn[i].c_str());
00294   }
00295   return CorbaSeq._retn();
00296 }
00297 
00298 void SALOMEDS_AttributeTableOfString_i::PutValue(const char* theValue, CORBA::Long theRow, CORBA::Long theColumn)
00299      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00300 {
00301   SALOMEDS::Locker lock;
00302   Unexpect aCatch(ATS_IncorrectIndex);
00303   CheckLocked();
00304   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00305   char* aValue = CORBA::string_dup(theValue);
00306 
00307   aTable->PutValue(aValue, theRow, theColumn);
00308 }
00309 
00310 CORBA::Boolean SALOMEDS_AttributeTableOfString_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) 
00311 {
00312   SALOMEDS::Locker lock;
00313   return dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl)->HasValue(theRow, theColumn);
00314 }
00315 
00316 char* SALOMEDS_AttributeTableOfString_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
00317      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00318 {
00319   SALOMEDS::Locker lock;
00320   Unexpect aCatch(ATS_IncorrectIndex);
00321   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00322   if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00323 
00324   std::string aValue;
00325   try {
00326     aValue = aTable->GetValue(theRow, theColumn);
00327   }
00328   catch(...) {
00329     throw SALOMEDS::AttributeTable::IncorrectIndex();
00330   }
00331 
00332   return CORBA::string_dup(aValue.c_str());
00333 }
00334 
00335 void SALOMEDS_AttributeTableOfString_i::RemoveValue(CORBA::Long theRow, CORBA::Long theColumn)
00336   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00337 {
00338   SALOMEDS::Locker lock;
00339   Unexpect aCatch(ATS_IncorrectIndex);
00340   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00341   if (theRow    < 1 || theRow    > aTable->GetNbRows())    throw SALOMEDS::AttributeTable::IncorrectIndex();
00342   if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00343 
00344   try {
00345     aTable->RemoveValue(theRow, theColumn);
00346   }
00347   catch(...) {
00348     throw SALOMEDS::AttributeTable::IncorrectIndex();
00349   }
00350 }
00351 
00352 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::GetRowSetIndices(CORBA::Long theRow) 
00353 {
00354   SALOMEDS::Locker lock;
00355   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00356 
00357   if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00358 
00359   SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
00360   std::vector<int> aSeq = aTable->GetSetRowIndices(theRow);
00361   CorbaSeq->length(aSeq.size());
00362   for (int i = 0; i < aSeq.size(); i++) {
00363     CorbaSeq[i] = aSeq[i];
00364   }
00365   return CorbaSeq._retn(); 
00366 }
00367 
00368 void SALOMEDS_AttributeTableOfString_i::SetNbColumns(CORBA::Long theNbColumns)
00369 {
00370   SALOMEDS::Locker lock;
00371   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00372   aTable->SetNbColumns(theNbColumns);
00373 }
00374 
00375 bool SALOMEDS_AttributeTableOfString_i::ReadFromFile(const SALOMEDS::TMPFile& theStream) 
00376 {
00377   SALOMEDS::Locker lock;
00378   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00379 
00380   std::string aStream((char*)&theStream[0], theStream.length());
00381   aTable->Load(aStream);
00382   return true;
00383 }
00384 
00385 SALOMEDS::TMPFile*  SALOMEDS_AttributeTableOfString_i::SaveToFile()
00386 {
00387   SALOMEDS::Locker lock;
00388   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00389 
00390   std::string aString = aTable->Save();
00391   char* aBuffer = (char*)CORBA::string_dup(aString.c_str());
00392   int aBufferSize = strlen((char*)aBuffer);
00393 
00394   CORBA::Octet* anOctetBuf =  (CORBA::Octet*)aBuffer;
00395 
00396   SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
00397 
00398   return aStreamFile._retn();
00399 }
00400 
00401 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::SortRow(CORBA::Long theRow,
00402                                                               SALOMEDS::AttributeTable::SortOrder sortOrder, 
00403                                                               SALOMEDS::AttributeTable::SortPolicy sortPolicy)
00404   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00405 {
00406   SALOMEDS::Locker lock;
00407   Unexpect aCatch(ATS_IncorrectIndex);
00408   CheckLocked();
00409   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00410   if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00411 
00412   std::vector<int> aSeq;
00413   SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
00414   try {
00415     aSeq = aTable->SortRow(theRow, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder, 
00416                            (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
00417   }
00418   catch(...) {
00419     throw SALOMEDS::AttributeTable::IncorrectIndex();
00420   }
00421   CorbaSeq->length(aSeq.size());
00422   for (int i = 0; i < aSeq.size(); i++) {
00423     CorbaSeq[i] = aSeq[i];
00424   }
00425   return CorbaSeq._retn(); 
00426 }
00427 
00428 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::SortColumn(CORBA::Long theColumn, 
00429                                                                  SALOMEDS::AttributeTable::SortOrder sortOrder,
00430                                                                  SALOMEDS::AttributeTable::SortPolicy sortPolicy)
00431   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00432 {
00433   SALOMEDS::Locker lock;
00434   Unexpect aCatch(ATS_IncorrectIndex);
00435   CheckLocked();
00436   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00437   if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00438 
00439   std::vector<int> aSeq;
00440   SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
00441   try {
00442     aSeq = aTable->SortColumn(theColumn, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder, 
00443                               (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
00444   }
00445   catch(...) {
00446     throw SALOMEDS::AttributeTable::IncorrectIndex();
00447   }
00448   CorbaSeq->length(aSeq.size());
00449   for (int i = 0; i < aSeq.size(); i++) {
00450     CorbaSeq[i] = aSeq[i];
00451   }
00452   return CorbaSeq._retn(); 
00453 }
00454 
00455 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::SortByRow(CORBA::Long theRow,
00456                                                                 SALOMEDS::AttributeTable::SortOrder sortOrder, 
00457                                                                 SALOMEDS::AttributeTable::SortPolicy sortPolicy)
00458   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00459 {
00460   SALOMEDS::Locker lock;
00461   Unexpect aCatch(ATS_IncorrectIndex);
00462   CheckLocked();
00463   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00464   if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00465 
00466   std::vector<int> aSeq;
00467   SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
00468   try {
00469     aSeq = aTable->SortByRow(theRow, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder, 
00470                              (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
00471   }
00472   catch(...) {
00473     throw SALOMEDS::AttributeTable::IncorrectIndex();
00474   }
00475   CorbaSeq->length(aSeq.size());
00476   for (int i = 0; i < aSeq.size(); i++) {
00477     CorbaSeq[i] = aSeq[i];
00478   }
00479   return CorbaSeq._retn(); 
00480 }
00481 
00482 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::SortByColumn(CORBA::Long theColumn,
00483                                                                    SALOMEDS::AttributeTable::SortOrder sortOrder, 
00484                                                                    SALOMEDS::AttributeTable::SortPolicy sortPolicy)
00485   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00486 {
00487   SALOMEDS::Locker lock;
00488   Unexpect aCatch(ATS_IncorrectIndex);
00489   CheckLocked();
00490   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00491   if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00492 
00493   std::vector<int> aSeq;
00494   SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
00495   try {
00496     aSeq = aTable->SortByColumn(theColumn, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder, 
00497                                 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
00498   }
00499   catch(...) {
00500     throw SALOMEDS::AttributeTable::IncorrectIndex();
00501   }
00502   CorbaSeq->length(aSeq.size());
00503   for (int i = 0; i < aSeq.size(); i++) {
00504     CorbaSeq[i] = aSeq[i];
00505   }
00506   return CorbaSeq._retn(); 
00507 }
00508 
00509 void SALOMEDS_AttributeTableOfString_i::SwapCells(CORBA::Long theRow1, CORBA::Long theColumn1,
00510                                             CORBA::Long theRow2, CORBA::Long theColumn2)
00511   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00512 {
00513   SALOMEDS::Locker lock;
00514   Unexpect aCatch(ATS_IncorrectIndex);
00515   CheckLocked();
00516   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00517   if (theRow1    < 1 || theRow1    > aTable->GetNbRows())    throw SALOMEDS::AttributeTable::IncorrectIndex();
00518   if (theColumn1 < 1 || theColumn1 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00519   if (theRow2    < 1 || theRow2    > aTable->GetNbRows())    throw SALOMEDS::AttributeTable::IncorrectIndex();
00520   if (theColumn2 < 1 || theColumn2 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00521 
00522   try {
00523     aTable->SwapCells(theRow1, theColumn1, theRow2, theColumn2);
00524   }
00525   catch(...) {
00526     throw SALOMEDS::AttributeTable::IncorrectIndex();
00527   }
00528 }
00529 
00530 void SALOMEDS_AttributeTableOfString_i::SwapRows(CORBA::Long theRow1, CORBA::Long theRow2)
00531   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00532 {
00533   SALOMEDS::Locker lock;
00534   Unexpect aCatch(ATS_IncorrectIndex);
00535   CheckLocked();
00536   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00537   if (theRow1 < 1 || theRow1 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00538   if (theRow2 < 1 || theRow2 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00539 
00540   try {
00541     aTable->SwapRows(theRow1, theRow2);
00542   }
00543   catch(...) {
00544     throw SALOMEDS::AttributeTable::IncorrectIndex();
00545   }
00546 }
00547 
00548 void SALOMEDS_AttributeTableOfString_i::SwapColumns(CORBA::Long theColumn1, CORBA::Long theColumn2)
00549   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00550 {
00551   SALOMEDS::Locker lock;
00552   Unexpect aCatch(ATS_IncorrectIndex);
00553   CheckLocked();
00554   SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
00555   if (theColumn1 < 1 || theColumn1 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00556   if (theColumn2 < 1 || theColumn2 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00557 
00558   try {
00559     aTable->SwapColumns(theColumn1, theColumn2);
00560   }
00561   catch(...) {
00562     throw SALOMEDS::AttributeTable::IncorrectIndex();
00563   }
00564 }