Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/smesh.git] / src / SMESH_I / SMESH_Hypothesis_i.cxx
1 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : SMESH_Hypothesis_i.cxx
25 //  Author : Paul RASCLE, EDF
26 //  Module : SMESH
27 //  $Header$
28
29 using namespace std;
30 #include <iostream>
31 #include <sstream>
32 #include "SMESH_Hypothesis_i.hxx"
33 #include "utilities.h"
34
35 //=============================================================================
36 /*!
37  *  SMESH_Hypothesis_i::SMESH_Hypothesis_i
38  * 
39  *  Constructor
40  */
41 //=============================================================================
42
43 SMESH_Hypothesis_i::SMESH_Hypothesis_i( PortableServer::POA_ptr thePOA )
44      : SALOME::GenericObj_i( thePOA )
45 {
46   MESSAGE( "SMESH_Hypothesis_i::SMESH_Hypothesis_i / Début" );
47   myBaseImpl = 0;
48   // _CS_gbo This instruction fails
49   // thePOA->activate_object( this );
50   // _CS_gbo I keep the POA reference to activate the object in the future.
51   myPOA = thePOA;
52   
53   MESSAGE( "SMESH_Hypothesis_i::SMESH_Hypothesis_i / Fin" );
54 };
55
56 //=============================================================================
57 /*!
58  *  SMESH_Hypothesis_i::Activate()
59  *
60  *  Activation of the object
61  */
62 //=============================================================================
63 void SMESH_Hypothesis_i::Activate() {
64   myPOA->activate_object( this );
65 }
66
67 //=============================================================================
68 /*!
69  *  SMESH_Hypothesis_i::~SMESH_Hypothesis_i
70  *
71  *  Destructor
72  */
73 //=============================================================================
74
75 SMESH_Hypothesis_i::~SMESH_Hypothesis_i()
76 {
77   MESSAGE( "SMESH_Hypothesis_i::~SMESH_Hypothesis_i" );
78   if ( myBaseImpl )
79     delete myBaseImpl;
80 };
81
82 //=============================================================================
83 /*!
84  *  SMESH_Hypothesis_i::GetName
85  *
86  *  Get type name of hypothesis
87  */
88 //=============================================================================
89
90 char* SMESH_Hypothesis_i::GetName()
91 {
92   //MESSAGE( "SMESH_Hypothesis_i::GetName" );
93   return CORBA::string_dup( myBaseImpl->GetName() );
94 };
95
96 //=============================================================================
97 /*!
98  *  SMESH_Hypothesis_i::GetLibName
99  *
100  *  Get plugin library name of hypothesis (required by persistency mechanism)
101  */
102 //=============================================================================
103
104 char* SMESH_Hypothesis_i::GetLibName()
105 {
106   MESSAGE( "SMESH_Hypothesis_i::GetLibName" );
107   return CORBA::string_dup( myBaseImpl->GetLibName() );
108 };
109
110 //=============================================================================
111 /*!
112  *  SMESH_Hypothesis_i::SetLibName
113  *
114  *  Set plugin library name of hypothesis (required by persistency mechanism)
115  */
116 //=============================================================================
117
118 void SMESH_Hypothesis_i::SetLibName(const char* theLibName)
119 {
120   MESSAGE( "SMESH_Hypothesis_i::SetLibName" );
121   myBaseImpl->SetLibName( theLibName );
122 };
123
124 //=============================================================================
125 /*!
126  *  SMESH_Hypothesis_i::GetId
127  *
128  *  Get unique id of hypothesis
129  */
130 //=============================================================================
131
132 CORBA::Long SMESH_Hypothesis_i::GetId()
133 {
134   MESSAGE( "SMESH_Hypothesis_i::GetId" );
135   return myBaseImpl->GetID();
136 }
137
138 //=============================================================================
139 /*!
140  *  SMESH_Hypothesis_i::GetImpl
141  *
142  *  Get implementation
143  */
144 //=============================================================================
145
146 ::SMESH_Hypothesis* SMESH_Hypothesis_i::GetImpl()
147 {
148   MESSAGE( "SMESH_Hypothesis_i::GetImpl" );
149   return myBaseImpl;
150 }
151
152 //=============================================================================
153 /*!
154  *  SMESH_Hypothesis_i::SaveTo
155  *
156  *  Persistence: Dumps parameters to the string stream
157  */
158 //=============================================================================
159
160 char* SMESH_Hypothesis_i::SaveTo()
161 {
162   MESSAGE( "SMESH_Hypothesis_i::SaveTo" );
163   std::ostringstream os;
164   myBaseImpl->SaveTo( os );
165   return CORBA::string_dup( os.str().c_str() );
166 }
167
168 //=============================================================================
169 /*!
170 *  SMESH_Hypothesis_i::LoadFrom
171 *
172 *  Persistence: Restores parameters from string
173 */
174 //=============================================================================
175
176 void SMESH_Hypothesis_i::LoadFrom( const char* theStream )
177 {
178   MESSAGE( "SMESH_Hypothesis_i::LoadFrom" );
179   std::istringstream is( theStream );
180   myBaseImpl->LoadFrom( is );
181 }