Salome HOME
DCQ : Merge with Ecole_Ete_a6.
[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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
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" );
47   myBaseImpl = 0;
48   thePOA->activate_object( this );
49 };
50
51 //=============================================================================
52 /*!
53  *  SMESH_Hypothesis_i::~SMESH_Hypothesis_i
54  *
55  *  Destructor
56  */
57 //=============================================================================
58
59 SMESH_Hypothesis_i::~SMESH_Hypothesis_i()
60 {
61   MESSAGE( "SMESH_Hypothesis_i::~SMESH_Hypothesis_i" );
62   if ( myBaseImpl )
63     delete myBaseImpl;
64 };
65
66 //=============================================================================
67 /*!
68  *  SMESH_Hypothesis_i::GetName
69  *
70  *  Get type name of hypothesis
71  */
72 //=============================================================================
73
74 char* SMESH_Hypothesis_i::GetName()
75 {
76   MESSAGE( "SMESH_Hypothesis_i::GetName" );
77   return CORBA::string_dup( myBaseImpl->GetName() );
78 };
79
80 //=============================================================================
81 /*!
82  *  SMESH_Hypothesis_i::GetLibName
83  *
84  *  Get plugin library name of hypothesis (required by persistency mechanism)
85  */
86 //=============================================================================
87
88 char* SMESH_Hypothesis_i::GetLibName()
89 {
90   MESSAGE( "SMESH_Hypothesis_i::GetLibName" );
91   return CORBA::string_dup( myBaseImpl->GetLibName() );
92 };
93
94 //=============================================================================
95 /*!
96  *  SMESH_Hypothesis_i::SetLibName
97  *
98  *  Set plugin library name of hypothesis (required by persistency mechanism)
99  */
100 //=============================================================================
101
102 void SMESH_Hypothesis_i::SetLibName(const char* theLibName)
103 {
104   MESSAGE( "SMESH_Hypothesis_i::SetLibName" );
105   myBaseImpl->SetLibName( theLibName );
106 };
107
108 //=============================================================================
109 /*!
110  *  SMESH_Hypothesis_i::GetId
111  *
112  *  Get unique id of hypothesis
113  */
114 //=============================================================================
115
116 CORBA::Long SMESH_Hypothesis_i::GetId()
117 {
118   MESSAGE( "SMESH_Hypothesis_i::GetId" );
119   return myBaseImpl->GetID();
120 }
121
122 //=============================================================================
123 /*!
124  *  SMESH_Hypothesis_i::GetImpl
125  *
126  *  Get implementation
127  */
128 //=============================================================================
129
130 ::SMESH_Hypothesis* SMESH_Hypothesis_i::GetImpl()
131 {
132   MESSAGE( "SMESH_Hypothesis_i::GetImpl" );
133   return myBaseImpl;
134 }
135
136 //=============================================================================
137 /*!
138  *  SMESH_Hypothesis_i::SaveTo
139  *
140  *  Persistence: Dumps parameters to the string stream
141  */
142 //=============================================================================
143
144 char* SMESH_Hypothesis_i::SaveTo()
145 {
146   MESSAGE( "SMESH_Hypothesis_i::SaveTo" );
147   std::ostringstream os;
148   myBaseImpl->SaveTo( os );
149   return CORBA::string_dup( os.str().c_str() );
150 }
151
152 //=============================================================================
153 /*!
154 *  SMESH_Hypothesis_i::LoadFrom
155 *
156 *  Persistence: Restores parameters from string
157 */
158 //=============================================================================
159
160 void SMESH_Hypothesis_i::LoadFrom( const char* theStream )
161 {
162   MESSAGE( "SMESH_Hypothesis_i::LoadFrom" );
163   std::istringstream is( theStream );
164   myBaseImpl->LoadFrom( is );
165 }