1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
24 // File : StdMeshers_Reversible1D_i.cxx
27 #include "StdMeshers_Reversible1D_i.hxx"
28 #include "SMESH_PythonDump.hxx"
30 #include <Utils_CorbaException.hxx>
31 #include <utilities.h>
33 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
35 //================================================================================
39 //================================================================================
41 StdMeshers_Reversible1D_i::StdMeshers_Reversible1D_i( SMESH_Hypothesis_i* reversible )
46 //=============================================================================
48 * StdMeshers_Reversible1D_i::SetReversedEdges
50 * Set edges to reverse
52 //=============================================================================
54 void StdMeshers_Reversible1D_i::SetReversedEdges( const SMESH::long_array& theIds )
57 std::vector<int> ids( theIds.length() );
58 CORBA::Long iEnd = theIds.length();
59 for ( CORBA::Long i = 0; i < iEnd; i++ )
60 ids[ i ] = theIds[ i ];
62 this->GetImpl()->SetReversedEdges( ids );
64 catch ( SALOME_Exception& S_ex ) {
65 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
68 // Update Python script
69 SMESH::TPythonDump() << myHyp->_this() << ".SetReversedEdges( " << theIds << " )";
72 //=============================================================================
74 * StdMeshers_Reversible1D_i::SetObjectEntry
76 * Set the Entry for the Main Object
78 //=============================================================================
80 void StdMeshers_Reversible1D_i::SetObjectEntry( const char* theEntry )
82 string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping
84 this->GetImpl()->SetObjectEntry( entry.c_str() );
85 // Update Python script
86 SMESH::TPythonDump() << myHyp->_this() << ".SetObjectEntry( \"" << entry.c_str() << "\" )";
88 catch ( SALOME_Exception& S_ex ) {
89 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),SALOME::BAD_PARAM );
93 //=============================================================================
95 * StdMeshers_Reversible1D_i::GetObjectEntry
97 * Set the Entry for the Main Object
99 //=============================================================================
101 char* StdMeshers_Reversible1D_i::GetObjectEntry()
105 entry = this->GetImpl()->GetObjectEntry();
107 catch ( SALOME_Exception& S_ex ) {
108 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
110 return CORBA::string_dup( entry );
113 //=============================================================================
115 * StdMeshers_Reversible1D_i::GetReversedEdges
119 //=============================================================================
121 SMESH::long_array* StdMeshers_Reversible1D_i::GetReversedEdges()
123 SMESH::long_array_var anArray = new SMESH::long_array;
124 std::vector<int> ids = this->GetImpl()->GetReversedEdges();
125 anArray->length( ids.size() );
126 for ( CORBA::Long i = 0; i < ids.size(); i++)
127 anArray [ i ] = ids [ i ];
129 return anArray._retn();
132 //=============================================================================
134 * StdMeshers_Reversible1D_i::GetImpl
138 //=============================================================================
140 ::StdMeshers_Reversible1D* StdMeshers_Reversible1D_i::GetImpl()
142 return ( ::StdMeshers_Reversible1D* )myHyp->GetImpl();