1 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESH_MEDFamily_i.cxx
28 #include "SMESH_MEDFamily_i.hxx"
29 #include "utilities.h"
30 #include "Utils_CorbaException.hxx"
32 //=============================================================================
36 //=============================================================================
37 SMESH_MEDFamily_i::SMESH_MEDFamily_i()
39 BEGIN_OF("Default Constructor SMESH_MEDFamily_i");
40 END_OF("Default Constructor SMESH_MEDFamily_i");
42 //=============================================================================
44 * constructor par recopie
46 //=============================================================================
47 SMESH_MEDFamily_i::SMESH_MEDFamily_i(const SMESH_MEDFamily_i & f):
48 SMESH_MEDSupport_i(f._subMesh_i,f._name,f._description,f._entity),
49 _subMesh_i(f._subMesh_i),
50 _identifier(f._identifier),
51 _numberOfAttribute(f._numberOfAttribute),
52 _numberOfGroup(f._numberOfGroup),
53 _attributeValue(f._attributeValue)
55 BEGIN_OF("Copy Constructor SMESH_MEDFamily_i");
56 _attributeDescription=new string[_numberOfAttribute];
57 for (int i=0;i<_numberOfAttribute;i++) {
58 _attributeDescription[i]=f._attributeDescription[i];
60 _groupName=new string[_numberOfGroup];
61 for (int i=0;i<_numberOfAttribute;i++) {
62 _groupName[i]=f._groupName[i];
64 END_OF("Copy Constructor SMESH_MEDFamily_i");
66 //=============================================================================
70 //=============================================================================
71 SMESH_MEDFamily_i::~SMESH_MEDFamily_i()
74 //=============================================================================
78 //=============================================================================
79 SMESH_MEDFamily_i::SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm,
80 string name, string description, SALOME_MED::medEntityMesh entity):
81 SMESH_MEDSupport_i( sm, name, description, entity ),
84 _identifier(identifier),
85 _numberOfAttribute(0),
86 _attributeIdentifier((int*)NULL),
87 _attributeValue((int*)NULL),
88 _attributeDescription((string*)NULL),
90 _groupName((string*)NULL)
92 BEGIN_OF("Constructor SMESH_MEDFamily_i");
93 END_OF("Constructor SMESH_MEDFamily_i");
95 //=============================================================================
97 * CORBA: Accessor for Family's Identifier
99 //=============================================================================
101 CORBA::Long SMESH_MEDFamily_i::getIdentifier()
102 throw (SALOME::SALOME_Exception)
104 if (_subMeshDS==NULL)
105 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
106 SALOME::INTERNAL_ERROR);
110 //=============================================================================
112 * CORBA: Accessor for number of attributes
114 //=============================================================================
115 CORBA::Long SMESH_MEDFamily_i::getNumberOfAttributes()
116 throw (SALOME::SALOME_Exception)
118 if (_subMeshDS==NULL)
119 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
120 SALOME::INTERNAL_ERROR);
121 return _numberOfAttribute;
123 //=============================================================================
125 * CORBA: Accessor for attributes identifiers
127 //=============================================================================
128 SALOME_MED::long_array* SMESH_MEDFamily_i::getAttributesIdentifiers()
129 throw (SALOME::SALOME_Exception)
131 if (_subMeshDS==NULL)
132 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
133 SALOME::INTERNAL_ERROR);
134 if (_numberOfAttribute == 0)
136 MESSAGE("Les familles SMESH n ont pas d attribut");
137 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
141 SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
142 myseq->length(_numberOfAttribute);
143 for (int i=0;i<_numberOfAttribute;i++)
145 myseq[i]=_attributeIdentifier[i];
147 return myseq._retn();
150 //=============================================================================
152 * CORBA: Accessor for attribute identifier I
154 //=============================================================================
155 CORBA::Long SMESH_MEDFamily_i::getAttributeIdentifier(CORBA::Long i)
156 throw (SALOME::SALOME_Exception)
158 if (_subMeshDS==NULL)
159 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
160 SALOME::INTERNAL_ERROR);
161 MESSAGE("Les familles SMESH n ont pas d attribut");
162 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
164 if (_numberOfAttribute == 0)
166 MESSAGE("Les familles SMESH n ont pas d attribut");
167 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
170 ASSERT (i <= _numberOfAttribute);
171 return _attributeIdentifier[i];
173 //=============================================================================
175 * CORBA: Accessor for attributes values
177 //=============================================================================
178 SALOME_MED::long_array* SMESH_MEDFamily_i::getAttributesValues()
179 throw (SALOME::SALOME_Exception)
181 if (_subMeshDS==NULL)
182 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
183 SALOME::INTERNAL_ERROR);
185 if (_numberOfAttribute == 0)
187 MESSAGE("Les familles SMESH n ont pas d attribut");
188 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
192 SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
193 myseq->length(_numberOfAttribute);
194 for (int i=0;i<_numberOfAttribute;i++)
196 myseq[i]=_attributeValue[i];
198 return myseq._retn();
200 //=============================================================================
202 * CORBA: Accessor for attribute value I
204 //=============================================================================
205 CORBA::Long SMESH_MEDFamily_i::getAttributeValue(CORBA::Long i)
206 throw (SALOME::SALOME_Exception)
208 if (_subMeshDS==NULL)
209 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
210 SALOME::INTERNAL_ERROR);
211 if (_numberOfAttribute == 0)
213 MESSAGE("Les familles SMESH n ont pas d attribut");
214 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
218 ASSERT (i <= _numberOfAttribute);
219 return _attributeValue[i];
221 //=============================================================================
223 * CORBA: Accessor for attributes desriptions
225 //=============================================================================
226 SALOME_MED::string_array * SMESH_MEDFamily_i::getAttributesDescriptions()
227 throw (SALOME::SALOME_Exception)
229 if (_subMeshDS==NULL)
230 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
231 SALOME::INTERNAL_ERROR);
232 if (_numberOfAttribute == 0)
234 MESSAGE("Les familles SMESH n ont pas d attribut");
235 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
238 SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
239 for (int i=0;i<_numberOfAttribute;i++)
241 myseq[i]=CORBA::string_dup(_attributeDescription[i].c_str());
243 return myseq._retn();
245 //=============================================================================
247 * CORBA: Accessor for attribute description i
249 //=============================================================================
250 char * SMESH_MEDFamily_i::getAttributeDescription( CORBA::Long i)
251 throw (SALOME::SALOME_Exception)
253 if (_subMeshDS==NULL)
254 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
255 SALOME::INTERNAL_ERROR);
256 if (_numberOfAttribute == 0)
258 MESSAGE("Les familles SMESH n ont pas d attribut");
259 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
262 ASSERT (i <= _numberOfAttribute);
263 return CORBA::string_dup(_attributeDescription[i].c_str());
265 //=============================================================================
267 * CORBA: Accessor for the number of groups
269 //=============================================================================
270 CORBA::Long SMESH_MEDFamily_i::getNumberOfGroups()
271 throw (SALOME::SALOME_Exception)
273 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
274 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
277 //=============================================================================
279 * CORBA: Accessor for the name of the group i
281 //=============================================================================
282 char * SMESH_MEDFamily_i::getGroupName( CORBA::Long i)
283 throw (SALOME::SALOME_Exception)
285 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
286 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
289 //=============================================================================
291 * CORBA: Accessor for all the groups name
293 //=============================================================================
294 SALOME_MED::string_array* SMESH_MEDFamily_i::getGroupsNames()
295 throw (SALOME::SALOME_Exception)
297 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
298 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);