]> SALOME platform Git repositories - modules/hexablock.git/blob - src/HEXABLOCK_I/HexPropagation_impl.cxx
Salome HOME
Merge from V6_main 01/04/2013
[modules/hexablock.git] / src / HEXABLOCK_I / HexPropagation_impl.cxx
1 // Copyright (C) 2009-2013  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 using namespace std;
20 #include "HEXABLOCK.hxx"
21 #include "utilities.h"
22
23 #include <string>
24
25
26 #include "hexa_base.hxx"
27 #include "HexPropagation_impl.hxx"
28 #include "HexEdge_impl.hxx"
29 #include "HexLaw_impl.hxx"
30
31 Propagation_impl::Propagation_impl( HEXA_NS::Propagation *ptrCpp ):_propagation_cpp(ptrCpp)
32 {
33 }
34
35
36
37 HEXA_NS::Propagation* Propagation_impl::GetImpl() throw (SALOME::SALOME_Exception)
38 {
39   return _propagation_cpp;
40 }
41
42
43 HEXABLOCK_ORB::Edges* Propagation_impl::getEdges() throw (SALOME::SALOME_Exception)
44 {
45   HEXABLOCK_ORB::Edges* result = new HEXABLOCK_ORB::Edges;
46
47   const HEXA_NS::Edges& edges_cpp = _propagation_cpp->getEdges();
48
49   CORBA::ULong i = 0;
50   result->length( edges_cpp.size() );
51   for ( HEXA_NS::Edges::const_iterator iter = edges_cpp.begin();
52         iter != edges_cpp.end();
53         ++iter){
54       Edge_impl *servantEdge = new Edge_impl( *iter );
55       (*result)[ i++ ] = servantEdge->_this();
56
57   }
58   return result;
59 }
60
61
62 void Propagation_impl::setLaw(HEXABLOCK_ORB::Law_ptr lawIn) throw (SALOME::SALOME_Exception)
63 {
64   Law_impl* lawInServant = ::DownCast<Law_impl*>( lawIn );
65   ASSERT( lawInServant );
66
67   if ( lawInServant ){
68     HEXA_NS::Law* law = lawInServant->GetImpl();
69     _propagation_cpp->setLaw(law);
70   }
71 }
72
73 HEXABLOCK_ORB::Law_ptr Propagation_impl::getLaw() throw (SALOME::SALOME_Exception)
74 {
75     Law_ptr result = Law::_nil();
76     HEXA_NS::Law* l = _propagation_cpp->getLaw();
77
78     if ( l != NULL ){
79       Law_impl* servantCorba = new Law_impl(l);
80       result = servantCorba->_this();
81     }
82     return result;
83 }
84
85
86
87 void Propagation_impl::setWay(::CORBA::Boolean w) throw (SALOME::SALOME_Exception)
88 {
89   _propagation_cpp->setWay(w);
90 }
91
92
93
94 ::CORBA::Boolean Propagation_impl::getWay() throw (SALOME::SALOME_Exception)
95 {
96 //   bool way = _propagation_cpp->getWay();
97 //   if ( way == true ) {
98 //     return CORBA::TRUE;
99 //   else {
100 //     return CORBA::FALSE;
101 //   }
102   return _propagation_cpp->getWay();
103 }
104