Back to index

salome-kernel  6.5.0
SALOMEDS_AttributeTableOfReal_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_AttributeTableOfReal_i.cxx
00024 //  Author : Sergey RUIN
00025 //  Module : SALOME
00026 //
00027 #include "SALOMEDS_AttributeTableOfReal_i.hxx"
00028 #include "SALOMEDS.hxx"
00029 
00030 #include <sstream>
00031 #include <string>
00032 #include <vector>
00033 
00034 #include "Utils_ExceptHandlers.hxx"
00035 UNEXPECT_CATCH(ATR_IncorrectIndex, SALOMEDS::AttributeTable::IncorrectIndex);
00036 UNEXPECT_CATCH(ATR_IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectArgumentLength);
00037 
00038 void SALOMEDS_AttributeTableOfReal_i::SetTitle(const char* theTitle) 
00039 {
00040   SALOMEDS::Locker lock;     
00041   CheckLocked();
00042   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00043   CORBA::String_var aStr = CORBA::string_dup(theTitle);
00044   aTable->SetTitle(std::string(aStr));
00045 }
00046 
00047 char* SALOMEDS_AttributeTableOfReal_i::GetTitle() 
00048 {
00049   SALOMEDS::Locker lock; 
00050   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00051   CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str());
00052   return c_s._retn();
00053 }
00054 
00055 void SALOMEDS_AttributeTableOfReal_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle)
00056      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00057 {
00058   SALOMEDS::Locker lock; 
00059   Unexpect aCatch (ATR_IncorrectIndex);
00060   CheckLocked();
00061   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00062   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00063   aTable->SetRowTitle(theIndex, std::string(theTitle));
00064 }
00065 
00066 char* SALOMEDS_AttributeTableOfReal_i::GetRowTitle(CORBA::Long theIndex)
00067      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00068 {
00069   SALOMEDS::Locker lock;
00070   Unexpect aCatch (ATR_IncorrectIndex);
00071   CheckLocked();
00072   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00073   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00074   CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowTitle(theIndex).c_str());
00075   return c_s._retn();
00076 }
00077 
00078 void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
00079      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00080 {
00081   SALOMEDS::Locker lock; 
00082   Unexpect aCatch (ATR_IncorrectArgumentLength);
00083   CheckLocked();
00084   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00085   if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
00086   for (int i = 0; i < theTitles.length(); i++) {
00087     aTable->SetRowTitle(i + 1, (char*)theTitles[i].in());
00088   }
00089 }
00090 
00091 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowTitles() 
00092 {
00093   SALOMEDS::Locker lock; 
00094   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00095   SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
00096   aTitles->length(aTable->GetNbRows());
00097   for(int i = 0; i < aTitles->length(); i++)
00098     aTitles[i] = CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str());
00099   return aTitles._retn();
00100 }
00101 
00102 void SALOMEDS_AttributeTableOfReal_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
00103      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00104 {
00105   SALOMEDS::Locker lock; 
00106   Unexpect aCatch (ATR_IncorrectIndex);
00107   CheckLocked();
00108   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00109   if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00110   CORBA::String_var aStr = CORBA::string_dup(theTitle);
00111   aTable->SetColumnTitle(theIndex, std::string(aStr));
00112 }
00113 
00114 char* SALOMEDS_AttributeTableOfReal_i::GetColumnTitle(CORBA::Long theIndex)
00115      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00116 {
00117   SALOMEDS::Locker lock;
00118   Unexpect aCatch (ATR_IncorrectIndex);
00119   CheckLocked();
00120   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00121   if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00122   CORBA::String_var c_s = CORBA::string_dup(aTable->GetColumnTitle(theIndex).c_str());
00123   return c_s._retn();
00124 }
00125 
00126 void SALOMEDS_AttributeTableOfReal_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
00127      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00128 {
00129   SALOMEDS::Locker lock; 
00130   Unexpect aCatch(ATR_IncorrectArgumentLength);
00131   CheckLocked();
00132   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00133   if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
00134   for (int i = 0; i < theTitles.length(); i++) {
00135     aTable->SetColumnTitle(i + 1, (char*)theTitles[i].in());
00136   }
00137 }
00138 
00139 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetColumnTitles() 
00140 {
00141   SALOMEDS::Locker lock; 
00142   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00143   SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
00144   aTitles->length(aTable->GetNbColumns());
00145   for(int i = 0; i < aTitles->length(); i++)
00146     aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str());
00147   return aTitles._retn();
00148 }
00149 
00150 //Units support
00151 void SALOMEDS_AttributeTableOfReal_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
00152      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00153 {
00154   SALOMEDS::Locker lock; 
00155   Unexpect aCatch (ATR_IncorrectIndex);
00156   CheckLocked();
00157   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00158   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00159   aTable->SetRowUnit(theIndex, std::string(theUnit));
00160 }
00161 
00162 char* SALOMEDS_AttributeTableOfReal_i::GetRowUnit(CORBA::Long theIndex)
00163      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00164 {
00165   SALOMEDS::Locker lock;
00166   Unexpect aCatch (ATR_IncorrectIndex);
00167   CheckLocked();
00168   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00169   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00170   CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowUnit(theIndex).c_str());
00171   return c_s._retn();
00172 }
00173 
00174 void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
00175      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00176 {
00177   SALOMEDS::Locker lock; 
00178   Unexpect aCatch (ATR_IncorrectArgumentLength);
00179   CheckLocked();
00180   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00181   if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
00182   for (int i = 0; i < theUnits.length(); i++) {
00183     aTable->SetRowUnit(i + 1, (char*)theUnits[i].in());
00184   }
00185 }
00186 
00187 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowUnits() 
00188 {
00189   SALOMEDS::Locker lock; 
00190   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00191   SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq;
00192   aUnits->length(aTable->GetNbRows());
00193   for(int i = 0; i < aUnits->length(); i++)
00194     aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str());
00195   return aUnits._retn();
00196 }
00197 
00198 
00199 CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbRows() 
00200 {
00201   SALOMEDS::Locker lock; 
00202   return dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl)->GetNbRows();
00203 }
00204 
00205 CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbColumns() 
00206 {
00207   SALOMEDS::Locker lock; 
00208   return dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl)->GetNbColumns();
00209 }
00210 
00211 void SALOMEDS_AttributeTableOfReal_i::AddRow(const SALOMEDS::DoubleSeq& theData)
00212      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00213 {
00214   SALOMEDS::Locker lock; 
00215   Unexpect aCatch(ATR_IncorrectArgumentLength);
00216   CheckLocked();
00217   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00218   
00219   std::vector<double> aRow;
00220   for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]);
00221   aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
00222 }
00223 
00224 void SALOMEDS_AttributeTableOfReal_i::SetRow(CORBA::Long theRow, const SALOMEDS::DoubleSeq& theData)
00225      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectIndex)
00226 {
00227   SALOMEDS::Locker lock; 
00228   Unexpect aCatch(ATR_IncorrectArgumentLength);
00229   CheckLocked();
00230   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00231   
00232   std::vector<double> aRow;
00233   for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]);
00234   aTable->SetRowData(theRow, aRow);
00235 }
00236 
00237 SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetRow(CORBA::Long theRow)
00238      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00239 {
00240   SALOMEDS::Locker lock; 
00241   Unexpect aCatch(ATR_IncorrectIndex);
00242   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00243   if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00244 
00245   SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq;
00246   std::vector<double> aRow = aTable->GetRowData(theRow);
00247   CorbaSeq->length(aRow.size());
00248   for (int i = 0; i < aRow.size(); i++) {
00249     CorbaSeq[i] = aRow[i];
00250   }
00251   return CorbaSeq._retn();
00252 }
00253 
00254 void SALOMEDS_AttributeTableOfReal_i::AddColumn(const SALOMEDS::DoubleSeq& theData)
00255      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00256 {
00257   SALOMEDS::Locker lock; 
00258   Unexpect aCatch(ATR_IncorrectArgumentLength);
00259   CheckLocked();
00260   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00261   
00262   std::vector<double> aColumn;
00263   for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]);
00264   aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
00265 }
00266 
00267 void SALOMEDS_AttributeTableOfReal_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::DoubleSeq& theData)
00268      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectIndex)
00269 {
00270   SALOMEDS::Locker lock; 
00271   Unexpect aCatch(ATR_IncorrectArgumentLength);
00272   CheckLocked();
00273   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00274   
00275   std::vector<double> aColumn;
00276   for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]);
00277   aTable->SetColumnData(theColumn, aColumn);
00278 }
00279 
00280 SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetColumn(CORBA::Long theColumn)
00281      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00282 {
00283   SALOMEDS::Locker lock; 
00284   Unexpect aCatch(ATR_IncorrectIndex);
00285   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00286   if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00287 
00288   SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq;
00289   std::vector<double> aColumn = aTable->GetColumnData(theColumn);
00290   CorbaSeq->length(aColumn.size());
00291   for (int i = 0; i < aColumn.size(); i++) {
00292     CorbaSeq[i] = aColumn[i];
00293   }
00294   return CorbaSeq._retn();
00295 }
00296 
00297 void SALOMEDS_AttributeTableOfReal_i::PutValue(CORBA::Double theValue, CORBA::Long theRow, CORBA::Long theColumn)
00298      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00299 {
00300   SALOMEDS::Locker lock; 
00301   Unexpect aCatch(ATR_IncorrectIndex);
00302   CheckLocked();
00303   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00304 
00305   aTable->PutValue(theValue, theRow, theColumn);
00306 }
00307 
00308 CORBA::Boolean SALOMEDS_AttributeTableOfReal_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) 
00309 {
00310   SALOMEDS::Locker lock; 
00311   return dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl)->HasValue(theRow, theColumn);
00312 }
00313 
00314 CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
00315      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00316 {
00317   SALOMEDS::Locker lock; 
00318   Unexpect aCatch(ATR_IncorrectIndex);
00319   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00320   if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00321 
00322   CORBA::Double aValue;
00323 
00324   try {
00325     aValue = aTable->GetValue(theRow, theColumn);
00326   }
00327   catch(...) {
00328     throw SALOMEDS::AttributeTable::IncorrectIndex();
00329   }
00330 
00331   return aValue;
00332 }
00333 
00334 void SALOMEDS_AttributeTableOfReal_i::RemoveValue(CORBA::Long theRow, CORBA::Long theColumn)
00335   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00336 {
00337   SALOMEDS::Locker lock;
00338   Unexpect aCatch(ATR_IncorrectIndex);
00339   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00340   if (theRow    < 1 || theRow    > aTable->GetNbRows())    throw SALOMEDS::AttributeTable::IncorrectIndex();
00341   if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00342 
00343   try {
00344     aTable->RemoveValue(theRow, theColumn);
00345   }
00346   catch(...) {
00347     throw SALOMEDS::AttributeTable::IncorrectIndex();
00348   }
00349 }
00350 
00351 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::GetRowSetIndices(CORBA::Long theRow) 
00352 {
00353   SALOMEDS::Locker lock; 
00354   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00355 
00356   if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00357 
00358   SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
00359   std::vector<int> aSeq = aTable->GetSetRowIndices(theRow);
00360   int len = aSeq.size();
00361   CorbaSeq->length(len);
00362   for (int i = 0; i < len; i++) {
00363     CorbaSeq[i] = aSeq[i];
00364   }
00365   return CorbaSeq._retn(); 
00366 }
00367 
00368 void SALOMEDS_AttributeTableOfReal_i::SetNbColumns(CORBA::Long theNbColumns)
00369 {
00370   SALOMEDS::Locker lock; 
00371   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00372   aTable->SetNbColumns(theNbColumns);
00373 }
00374 
00375 bool SALOMEDS_AttributeTableOfReal_i::ReadFromFile(const SALOMEDS::TMPFile& theStream) 
00376 {
00377   SALOMEDS::Locker lock; 
00378   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
00379 
00380   std::string aStream((char*)&theStream[0], theStream.length());
00381   aTable->Load(aStream);
00382   return true;
00383 }
00384 
00385 SALOMEDS::TMPFile*  SALOMEDS_AttributeTableOfReal_i::SaveToFile()
00386 {
00387   SALOMEDS::Locker lock; 
00388   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_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_AttributeTableOfReal_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(ATR_IncorrectIndex);
00408   CheckLocked();
00409   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_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_AttributeTableOfReal_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(ATR_IncorrectIndex);
00435   CheckLocked();
00436   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_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_AttributeTableOfReal_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(ATR_IncorrectIndex);
00462   CheckLocked();
00463   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_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_AttributeTableOfReal_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(ATR_IncorrectIndex);
00489   CheckLocked();
00490   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_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_AttributeTableOfReal_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(ATR_IncorrectIndex);
00515   CheckLocked();
00516   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_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_AttributeTableOfReal_i::SwapRows(CORBA::Long theRow1, CORBA::Long theRow2)
00531   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00532 {
00533   SALOMEDS::Locker lock;
00534   Unexpect aCatch(ATR_IncorrectIndex);
00535   CheckLocked();
00536   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_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_AttributeTableOfReal_i::SwapColumns(CORBA::Long theColumn1, CORBA::Long theColumn2)
00549   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00550 {
00551   SALOMEDS::Locker lock;
00552   Unexpect aCatch(ATR_IncorrectIndex);
00553   CheckLocked();
00554   SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_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 }