Salome HOME
First publish of HEXABLOCKcomponant
[modules/hexablock.git] / src / HEXABLOCK_I / HexPropagation_impl.cxx
1 using namespace std;
2 #include "HEXABLOCK.hxx"
3 #include "utilities.h"
4
5 #include <string>
6
7
8 #include "hexa_base.hxx"
9 #include "HexPropagation_impl.hxx"
10 #include "HexEdge_impl.hxx"
11 #include "HexLaw_impl.hxx"
12
13 Propagation_impl::Propagation_impl( HEXA_NS::Propagation *ptrCpp ):_propagation_cpp(ptrCpp)
14 {
15 }
16
17
18
19 HEXA_NS::Propagation* Propagation_impl::GetImpl() throw (SALOME::SALOME_Exception)
20 {
21   return _propagation_cpp;
22 }
23
24
25 HEXABLOCK_ORB::Edges* Propagation_impl::getEdges() throw (SALOME::SALOME_Exception)
26 {
27   HEXABLOCK_ORB::Edges* result = new HEXABLOCK_ORB::Edges;
28
29   const HEXA_NS::Edges& edges_cpp = _propagation_cpp->getEdges();
30 //   HEXA_NS::Edges edges_cpp = _propagation_cpp->getEdges();
31   std::cout<<"XX edges_cpp.size() ->"<<edges_cpp.size()<<std::endl;
32
33   CORBA::ULong i = 0;
34   result->length( edges_cpp.size() );
35 //   HEXA_NS::Edges::const_iterator itertest = edges_cpp.begin();
36 //   itertest != edges_cpp.end();
37   for ( HEXA_NS::Edges::const_iterator iter = edges_cpp.begin();
38         iter != edges_cpp.end();
39         ++iter){
40 //       printf ("     (");
41 //       (*iter)->getVertex (0)->printName (", ");
42 //       (*iter)->getVertex (1)->printName (")\n");
43       Edge_impl *servantEdge = new Edge_impl( *iter );
44       (*result)[ i++ ] = servantEdge->_this();
45
46   }
47   return result;
48 }
49
50
51 // HEXABLOCK_ORB::Ways* Propagation_impl::getWays() throw (SALOME::SALOME_Exception)
52 // {
53 //   HEXABLOCK_ORB::Ways* result = new HEXABLOCK_ORB::Ways;
54 //   const vector<bool>& ways_cpp = _propagation_cpp->getWays();
55 // 
56 //   CORBA::ULong i = 0;
57 //   result->length( ways_cpp.size() );
58 //   for ( vector<bool>::const_iterator iter = ways_cpp.begin();
59 //      iter != ways_cpp.end(); ++iter ){
60 //     (*result)[ i++ ] = *iter;
61 // //     if (*iter == true ) {
62 // //       (*result)[ i++ ] = ::CORBA::TRUE;
63 // //     } else {
64 // //       (*result)[ i++ ] = ::CORBA::FALSE;
65 // //     }
66 //   }
67 //   return result;
68 // 
69 // }
70
71 void Propagation_impl::setLaw(HEXABLOCK_ORB::Law_ptr lawIn) throw (SALOME::SALOME_Exception)
72 {
73   Law_impl* lawInServant = ::DownCast<Law_impl*>( lawIn );
74   ASSERT( lawInServant );
75
76   if ( lawInServant ){
77     HEXA_NS::Law* law = lawInServant->GetImpl();
78     _propagation_cpp->setLaw(law);
79   }
80 }
81
82 HEXABLOCK_ORB::Law_ptr Propagation_impl::getLaw() throw (SALOME::SALOME_Exception)
83 {
84     Law_ptr result = Law::_nil();
85     HEXA_NS::Law* l = _propagation_cpp->getLaw();
86
87     if ( l != NULL ){
88       Law_impl* servantCorba = new Law_impl(l);
89       result = servantCorba->_this();
90     }
91     return result;
92 }
93
94
95
96 void Propagation_impl::setWay(::CORBA::Boolean w) throw (SALOME::SALOME_Exception)
97 {
98   _propagation_cpp->setWay(w);
99 }
100
101
102
103 ::CORBA::Boolean Propagation_impl::getWay() throw (SALOME::SALOME_Exception)
104 {
105 //   bool way = _propagation_cpp->getWay();
106 //   if ( way == true ) {
107 //     return CORBA::TRUE;
108 //   else {
109 //     return CORBA::FALSE;
110 //   }
111   return _propagation_cpp->getWay();
112 }
113