Salome HOME
Merge from 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 #include <iostream>
30 #include <sstream>
31 #include "SMESH_Hypothesis_i.hxx"
32 #include "utilities.h"
33
34 using namespace std;
35
36 //=============================================================================
37 /*!
38  *  SMESH_Hypothesis_i::SMESH_Hypothesis_i
39  * 
40  *  Constructor
41  */
42 //=============================================================================
43
44 SMESH_Hypothesis_i::SMESH_Hypothesis_i( PortableServer::POA_ptr thePOA )
45      : SALOME::GenericObj_i( thePOA )
46 {
47   MESSAGE( "SMESH_Hypothesis_i::SMESH_Hypothesis_i / Début" );
48   myBaseImpl = 0;
49   // _CS_gbo This instruction fails
50   // thePOA->activate_object( this );
51   // _CS_gbo I keep the POA reference to activate the object in the future.
52   myPOA = thePOA;
53   
54   MESSAGE( "SMESH_Hypothesis_i::SMESH_Hypothesis_i / Fin" );
55 };
56
57 //=============================================================================
58 /*!
59  *  SMESH_Hypothesis_i::Activate()
60  *
61  *  Activation of the object
62  */
63 //=============================================================================
64 void SMESH_Hypothesis_i::Activate() {
65   myPOA->activate_object( this );
66 }
67
68 //=============================================================================
69 /*!
70  *  SMESH_Hypothesis_i::~SMESH_Hypothesis_i
71  *
72  *  Destructor
73  */
74 //=============================================================================
75
76 SMESH_Hypothesis_i::~SMESH_Hypothesis_i()
77 {
78   MESSAGE( "SMESH_Hypothesis_i::~SMESH_Hypothesis_i" );
79   if ( myBaseImpl )
80     delete myBaseImpl;
81 };
82
83 //=============================================================================
84 /*!
85  *  SMESH_Hypothesis_i::GetName
86  *
87  *  Get type name of hypothesis
88  */
89 //=============================================================================
90
91 char* SMESH_Hypothesis_i::GetName()
92 {
93   //MESSAGE( "SMESH_Hypothesis_i::GetName" );
94   return CORBA::string_dup( myBaseImpl->GetName() );
95 };
96
97 //=============================================================================
98 /*!
99  *  SMESH_Hypothesis_i::GetLibName
100  *
101  *  Get plugin library name of hypothesis (required by persistency mechanism)
102  */
103 //=============================================================================
104
105 char* SMESH_Hypothesis_i::GetLibName()
106 {
107   MESSAGE( "SMESH_Hypothesis_i::GetLibName" );
108   return CORBA::string_dup( myBaseImpl->GetLibName() );
109 };
110
111 //=============================================================================
112 /*!
113  *  SMESH_Hypothesis_i::SetLibName
114  *
115  *  Set plugin library name of hypothesis (required by persistency mechanism)
116  */
117 //=============================================================================
118
119 void SMESH_Hypothesis_i::SetLibName(const char* theLibName)
120 {
121   MESSAGE( "SMESH_Hypothesis_i::SetLibName" );
122   myBaseImpl->SetLibName( theLibName );
123 };
124
125 //=============================================================================
126 /*!
127  *  SMESH_Hypothesis_i::GetId
128  *
129  *  Get unique id of hypothesis
130  */
131 //=============================================================================
132
133 CORBA::Long SMESH_Hypothesis_i::GetId()
134 {
135   MESSAGE( "SMESH_Hypothesis_i::GetId" );
136   return myBaseImpl->GetID();
137 }
138
139 //=============================================================================
140 /*!
141  *  SMESH_Hypothesis_i::GetImpl
142  *
143  *  Get implementation
144  */
145 //=============================================================================
146
147 ::SMESH_Hypothesis* SMESH_Hypothesis_i::GetImpl()
148 {
149   MESSAGE( "SMESH_Hypothesis_i::GetImpl" );
150   return myBaseImpl;
151 }
152
153 //=============================================================================
154 /*!
155  *  SMESH_Hypothesis_i::SaveTo
156  *
157  *  Persistence: Dumps parameters to the string stream
158  */
159 //=============================================================================
160
161 char* SMESH_Hypothesis_i::SaveTo()
162 {
163   MESSAGE( "SMESH_Hypothesis_i::SaveTo" );
164   std::ostringstream os;
165   myBaseImpl->SaveTo( os );
166   return CORBA::string_dup( os.str().c_str() );
167 }
168
169 //=============================================================================
170 /*!
171 *  SMESH_Hypothesis_i::LoadFrom
172 *
173 *  Persistence: Restores parameters from string
174 */
175 //=============================================================================
176
177 void SMESH_Hypothesis_i::LoadFrom( const char* theStream )
178 {
179   MESSAGE( "SMESH_Hypothesis_i::LoadFrom" );
180   std::istringstream is( theStream );
181   myBaseImpl->LoadFrom( is );
182 }