1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
24 // File : SMESH_MEDFamily_i.cxx
27 #include "SMESH_MEDFamily_i.hxx"
28 #include "utilities.h"
29 #include "Utils_CorbaException.hxx"
33 //=============================================================================
37 //=============================================================================
38 SMESH_MEDFamily_i::SMESH_MEDFamily_i()
40 BEGIN_OF("Default Constructor SMESH_MEDFamily_i");
41 END_OF("Default Constructor SMESH_MEDFamily_i");
43 //=============================================================================
45 * constructor par recopie
47 //=============================================================================
48 SMESH_MEDFamily_i::SMESH_MEDFamily_i(const SMESH_MEDFamily_i & f):
49 SMESH_MEDSupport_i(f._subMesh_i,f._name,f._description,f._entity),
50 _subMesh_i(f._subMesh_i),
51 _identifier(f._identifier),
52 _numberOfAttribute(f._numberOfAttribute),
53 _numberOfGroup(f._numberOfGroup),
54 _attributeValue(f._attributeValue)
56 BEGIN_OF("Copy Constructor SMESH_MEDFamily_i");
57 _attributeDescription=new string[_numberOfAttribute];
58 for (int i=0;i<_numberOfAttribute;i++) {
59 _attributeDescription[i]=f._attributeDescription[i];
61 _groupName=new string[_numberOfGroup];
62 for (int i=0;i<_numberOfAttribute;i++) {
63 _groupName[i]=f._groupName[i];
65 END_OF("Copy Constructor SMESH_MEDFamily_i");
67 //=============================================================================
71 //=============================================================================
72 SMESH_MEDFamily_i::~SMESH_MEDFamily_i()
75 //=============================================================================
79 //=============================================================================
80 SMESH_MEDFamily_i::SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm,
81 string name, string description, SALOME_MED::medEntityMesh entity):
82 SMESH_MEDSupport_i( sm, name, description, entity ),
85 _identifier(identifier),
86 _numberOfAttribute(0),
87 _attributeIdentifier((int*)NULL),
88 _attributeValue((int*)NULL),
89 _attributeDescription((string*)NULL),
91 _groupName((string*)NULL)
93 BEGIN_OF("Constructor SMESH_MEDFamily_i");
94 END_OF("Constructor SMESH_MEDFamily_i");
96 //=============================================================================
98 * CORBA: Accessor for Family's Identifier
100 //=============================================================================
102 CORBA::Long SMESH_MEDFamily_i::getIdentifier()
103 throw (SALOME::SALOME_Exception)
105 if (_subMeshDS==NULL)
106 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
107 SALOME::INTERNAL_ERROR);
111 //=============================================================================
113 * CORBA: Accessor for number of attributes
115 //=============================================================================
116 CORBA::Long SMESH_MEDFamily_i::getNumberOfAttributes()
117 throw (SALOME::SALOME_Exception)
119 if (_subMeshDS==NULL)
120 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
121 SALOME::INTERNAL_ERROR);
122 return _numberOfAttribute;
124 //=============================================================================
126 * CORBA: Accessor for attributes identifiers
128 //=============================================================================
129 SALOME_TYPES::ListOfLong* SMESH_MEDFamily_i::getAttributesIdentifiers()
130 throw (SALOME::SALOME_Exception)
132 if (_subMeshDS==NULL)
133 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
134 SALOME::INTERNAL_ERROR);
135 if (_numberOfAttribute == 0)
137 MESSAGE("Les familles SMESH n ont pas d attribut");
138 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
142 SALOME_TYPES::ListOfLong_var myseq= new SALOME_TYPES::ListOfLong;
143 myseq->length(_numberOfAttribute);
144 for (int i=0;i<_numberOfAttribute;i++)
146 myseq[i]=_attributeIdentifier[i];
148 return myseq._retn();
151 //=============================================================================
153 * CORBA: Accessor for attribute identifier I
155 //=============================================================================
156 CORBA::Long SMESH_MEDFamily_i::getAttributeIdentifier(CORBA::Long i)
157 throw (SALOME::SALOME_Exception)
159 if (_subMeshDS==NULL)
160 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
161 SALOME::INTERNAL_ERROR);
162 MESSAGE("Les familles SMESH n ont pas d attribut");
163 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
165 if (_numberOfAttribute == 0)
167 MESSAGE("Les familles SMESH n ont pas d attribut");
168 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
171 ASSERT (i <= _numberOfAttribute);
172 return _attributeIdentifier[i];
174 //=============================================================================
176 * CORBA: Accessor for attributes values
178 //=============================================================================
179 SALOME_TYPES::ListOfLong* SMESH_MEDFamily_i::getAttributesValues()
180 throw (SALOME::SALOME_Exception)
182 if (_subMeshDS==NULL)
183 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
184 SALOME::INTERNAL_ERROR);
186 if (_numberOfAttribute == 0)
188 MESSAGE("Les familles SMESH n ont pas d attribut");
189 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
193 SALOME_TYPES::ListOfLong_var myseq= new SALOME_TYPES::ListOfLong;
194 myseq->length(_numberOfAttribute);
195 for (int i=0;i<_numberOfAttribute;i++)
197 myseq[i]=_attributeValue[i];
199 return myseq._retn();
201 //=============================================================================
203 * CORBA: Accessor for attribute value I
205 //=============================================================================
206 CORBA::Long SMESH_MEDFamily_i::getAttributeValue(CORBA::Long i)
207 throw (SALOME::SALOME_Exception)
209 if (_subMeshDS==NULL)
210 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
211 SALOME::INTERNAL_ERROR);
212 if (_numberOfAttribute == 0)
214 MESSAGE("Les familles SMESH n ont pas d attribut");
215 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
219 ASSERT (i <= _numberOfAttribute);
220 return _attributeValue[i];
222 //=============================================================================
224 * CORBA: Accessor for attributes desriptions
226 //=============================================================================
227 SALOME_TYPES::ListOfString * SMESH_MEDFamily_i::getAttributesDescriptions()
228 throw (SALOME::SALOME_Exception)
230 if (_subMeshDS==NULL)
231 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
232 SALOME::INTERNAL_ERROR);
233 if (_numberOfAttribute == 0)
235 MESSAGE("Les familles SMESH n ont pas d attribut");
236 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
239 SALOME_TYPES::ListOfString_var myseq = new SALOME_TYPES::ListOfString;
240 for (int i=0;i<_numberOfAttribute;i++)
242 myseq[i]=CORBA::string_dup(_attributeDescription[i].c_str());
244 return myseq._retn();
246 //=============================================================================
248 * CORBA: Accessor for attribute description i
250 //=============================================================================
251 char * SMESH_MEDFamily_i::getAttributeDescription( CORBA::Long i)
252 throw (SALOME::SALOME_Exception)
254 if (_subMeshDS==NULL)
255 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
256 SALOME::INTERNAL_ERROR);
257 if (_numberOfAttribute == 0)
259 MESSAGE("Les familles SMESH n ont pas d attribut");
260 THROW_SALOME_CORBA_EXCEPTION("No attributes"\
263 ASSERT (i <= _numberOfAttribute);
264 return CORBA::string_dup(_attributeDescription[i].c_str());
266 //=============================================================================
268 * CORBA: Accessor for the number of groups
270 //=============================================================================
271 CORBA::Long SMESH_MEDFamily_i::getNumberOfGroups()
272 throw (SALOME::SALOME_Exception)
274 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
275 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
278 //=============================================================================
280 * CORBA: Accessor for the name of the group i
282 //=============================================================================
283 char * SMESH_MEDFamily_i::getGroupName( CORBA::Long i)
284 throw (SALOME::SALOME_Exception)
286 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
287 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
290 //=============================================================================
292 * CORBA: Accessor for all the groups name
294 //=============================================================================
295 SALOME_TYPES::ListOfString* SMESH_MEDFamily_i::getGroupsNames()
296 throw (SALOME::SALOME_Exception)
298 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
299 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);