X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSALOMEDS%2FSALOMEDS_AttributeTableOfString.cxx;h=a0a291d8f9ab21d9d5a7a802b2d79befe3397d48;hb=40ed082c24dc424f9502c7c31051d42c03ecfc69;hp=de544941aacae90f0fc6ffda20acfc1113c063a3;hpb=e6bfea36374791cd31c274a2f97df90dc60ddaf3;p=modules%2Fyacs.git diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx index de544941a..a0a291d8f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx @@ -1,38 +1,36 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SALOMEDS_AttributeTableOfString.cxx // Author : Sergey RUIN // Module : SALOME - +// #include "SALOMEDS_AttributeTableOfString.hxx" #include "SALOMEDS.hxx" #include -#include -#include -#include -#include -#include - + SALOMEDS_AttributeTableOfString::SALOMEDS_AttributeTableOfString - (const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr) + (SALOMEDSImpl_AttributeTableOfString* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -50,7 +48,7 @@ void SALOMEDS_AttributeTableOfString::SetTitle(const std::string& theTitle) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetTitle(theTitle); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetTitle(theTitle.c_str()); } @@ -60,8 +58,7 @@ std::string SALOMEDS_AttributeTableOfString::GetTitle() std::string aStr; if (_isLocal) { SALOMEDS::Locker lock; - aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->GetTitle()).ToCString(); + aStr = dynamic_cast(_local_impl)->GetTitle(); } else aStr = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetTitle(); return aStr; @@ -72,26 +69,41 @@ void SALOMEDS_AttributeTableOfString::SetRowTitle(int theIndex, const std::strin if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->SetRowTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetRowTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str()); } +std::string SALOMEDS_AttributeTableOfString::GetRowTitle(int theIndex) +{ + std::string aTitle; + if (_isLocal) { + SALOMEDS::Locker lock; + try { + aTitle = dynamic_cast(_local_impl)->GetRowTitle(theIndex); + } + catch(...) { + throw SALOMEDS::AttributeTable::IncorrectIndex(); + } + } + else { + aTitle = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowTitle(theIndex); + } + return aTitle; +} + void SALOMEDS_AttributeTableOfString::SetRowTitles(const std::vector& theTitles) { int aLength = theTitles.size(), i; if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowTitles(aSeq); + dynamic_cast(_local_impl)->SetRowTitles(theTitles); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); aSeq->length(aLength); - for (i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str(); + for (i = 0; i < aLength; i++) aSeq[i] = theTitles[i].c_str(); SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitles(aSeq); } } @@ -102,10 +114,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetRowTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq; - aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowTitles(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetRowTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowTitles(); @@ -120,26 +129,41 @@ void SALOMEDS_AttributeTableOfString::SetColumnTitle(int theIndex, const std::st if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->SetColumnTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetColumnTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str()); } +std::string SALOMEDS_AttributeTableOfString::GetColumnTitle(int theIndex) +{ + std::string aTitle; + if (_isLocal) { + SALOMEDS::Locker lock; + try { + aTitle = dynamic_cast(_local_impl)->GetColumnTitle(theIndex); + } + catch(...) { + throw SALOMEDS::AttributeTable::IncorrectIndex(); + } + } + else { + aTitle = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumnTitle(theIndex); + } + return aTitle; +} + void SALOMEDS_AttributeTableOfString::SetColumnTitles(const std::vector& theTitles) { int aLength = theTitles.size(), i; if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetColumnTitles(aSeq); + dynamic_cast(_local_impl)->SetColumnTitles(theTitles); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); aSeq->length(aLength); - for (i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str(); + for (i = 0; i < aLength; i++) aSeq[i] = theTitles[i].c_str(); SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitles(aSeq); } } @@ -150,10 +174,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetColumnTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq; - aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetColumnTitles(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetColumnTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumnTitles(); @@ -168,26 +189,41 @@ void SALOMEDS_AttributeTableOfString::SetRowUnit(int theIndex, const std::string if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->SetRowUnit(theIndex, (char*)theUnit.c_str()); + dynamic_cast(_local_impl)->SetRowUnit(theIndex, theUnit); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str()); } +std::string SALOMEDS_AttributeTableOfString::GetRowUnit(int theIndex) +{ + std::string aTitle; + if (_isLocal) { + SALOMEDS::Locker lock; + try { + aTitle = dynamic_cast(_local_impl)->GetRowUnit(theIndex); + } + catch(...) { + throw SALOMEDS::AttributeTable::IncorrectIndex(); + } + } + else { + aTitle = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowUnit(theIndex); + } + return aTitle; +} + void SALOMEDS_AttributeTableOfString::SetRowUnits(const std::vector& theUnits) { int aLength = theUnits.size(), i; if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; - for (i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowUnits(aSeq); + dynamic_cast(_local_impl)->SetRowUnits(theUnits); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); aSeq->length(aLength); - for (i = 0; i < aLength; i++) aSeq[i] = (char*)theUnits[i].c_str(); + for (i = 0; i < aLength; i++) aSeq[i] = theUnits[i].c_str(); SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnits(aSeq); } } @@ -198,10 +234,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetRowUnits() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aSeq; - aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowUnits(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetRowUnits(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowUnits(); @@ -216,7 +249,7 @@ int SALOMEDS_AttributeTableOfString::GetNbRows() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbRows(); + aNb = dynamic_cast(_local_impl)->GetNbRows(); } else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbRows(); return aNb; @@ -227,7 +260,7 @@ int SALOMEDS_AttributeTableOfString::GetNbColumns() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbColumns(); + aNb = dynamic_cast(_local_impl)->GetNbColumns(); } else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbColumns(); return aNb; @@ -239,21 +272,18 @@ void SALOMEDS_AttributeTableOfString::AddRow(const std::vector& the if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable; - aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl); - Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString; - for (int i = 0; i < aLength; i++) aRow->Append((char*)theData[i].c_str()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(aTable->GetNbRows() + 1, aRow); + aTable->SetRowData(aTable->GetNbRows() + 1, theData); } catch(...) { - throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); + throw SALOMEDS::AttributeTable::IncorrectArgumentLength(); } } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); aSeq->length(aLength); - for (i = 0; i < aLength; i++) aSeq[i] = (char*)theData[i].c_str(); + for (i = 0; i < aLength; i++) aSeq[i] = theData[i].c_str(); SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->AddRow(aSeq); } } @@ -264,21 +294,18 @@ void SALOMEDS_AttributeTableOfString::SetRow(int theRow, const std::vectorAppend((char*)theData[i].c_str()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(theRow, aRow); + aTable->SetRowData(theRow, theData); } catch(...) { - throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); + throw SALOMEDS::AttributeTable::IncorrectArgumentLength(); } } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); aSeq->length(aLength); - for (i = 0; i < aLength; i++) aSeq[i] = (char*)theData[i].c_str(); + for (i = 0; i < aLength; i++) aSeq[i] = theData[i].c_str(); SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRow(theRow, aSeq); } } @@ -289,13 +316,11 @@ std::vector SALOMEDS_AttributeTableOfString::GetRow(int theRow) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aRow; - aRow = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowData(theRow); - aLength = aRow->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aRow->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetRowData(theRow); } else { SALOMEDS::StringSeq_var aRow = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRow(theRow); + aLength = aRow->length(); for (i = 0; i < aLength; i++) aVector.push_back((char*)aRow[i].in()); } @@ -308,21 +333,18 @@ void SALOMEDS_AttributeTableOfString::AddColumn(const std::vector& if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable; - aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl); - Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString; - for (int i = 0; i < aLength; i++) aColumn->Append((char*)theData[i].c_str()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_local_impl); try { - aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); + aTable->SetColumnData(aTable->GetNbColumns() + 1, theData); } catch(...) { - throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); + throw SALOMEDS::AttributeTable::IncorrectArgumentLength(); } } else { SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq(); aColumn->length(aLength); - for (i = 0; i < aLength; i++) aColumn[i] = (char*)theData[i].c_str(); + for (i = 0; i < aLength; i++) aColumn[i] = theData[i].c_str(); SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->AddColumn(aColumn); } } @@ -333,22 +355,19 @@ void SALOMEDS_AttributeTableOfString::SetColumn(int theColumn, const std::vector if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable; - aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl); - Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString; - for (int i = 0; i < aLength; i++) aColumn->Append((char*)theData[i].c_str()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(theColumn, aColumn); + aTable->SetColumnData(theColumn, theData); } catch(...) { - throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); + throw SALOMEDS::AttributeTable::IncorrectArgumentLength(); } } else { SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq(); aColumn->length(aLength); - for (i = 0; i < aLength; i++) aColumn[i] = (char*)theData[i].c_str(); - SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRow(theColumn, aColumn); + for (i = 0; i < aLength; i++) aColumn[i] = theData[i].c_str(); + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumn(theColumn, aColumn); } } @@ -358,16 +377,12 @@ std::vector SALOMEDS_AttributeTableOfString::GetColumn(int theColum int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfExtendedString) aColumn; - aColumn = Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->GetColumnData(theColumn); - aLength = aColumn->Length(); - for (i = 1; i <= aLength; i++) - aVector.push_back(TCollection_AsciiString(aColumn->Value(i)).ToCString()); + aVector = dynamic_cast(_local_impl)->GetColumnData(theColumn); } else { SALOMEDS::StringSeq_var aColumn = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumn(theColumn); + aLength = aColumn->length(); for (i = 0; i < aLength; i++) aVector.push_back(aColumn[i].in()); } return aVector; @@ -379,11 +394,10 @@ void SALOMEDS_AttributeTableOfString::PutValue(const std::string& theValue, int CheckLocked(); SALOMEDS::Locker lock; try { - Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->PutValue((char*)theValue.c_str(), theRow, theColumn); + dynamic_cast(_local_impl)->PutValue(theValue, theRow, theColumn); } catch(...) { - throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); + throw SALOMEDS::AttributeTable::IncorrectIndex(); } } else { @@ -396,7 +410,7 @@ bool SALOMEDS_AttributeTableOfString::HasValue(int theRow, int theColumn) bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->HasValue(theRow, theColumn); + ret = dynamic_cast(_local_impl)->HasValue(theRow, theColumn); } else ret = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->HasValue(theRow, theColumn); return ret; @@ -408,11 +422,10 @@ std::string SALOMEDS_AttributeTableOfString::GetValue(int theRow, int theColumn) if (_isLocal) { SALOMEDS::Locker lock; try { - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->GetValue(theRow, theColumn)).ToCString(); + aValue = dynamic_cast(_local_impl)->GetValue(theRow, theColumn); } catch(...) { - throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); + throw SALOMEDS::AttributeTable::IncorrectIndex(); } } else { @@ -421,20 +434,34 @@ std::string SALOMEDS_AttributeTableOfString::GetValue(int theRow, int theColumn) return aValue; } +void SALOMEDS_AttributeTableOfString::RemoveValue(int theRow, int theColumn) +{ + if (_isLocal) { + SALOMEDS::Locker lock; + try { + dynamic_cast(_local_impl)->RemoveValue(theRow, theColumn); + } + catch(...) { + throw SALOMEDS::AttributeTable::IncorrectIndex(); + } + } + else { + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->RemoveValue(theRow, theColumn); + } +} + std::vector SALOMEDS_AttributeTableOfString::GetRowSetIndices(int theRow) { std::vector aVector; int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfInteger) aSet; - aSet = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetSetRowIndices(theRow); - aLength = aSet->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aSet->Value(i)); + aVector = dynamic_cast(_local_impl)->GetSetRowIndices(theRow); } else { SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowSetIndices(theRow); + aLength = aSet->length(); for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]); } return aVector; @@ -444,7 +471,159 @@ void SALOMEDS_AttributeTableOfString::SetNbColumns(int theNbColumns) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetNbColumns(theNbColumns); + dynamic_cast(_local_impl)->SetNbColumns(theNbColumns); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetNbColumns(theNbColumns); } + +std::vector SALOMEDS_AttributeTableOfString::SortRow(int theRow, SortOrder theOrder, SortPolicy thePolicy) +{ + std::vector aVector; + int aLength, i; + if (_isLocal) { + SALOMEDS::Locker lock; + try { + aVector = dynamic_cast(_local_impl)->SortRow(theRow, + (SALOMEDSImpl_AttributeTable::SortOrder)theOrder, + (SALOMEDSImpl_AttributeTable::SortPolicy)thePolicy); + } + catch(...) { + throw SALOMEDS::AttributeTable::IncorrectIndex(); + } + } + else { + SALOMEDS::LongSeq_var aSet = + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SortRow(theRow, + (SALOMEDS::AttributeTable::SortOrder)theOrder, + (SALOMEDS::AttributeTable::SortPolicy)thePolicy); + aLength = aSet->length(); + for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]); + } + return aVector; +} + +std::vector SALOMEDS_AttributeTableOfString::SortColumn(int theColumn, SortOrder theOrder, SortPolicy thePolicy) +{ + std::vector aVector; + int aLength, i; + if (_isLocal) { + SALOMEDS::Locker lock; + try { + aVector = dynamic_cast(_local_impl)->SortColumn(theColumn, + (SALOMEDSImpl_AttributeTable::SortOrder)theOrder, + (SALOMEDSImpl_AttributeTable::SortPolicy)thePolicy); + } + catch(...) { + throw SALOMEDS::AttributeTable::IncorrectIndex(); + } + } + else { + SALOMEDS::LongSeq_var aSet = + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SortColumn(theColumn, + (SALOMEDS::AttributeTable::SortOrder)theOrder, + (SALOMEDS::AttributeTable::SortPolicy)thePolicy); + aLength = aSet->length(); + for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]); + } + return aVector; +} + +std::vector SALOMEDS_AttributeTableOfString::SortByRow(int theRow, SortOrder theOrder, SortPolicy thePolicy) +{ + std::vector aVector; + int aLength, i; + if (_isLocal) { + SALOMEDS::Locker lock; + try { + aVector = dynamic_cast(_local_impl)->SortByRow(theRow, + (SALOMEDSImpl_AttributeTable::SortOrder)theOrder, + (SALOMEDSImpl_AttributeTable::SortPolicy)thePolicy); + } + catch(...) { + throw SALOMEDS::AttributeTable::IncorrectIndex(); + } + } + else { + SALOMEDS::LongSeq_var aSet = + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SortByRow(theRow, + (SALOMEDS::AttributeTable::SortOrder)theOrder, + (SALOMEDS::AttributeTable::SortPolicy)thePolicy); + aLength = aSet->length(); + for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]); + } + return aVector; +} + +std::vector SALOMEDS_AttributeTableOfString::SortByColumn(int theColumn, SortOrder theOrder, SortPolicy thePolicy) +{ + std::vector aVector; + int aLength, i; + if (_isLocal) { + SALOMEDS::Locker lock; + try { + aVector = dynamic_cast(_local_impl)->SortByColumn(theColumn, + (SALOMEDSImpl_AttributeTable::SortOrder)theOrder, + (SALOMEDSImpl_AttributeTable::SortPolicy)thePolicy); + } + catch(...) { + throw SALOMEDS::AttributeTable::IncorrectIndex(); + } + } + else { + SALOMEDS::LongSeq_var aSet = + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SortByColumn(theColumn, + (SALOMEDS::AttributeTable::SortOrder)theOrder, + (SALOMEDS::AttributeTable::SortPolicy)thePolicy); + aLength = aSet->length(); + for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]); + } + return aVector; +} + +void SALOMEDS_AttributeTableOfString::SwapCells(int theRow1, int theColumn1, int theRow2, int theColumn2) +{ + if (_isLocal) { + SALOMEDS::Locker lock; + try { + dynamic_cast(_local_impl)->SwapCells(theRow1, theColumn1, theRow2, theColumn2); + } + catch(...) { + throw SALOMEDS::AttributeTable::IncorrectIndex(); + } + } + else { + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SwapCells(theRow1, theColumn1, theRow2, theColumn2); + } +} + +void SALOMEDS_AttributeTableOfString::SwapRows(int theRow1, int theRow2) +{ + if (_isLocal) { + SALOMEDS::Locker lock; + try { + dynamic_cast(_local_impl)->SwapRows(theRow1, theRow2); + } + catch(...) { + throw SALOMEDS::AttributeTable::IncorrectIndex(); + } + } + else { + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SwapRows(theRow1, theRow2); + } +} + +void SALOMEDS_AttributeTableOfString::SwapColumns(int theColumn1, int theColumn2) +{ + if (_isLocal) { + SALOMEDS::Locker lock; + try { + dynamic_cast(_local_impl)->SwapColumns(theColumn1, theColumn2); + } + catch(...) { + throw SALOMEDS::AttributeTable::IncorrectIndex(); + } + } + else { + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SwapColumns(theColumn1, theColumn2); + } +}