Back to index

salome-kernel  6.5.0
SALOMEDS_AttributeTableOfInteger_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_AttributeTableOfInteger_i.cxx
00024 //  Author : Sergey RUIN
00025 //  Module : SALOME
00026 //
00027 #include "SALOMEDS_AttributeTableOfInteger_i.hxx"
00028 #include "SALOMEDS.hxx"
00029 
00030 #include "Utils_ExceptHandlers.hxx"
00031 
00032 #include <stdexcept>
00033 #include <sstream>
00034 #include <string>
00035 #include <vector>
00036 
00037 UNEXPECT_CATCH(ATI_IncorrectIndex, SALOMEDS::AttributeTable::IncorrectIndex);
00038 UNEXPECT_CATCH(ATI_IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectArgumentLength);
00039 
00040 void SALOMEDS_AttributeTableOfInteger_i::SetTitle(const char* theTitle) 
00041 {
00042   SALOMEDS::Locker lock;
00043   CheckLocked();
00044   CORBA::String_var aStr = CORBA::string_dup(theTitle);
00045   dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->SetTitle(std::string(aStr));
00046 }
00047 
00048 char* SALOMEDS_AttributeTableOfInteger_i::GetTitle() 
00049 {
00050   SALOMEDS::Locker lock;
00051   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00052   CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str());
00053   return c_s._retn();
00054 }
00055 
00056 void SALOMEDS_AttributeTableOfInteger_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle)
00057      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00058 {
00059   SALOMEDS::Locker lock;
00060   Unexpect aCatch (ATI_IncorrectIndex);
00061   CheckLocked();
00062   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00063   if (theIndex < 1 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00064   aTable->SetRowTitle(theIndex, std::string(theTitle));
00065 }
00066 
00067 char* SALOMEDS_AttributeTableOfInteger_i::GetRowTitle(CORBA::Long theIndex)
00068      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00069 {
00070   SALOMEDS::Locker lock;
00071   Unexpect aCatch (ATI_IncorrectIndex);
00072   CheckLocked();
00073   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00074   if (theIndex < 1 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00075   CORBA::String_var c_s = CORBA::string_dup(aTable->GetRowTitle(theIndex).c_str());
00076   return c_s._retn();
00077 }
00078 
00079 void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
00080      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00081 {
00082   SALOMEDS::Locker lock;
00083   Unexpect aCatch (ATI_IncorrectArgumentLength);
00084   CheckLocked();
00085   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00086   if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
00087   for (int i = 0; i < theTitles.length(); i++) {
00088     SetRowTitle(i + 1, theTitles[i]);
00089   }
00090 }
00091 
00092 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowTitles() 
00093 {
00094   SALOMEDS::Locker lock;
00095   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00096   SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
00097   aTitles->length(aTable->GetNbRows());
00098   for(int i = 0; i < aTitles->length(); i++)
00099     aTitles[i] = CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str());
00100   return aTitles._retn();
00101 }
00102 
00103 void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
00104      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00105 {
00106   SALOMEDS::Locker lock;
00107   Unexpect aCatch (ATI_IncorrectIndex);
00108   CheckLocked();
00109   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00110   if (theIndex < 1 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00111   CORBA::String_var aStr = CORBA::string_dup(theTitle);
00112   aTable->SetColumnTitle(theIndex, std::string(aStr));
00113 }
00114 
00115 char* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitle(CORBA::Long theIndex)
00116      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00117 {
00118   SALOMEDS::Locker lock;
00119   Unexpect aCatch (ATI_IncorrectIndex);
00120   CheckLocked();
00121   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00122   if (theIndex < 1 || 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_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
00128      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00129 {
00130   SALOMEDS::Locker lock;
00131   Unexpect aCatch(ATI_IncorrectArgumentLength);
00132   CheckLocked();
00133   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_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, (char*)theTitles[i].in());
00137   }
00138 }
00139 
00140 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitles() 
00141 {
00142   SALOMEDS::Locker lock;
00143   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_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_AttributeTableOfInteger_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
00153      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00154 {
00155   SALOMEDS::Locker lock;
00156   Unexpect aCatch (ATI_IncorrectIndex);
00157   CheckLocked();
00158   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00159   if (theIndex < 1 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00160   aTable->SetRowUnit(theIndex, std::string(theUnit));
00161 }
00162 
00163 char* SALOMEDS_AttributeTableOfInteger_i::GetRowUnit(CORBA::Long theIndex)
00164      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00165 {
00166   SALOMEDS::Locker lock;
00167   Unexpect aCatch (ATI_IncorrectIndex);
00168   CheckLocked();
00169   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00170   if (theIndex < 1 || 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_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
00176      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00177 {
00178   SALOMEDS::Locker lock;
00179   Unexpect aCatch (ATI_IncorrectArgumentLength);
00180   CheckLocked();
00181   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_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, (char*)theUnits[i].in());
00185   }
00186 }
00187 
00188 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowUnits() 
00189 {
00190   SALOMEDS::Locker lock;
00191   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_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 CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbRows() 
00200 {
00201   SALOMEDS::Locker lock;
00202   return dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->GetNbRows();
00203 }
00204 
00205 CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbColumns() 
00206 {
00207   SALOMEDS::Locker lock;
00208   return dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->GetNbColumns();
00209 }
00210 
00211 void SALOMEDS_AttributeTableOfInteger_i::AddRow(const SALOMEDS::LongSeq& theData)
00212      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00213 {
00214   SALOMEDS::Locker lock;
00215   Unexpect aCatch(ATI_IncorrectArgumentLength);
00216   CheckLocked();
00217   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00218   
00219   std::vector<int> aRow;
00220   for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]);
00221   try {
00222     aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
00223   }
00224   catch(...) {
00225     throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
00226   }
00227 }
00228 
00229 void SALOMEDS_AttributeTableOfInteger_i::SetRow(CORBA::Long theRow, const SALOMEDS::LongSeq& theData)
00230      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectIndex)
00231 {
00232   SALOMEDS::Locker lock;
00233   Unexpect aCatch(ATI_IncorrectArgumentLength);
00234   CheckLocked();
00235   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00236   
00237   std::vector<int> aRow;
00238   for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]);
00239   try {
00240     aTable->SetRowData(theRow, aRow);
00241   }
00242   catch(...) {
00243     throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
00244   }  
00245 }
00246 
00247 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRow(CORBA::Long theRow)
00248      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00249 {
00250   SALOMEDS::Locker lock;
00251   Unexpect aCatch(ATI_IncorrectIndex);
00252   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00253   if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00254 
00255   SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
00256   std::vector<int> aRow = aTable->GetRowData(theRow);
00257   CorbaSeq->length(aRow.size());
00258   for (int i = 0; i < aRow.size(); i++) {
00259     CorbaSeq[i] = aRow[i];
00260   }
00261   return CorbaSeq._retn();
00262 }
00263 
00264 void SALOMEDS_AttributeTableOfInteger_i::AddColumn(const SALOMEDS::LongSeq& theData)
00265      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength)
00266 {
00267   SALOMEDS::Locker lock;
00268   Unexpect aCatch(ATI_IncorrectArgumentLength);
00269   CheckLocked();
00270   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00271   
00272   std::vector<int> aColumn;
00273   for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]);
00274   try {
00275     aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
00276   }
00277   catch(...) {
00278     throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
00279   }  
00280 }
00281 
00282 void SALOMEDS_AttributeTableOfInteger_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::LongSeq& theData)
00283      throw (SALOMEDS::AttributeTable::IncorrectArgumentLength, SALOMEDS::AttributeTable::IncorrectIndex)
00284 {
00285   SALOMEDS::Locker lock;
00286   Unexpect aCatch(ATI_IncorrectArgumentLength);
00287   CheckLocked();
00288   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00289 
00290   std::vector<int> aColumn; 
00291   for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]);
00292   try {
00293     aTable->SetColumnData(theColumn, aColumn);
00294   }
00295   catch(...) {
00296     throw SALOMEDS::AttributeTable::IncorrectArgumentLength();
00297   }
00298 }
00299 
00300 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumn(CORBA::Long theColumn)
00301      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00302 {
00303   SALOMEDS::Locker lock;
00304   Unexpect aCatch(ATI_IncorrectIndex);
00305   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00306   if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00307 
00308   SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
00309   std::vector<int> aColumn = aTable->GetColumnData(theColumn);
00310   CorbaSeq->length(aColumn.size());
00311   for (int i = 0; i < aColumn.size(); i++) {
00312     CorbaSeq[i] = aColumn[i];
00313   }
00314   return CorbaSeq._retn();
00315 }
00316 
00317 void SALOMEDS_AttributeTableOfInteger_i::PutValue(CORBA::Long theValue, CORBA::Long theRow, CORBA::Long theColumn)
00318      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00319 {
00320   SALOMEDS::Locker lock;
00321   Unexpect aCatch(ATI_IncorrectIndex);
00322   CheckLocked();
00323   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00324 
00325   try {
00326     aTable->PutValue(theValue, theRow, theColumn);
00327   }
00328   catch(...) {
00329     throw SALOMEDS::AttributeTable::IncorrectIndex();
00330   }
00331 }
00332 
00333 CORBA::Boolean SALOMEDS_AttributeTableOfInteger_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) 
00334 {
00335   SALOMEDS::Locker lock;
00336   return dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->HasValue(theRow, theColumn);
00337 }
00338 
00339 CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
00340      throw (SALOMEDS::AttributeTable::IncorrectIndex)
00341 {
00342   SALOMEDS::Locker lock;
00343   Unexpect aCatch(ATI_IncorrectIndex);
00344   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00345   if (theRow    < 1 || theRow    > aTable->GetNbRows())    throw SALOMEDS::AttributeTable::IncorrectIndex();
00346   if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00347 
00348   CORBA::Long aValue;
00349   try {
00350     aValue = aTable->GetValue(theRow, theColumn);
00351   }
00352   catch(...) {
00353     throw SALOMEDS::AttributeTable::IncorrectIndex();
00354   }
00355   return aValue;
00356 }
00357 
00358 void SALOMEDS_AttributeTableOfInteger_i::RemoveValue(CORBA::Long theRow, CORBA::Long theColumn)
00359   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00360 {
00361   SALOMEDS::Locker lock;
00362   Unexpect aCatch(ATI_IncorrectIndex);
00363   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00364   if (theRow    < 1 || theRow    > aTable->GetNbRows())    throw SALOMEDS::AttributeTable::IncorrectIndex();
00365   if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00366 
00367   try {
00368     aTable->RemoveValue(theRow, theColumn);
00369   }
00370   catch(...) {
00371     throw SALOMEDS::AttributeTable::IncorrectIndex();
00372   }
00373 }
00374 
00375 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowSetIndices(CORBA::Long theRow) 
00376 {
00377   SALOMEDS::Locker lock;
00378   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00379 
00380   if(theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00381 
00382   SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
00383   std::vector<int> aSeq = aTable->GetSetRowIndices(theRow);
00384   CorbaSeq->length(aSeq.size());
00385   for (int i = 0; i < aSeq.size(); i++) {
00386     CorbaSeq[i] = aSeq[i];
00387   }
00388   return CorbaSeq._retn(); 
00389 }
00390 
00391 void SALOMEDS_AttributeTableOfInteger_i::SetNbColumns(CORBA::Long theNbColumns)
00392 {
00393   SALOMEDS::Locker lock;
00394   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00395   aTable->SetNbColumns(theNbColumns);
00396 }
00397 
00398 bool SALOMEDS_AttributeTableOfInteger_i::ReadFromFile(const SALOMEDS::TMPFile& theStream) 
00399 {
00400   SALOMEDS::Locker lock;
00401   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00402 
00403   std::string aStream((char*)&theStream[0], theStream.length());
00404   aTable->Load(aStream);
00405   return true;
00406 }
00407 
00408 SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfInteger_i::SaveToFile()
00409 {
00410   SALOMEDS::Locker lock;
00411   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00412 
00413   std::string aString = aTable->Save();
00414 
00415   char* aBuffer = (char*)CORBA::string_dup(aString.c_str());
00416   int aBufferSize = strlen((char*)aBuffer);
00417 
00418   CORBA::Octet* anOctetBuf =  (CORBA::Octet*)aBuffer;
00419 
00420   SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
00421 
00422   return aStreamFile._retn();
00423 }
00424 
00425 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::SortRow(CORBA::Long theRow,
00426                                                                SALOMEDS::AttributeTable::SortOrder sortOrder, 
00427                                                                SALOMEDS::AttributeTable::SortPolicy sortPolicy)
00428   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00429 {
00430   SALOMEDS::Locker lock;
00431   Unexpect aCatch(ATI_IncorrectIndex);
00432   CheckLocked();
00433   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00434   if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00435 
00436   std::vector<int> aSeq;
00437   SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
00438   try {
00439     aSeq = aTable->SortRow(theRow, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder, 
00440                            (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
00441   }
00442   catch(...) {
00443     throw SALOMEDS::AttributeTable::IncorrectIndex();
00444   }
00445   CorbaSeq->length(aSeq.size());
00446   for (int i = 0; i < aSeq.size(); i++) {
00447     CorbaSeq[i] = aSeq[i];
00448   }
00449   return CorbaSeq._retn(); 
00450 }
00451 
00452 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::SortColumn(CORBA::Long theColumn, 
00453                                                                   SALOMEDS::AttributeTable::SortOrder sortOrder,
00454                                                                   SALOMEDS::AttributeTable::SortPolicy sortPolicy)
00455   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00456 {
00457   SALOMEDS::Locker lock;
00458   Unexpect aCatch(ATI_IncorrectIndex);
00459   CheckLocked();
00460   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00461   if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00462 
00463   std::vector<int> aSeq;
00464   SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
00465   try {
00466     aSeq = aTable->SortColumn(theColumn, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder, 
00467                               (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
00468   }
00469   catch(...) {
00470     throw SALOMEDS::AttributeTable::IncorrectIndex();
00471   }
00472   CorbaSeq->length(aSeq.size());
00473   for (int i = 0; i < aSeq.size(); i++) {
00474     CorbaSeq[i] = aSeq[i];
00475   }
00476   return CorbaSeq._retn(); 
00477 }
00478 
00479 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::SortByRow(CORBA::Long theRow,
00480                                                                  SALOMEDS::AttributeTable::SortOrder sortOrder, 
00481                                                                  SALOMEDS::AttributeTable::SortPolicy sortPolicy)
00482   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00483 {
00484   SALOMEDS::Locker lock;
00485   Unexpect aCatch(ATI_IncorrectIndex);
00486   CheckLocked();
00487   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00488   if (theRow < 1 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00489 
00490   std::vector<int> aSeq;
00491   SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
00492   try {
00493     aSeq = aTable->SortByRow(theRow, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder, 
00494                              (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
00495   }
00496   catch(...) {
00497     throw SALOMEDS::AttributeTable::IncorrectIndex();
00498   }
00499   CorbaSeq->length(aSeq.size());
00500   for (int i = 0; i < aSeq.size(); i++) {
00501     CorbaSeq[i] = aSeq[i];
00502   }
00503   return CorbaSeq._retn(); 
00504 }
00505 
00506 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::SortByColumn(CORBA::Long theColumn,
00507                                                                     SALOMEDS::AttributeTable::SortOrder sortOrder, 
00508                                                                     SALOMEDS::AttributeTable::SortPolicy sortPolicy)
00509   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00510 {
00511   SALOMEDS::Locker lock;
00512   Unexpect aCatch(ATI_IncorrectIndex);
00513   CheckLocked();
00514   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00515   if (theColumn < 1 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00516 
00517   std::vector<int> aSeq;
00518   SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
00519   try {
00520     aSeq = aTable->SortByColumn(theColumn, (SALOMEDSImpl_AttributeTable::SortOrder)sortOrder, 
00521                                 (SALOMEDSImpl_AttributeTable::SortPolicy)sortPolicy);
00522   }
00523   catch(...) {
00524     throw SALOMEDS::AttributeTable::IncorrectIndex();
00525   }
00526   CorbaSeq->length(aSeq.size());
00527   for (int i = 0; i < aSeq.size(); i++) {
00528     CorbaSeq[i] = aSeq[i];
00529   }
00530   return CorbaSeq._retn(); 
00531 }
00532 
00533 void SALOMEDS_AttributeTableOfInteger_i::SwapCells(CORBA::Long theRow1, CORBA::Long theColumn1,
00534                                              CORBA::Long theRow2, CORBA::Long theColumn2)
00535   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00536 {
00537   SALOMEDS::Locker lock;
00538   Unexpect aCatch(ATI_IncorrectIndex);
00539   CheckLocked();
00540   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00541   if (theRow1    < 1 || theRow1    > aTable->GetNbRows())    throw SALOMEDS::AttributeTable::IncorrectIndex();
00542   if (theColumn1 < 1 || theColumn1 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00543   if (theRow2    < 1 || theRow2    > aTable->GetNbRows())    throw SALOMEDS::AttributeTable::IncorrectIndex();
00544   if (theColumn2 < 1 || theColumn2 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00545 
00546   try {
00547     aTable->SwapCells(theRow1, theColumn1, theRow2, theColumn2);
00548   }
00549   catch(...) {
00550     throw SALOMEDS::AttributeTable::IncorrectIndex();
00551   }
00552 }
00553 
00554 void SALOMEDS_AttributeTableOfInteger_i::SwapRows(CORBA::Long theRow1, CORBA::Long theRow2)
00555   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00556 {
00557   SALOMEDS::Locker lock;
00558   Unexpect aCatch(ATI_IncorrectIndex);
00559   CheckLocked();
00560   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00561   if (theRow1 < 1 || theRow1 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00562   if (theRow2 < 1 || theRow2 > aTable->GetNbRows()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00563 
00564   try {
00565     aTable->SwapRows(theRow1, theRow2);
00566   }
00567   catch(...) {
00568     throw SALOMEDS::AttributeTable::IncorrectIndex();
00569   }
00570 }
00571 
00572 void SALOMEDS_AttributeTableOfInteger_i::SwapColumns(CORBA::Long theColumn1, CORBA::Long theColumn2)
00573   throw (SALOMEDS::AttributeTable::IncorrectIndex)
00574 {
00575   SALOMEDS::Locker lock;
00576   Unexpect aCatch(ATI_IncorrectIndex);
00577   CheckLocked();
00578   SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
00579   if (theColumn1 < 1 || theColumn1 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00580   if (theColumn2 < 1 || theColumn2 > aTable->GetNbColumns()) throw SALOMEDS::AttributeTable::IncorrectIndex();
00581 
00582   try {
00583     aTable->SwapColumns(theColumn1, theColumn2);
00584   }
00585   catch(...) {
00586     throw SALOMEDS::AttributeTable::IncorrectIndex();
00587   }
00588 }