Salome HOME
b5dcb425ecf5e4399fb0f706efe71b87d7079648
[modules/homard.git] / src / HOMARD_I / HOMARD_YACS_i.cxx
1 // Copyright (C) 2011-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 // Remarques :
20 // L'ordre de description des fonctions est le meme dans tous les fichiers
21 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
22 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
23 // 2. Les caracteristiques
24 // 3. Le lien avec les autres structures
25 //
26 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
27 //
28
29 #include "HOMARD_YACS_i.hxx"
30 #include "HOMARD_Gen_i.hxx"
31 #include "HOMARD_YACS.hxx"
32 #include "HOMARD_DriverTools.hxx"
33
34 #include "SALOMEDS_Tool.hxx"
35
36 #include "utilities.h"
37
38 //=============================================================================
39 /*!
40  *  standard constructor
41  */
42 //=============================================================================
43 HOMARD_YACS_i::HOMARD_YACS_i()
44 {
45   MESSAGE( "Default constructor, not for use" );
46   ASSERT( 0 );
47 }
48 //=============================================================================
49 /*!
50  *  standard constructor
51  */
52 //=============================================================================
53 HOMARD_YACS_i::HOMARD_YACS_i( CORBA::ORB_ptr orb,
54                                         HOMARD::HOMARD_Gen_var engine )
55 {
56   MESSAGE("constructor");
57   _gen_i = engine;
58   _orb = orb;
59   myHomardYACS = new ::HOMARD_YACS();
60   ASSERT( myHomardYACS );
61 }
62 //=============================================================================
63 /*!
64  *  standard destructor
65  */
66 //=============================================================================
67 HOMARD_YACS_i::~HOMARD_YACS_i()
68 {
69 }
70 //=============================================================================
71 //=============================================================================
72 // Generalites
73 //=============================================================================
74 //=============================================================================
75 void HOMARD_YACS_i::SetName( const char* Name )
76 {
77   ASSERT( myHomardYACS );
78   myHomardYACS->SetName( Name );
79 }
80 //=============================================================================
81 char* HOMARD_YACS_i::GetName()
82 {
83   ASSERT( myHomardYACS );
84   return CORBA::string_dup( myHomardYACS->GetName().c_str() );
85 }
86 //=============================================================================
87 CORBA::Long HOMARD_YACS_i::Delete( CORBA::Long Option )
88 {
89   ASSERT( myHomardYACS );
90   char* YACSName = GetName() ;
91   MESSAGE ( "Delete : destruction du schema " << YACSName << ", Option = " << Option );
92   return _gen_i->DeleteYACS(YACSName, Option) ;
93 }
94 //=============================================================================
95 char* HOMARD_YACS_i::GetDumpPython()
96 {
97   ASSERT( myHomardYACS );
98   return CORBA::string_dup( myHomardYACS->GetDumpPython().c_str() );
99 }
100 //=============================================================================
101 std::string HOMARD_YACS_i::Dump() const
102 {
103   return HOMARD::Dump( *myHomardYACS );
104 }
105 //=============================================================================
106 bool HOMARD_YACS_i::Restore( const std::string& stream )
107 {
108   return HOMARD::Restore( *myHomardYACS, stream );
109 }
110 //=============================================================================
111 //=============================================================================
112 // Caracteristiques
113 //=============================================================================
114 //=============================================================================
115 void HOMARD_YACS_i::SetType( CORBA::Long Type )
116 {
117   ASSERT( myHomardYACS );
118   myHomardYACS->SetType( Type );
119 }
120 //=============================================================================
121 CORBA::Long HOMARD_YACS_i::GetType()
122 {
123   ASSERT( myHomardYACS );
124   return  CORBA::Long( myHomardYACS->GetType() );
125 }
126 //=============================================================================
127 void HOMARD_YACS_i::SetMaxIter( CORBA::Long MaxIter )
128 {
129   ASSERT( myHomardYACS );
130   myHomardYACS->SetMaxIter( MaxIter );
131 }
132 //=============================================================================
133 CORBA::Long HOMARD_YACS_i::GetMaxIter()
134 {
135   ASSERT( myHomardYACS );
136   return  CORBA::Long( myHomardYACS->GetMaxIter() );
137 }
138 //=============================================================================
139 void HOMARD_YACS_i::SetMaxNode( CORBA::Long MaxNode )
140 {
141   ASSERT( myHomardYACS );
142   myHomardYACS->SetMaxNode( MaxNode );
143 }
144 //=============================================================================
145 CORBA::Long HOMARD_YACS_i::GetMaxNode()
146 {
147   ASSERT( myHomardYACS );
148   return  CORBA::Long( myHomardYACS->GetMaxNode() );
149 }
150 //=============================================================================
151 void HOMARD_YACS_i::SetMaxElem( CORBA::Long MaxElem )
152 {
153   ASSERT( myHomardYACS );
154   myHomardYACS->SetMaxElem( MaxElem );
155 }
156 //=============================================================================
157 CORBA::Long HOMARD_YACS_i::GetMaxElem()
158 {
159   ASSERT( myHomardYACS );
160   return  CORBA::Long( myHomardYACS->GetMaxElem() );
161 }
162 //=============================================================================
163 void HOMARD_YACS_i::SetDirName( const char* NomDir )
164 {
165   ASSERT( myHomardYACS );
166   myHomardYACS->SetDirName( NomDir );
167 }
168 //=============================================================================
169 char* HOMARD_YACS_i::GetDirName()
170 {
171   ASSERT( myHomardYACS );
172   return CORBA::string_dup( myHomardYACS->GetDirName().c_str() );
173 }
174 //=============================================================================
175 void HOMARD_YACS_i::SetMeshFile( const char* MeshFile )
176 {
177   ASSERT( myHomardYACS );
178   myHomardYACS->SetMeshFile( MeshFile );
179 }
180 //=============================================================================
181 char* HOMARD_YACS_i::GetMeshFile()
182 {
183   ASSERT( myHomardYACS );
184   return CORBA::string_dup( myHomardYACS->GetMeshFile().c_str() );
185 }
186 //=============================================================================
187 void HOMARD_YACS_i::SetScriptFile( const char* ScriptFile )
188 {
189   ASSERT( myHomardYACS );
190   myHomardYACS->SetScriptFile( ScriptFile );
191 }
192 //=============================================================================
193 char* HOMARD_YACS_i::GetScriptFile()
194 {
195   ASSERT( myHomardYACS );
196   return CORBA::string_dup( myHomardYACS->GetScriptFile().c_str() );
197 }
198 //=============================================================================
199 void HOMARD_YACS_i::SetXMLFile( const char* XMLFile )
200 {
201   ASSERT( myHomardYACS );
202   MESSAGE ( "SetXMLFile : SetXMLFile = " << XMLFile );
203   myHomardYACS->SetXMLFile( XMLFile );
204 }
205 //=============================================================================
206 char* HOMARD_YACS_i::GetXMLFile()
207 {
208   ASSERT( myHomardYACS );
209   return CORBA::string_dup( myHomardYACS->GetXMLFile().c_str() );
210 }
211 //=============================================================================
212 //=============================================================================
213 // Liens avec les autres structures
214 //=============================================================================
215 //=============================================================================
216 void HOMARD_YACS_i::SetCaseName( const char* NomCas )
217 {
218   ASSERT( myHomardYACS );
219   myHomardYACS->SetCaseName( NomCas );
220 }
221 //=============================================================================
222 char* HOMARD_YACS_i::GetCaseName()
223 {
224   ASSERT( myHomardYACS );
225   return CORBA::string_dup( myHomardYACS->GetCaseName().c_str() );
226 }
227 //=============================================================================
228 CORBA::Long HOMARD_YACS_i::Write()
229 {
230 //
231   char* nomYACS = GetName() ;
232   return _gen_i->YACSWrite(nomYACS) ;
233 }
234 //=============================================================================
235 CORBA::Long HOMARD_YACS_i::WriteOnFile( const char* XMLFile )
236 {
237   MESSAGE ( "WriteOnFile : ecriture du schema sur " << XMLFile );
238   ASSERT( myHomardYACS );
239 //
240 // Memorisation du fichier associe
241   SetXMLFile( XMLFile ) ;
242 //
243 // Nom du schema
244   char* nomYACS = GetName() ;
245   return _gen_i->YACSWriteOnFile(nomYACS, XMLFile) ;
246 }
247 //=============================================================================
248 //=============================================================================
249 //=============================================================================
250 // Divers
251 //=============================================================================
252 //=============================================================================