Salome HOME
PAL10494. Add .._STANDARD_RTTI_... in order to build executable
[modules/smesh.git] / src / SMESH_I / SMESH_MEDFamily_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_MEDFamily_i.cxx
25 //  Module : SMESH
26
27 using namespace std;
28 #include "SMESH_MEDFamily_i.hxx"
29 #include "utilities.h"
30 #include "Utils_CorbaException.hxx"
31
32 //=============================================================================
33 /*!
34  * Default constructor
35  */
36 //=============================================================================
37 SMESH_MEDFamily_i::SMESH_MEDFamily_i()
38 {
39   BEGIN_OF("Default Constructor SMESH_MEDFamily_i");
40   END_OF("Default Constructor SMESH_MEDFamily_i");
41 }
42 //=============================================================================
43 /*!
44  * constructor par recopie
45  */
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)
54 {
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];
59   };
60   _groupName=new string[_numberOfGroup];
61   for (int i=0;i<_numberOfAttribute;i++) {
62     _groupName[i]=f._groupName[i];
63   };
64   END_OF("Copy Constructor SMESH_MEDFamily_i");
65 }
66 //=============================================================================
67 /*!
68  * Destructor
69  */
70 //=============================================================================
71 SMESH_MEDFamily_i::~SMESH_MEDFamily_i()
72 {
73 }
74 //=============================================================================
75 /*!
76  * Constructor
77  */
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 ),
82   
83   _subMesh_i(sm),
84   _identifier(identifier),
85   _numberOfAttribute(0),
86   _attributeIdentifier((int*)NULL),
87   _attributeValue((int*)NULL), 
88   _attributeDescription((string*)NULL),
89   _numberOfGroup(0), 
90   _groupName((string*)NULL)
91 {
92   BEGIN_OF("Constructor SMESH_MEDFamily_i");
93   END_OF("Constructor SMESH_MEDFamily_i");
94 }
95 //=============================================================================
96 /*!
97  * CORBA: Accessor for Family's Identifier
98  */
99 //=============================================================================
100
101 CORBA::Long SMESH_MEDFamily_i::getIdentifier()      
102 throw (SALOME::SALOME_Exception)
103 {
104   if (_subMeshDS==NULL)
105     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
106                                  SALOME::INTERNAL_ERROR); 
107   return _identifier;
108   
109 }
110 //=============================================================================
111 /*!
112  * CORBA: Accessor for number of attributes
113  */
114 //=============================================================================
115 CORBA::Long SMESH_MEDFamily_i::getNumberOfAttributes() 
116 throw (SALOME::SALOME_Exception)
117 {
118   if (_subMeshDS==NULL)
119     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
120                                  SALOME::INTERNAL_ERROR);
121   return _numberOfAttribute;
122 }
123 //=============================================================================
124 /*!
125  * CORBA: Accessor for attributes identifiers
126  */
127 //=============================================================================
128 SALOME_MED::long_array*  SMESH_MEDFamily_i::getAttributesIdentifiers() 
129 throw (SALOME::SALOME_Exception)
130 {
131   if (_subMeshDS==NULL)
132     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
133                                  SALOME::INTERNAL_ERROR);
134   if (_numberOfAttribute == 0)
135     {
136       MESSAGE("Les familles SMESH n ont pas d attribut");
137       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
138                                    ,SALOME::BAD_PARAM);
139     };
140   
141   SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
142   myseq->length(_numberOfAttribute);
143   for (int i=0;i<_numberOfAttribute;i++)
144     {
145       myseq[i]=_attributeIdentifier[i];
146     };
147   return myseq._retn();
148
149 }
150 //=============================================================================
151 /*!
152  * CORBA: Accessor for attribute identifier I
153  */
154 //=============================================================================
155 CORBA::Long SMESH_MEDFamily_i::getAttributeIdentifier(CORBA::Long i) 
156   throw (SALOME::SALOME_Exception)
157 {    
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"\
163                                ,SALOME::BAD_PARAM);
164   if (_numberOfAttribute == 0)
165     {
166       MESSAGE("Les familles SMESH n ont pas d attribut");
167       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
168                                    ,SALOME::BAD_PARAM);
169     };
170   ASSERT (i <= _numberOfAttribute);
171   return _attributeIdentifier[i];
172 }
173 //=============================================================================
174 /*!
175  * CORBA: Accessor for attributes values
176  */
177 //=============================================================================
178 SALOME_MED::long_array*  SMESH_MEDFamily_i::getAttributesValues() 
179   throw (SALOME::SALOME_Exception)
180 {
181   if (_subMeshDS==NULL)
182     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
183                                  SALOME::INTERNAL_ERROR);
184
185   if (_numberOfAttribute == 0)
186     {
187       MESSAGE("Les familles SMESH n ont pas d attribut");
188       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
189                                    ,SALOME::BAD_PARAM);
190     };
191
192   SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
193   myseq->length(_numberOfAttribute);
194   for (int i=0;i<_numberOfAttribute;i++)
195     {
196       myseq[i]=_attributeValue[i];
197     };
198   return myseq._retn();
199 }
200 //=============================================================================
201 /*!
202  * CORBA: Accessor for attribute value I
203  */
204 //=============================================================================
205 CORBA::Long  SMESH_MEDFamily_i::getAttributeValue(CORBA::Long i) 
206   throw (SALOME::SALOME_Exception)
207 {   
208   if (_subMeshDS==NULL)
209     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
210                                  SALOME::INTERNAL_ERROR);
211   if (_numberOfAttribute == 0)
212     {
213       MESSAGE("Les familles SMESH n ont pas d attribut");
214       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
215                                    ,SALOME::BAD_PARAM);
216     }
217
218   ASSERT (i <= _numberOfAttribute);
219   return _attributeValue[i];
220 }
221 //=============================================================================
222 /*!
223  * CORBA: Accessor for attributes desriptions
224  */
225 //=============================================================================
226 SALOME_MED::string_array * SMESH_MEDFamily_i::getAttributesDescriptions() 
227   throw (SALOME::SALOME_Exception)
228 {
229   if (_subMeshDS==NULL)
230     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
231                                  SALOME::INTERNAL_ERROR);
232   if (_numberOfAttribute == 0)
233     {
234       MESSAGE("Les familles SMESH n ont pas d attribut");
235       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
236                                    ,SALOME::BAD_PARAM);
237     }
238   SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
239   for (int i=0;i<_numberOfAttribute;i++)
240     {
241       myseq[i]=CORBA::string_dup(_attributeDescription[i].c_str());
242     }
243   return myseq._retn();
244 }
245 //=============================================================================
246 /*!
247  * CORBA: Accessor for attribute description i
248  */
249 //=============================================================================
250 char *  SMESH_MEDFamily_i::getAttributeDescription( CORBA::Long i) 
251   throw (SALOME::SALOME_Exception)
252 {   
253   if (_subMeshDS==NULL)
254     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
255                                  SALOME::INTERNAL_ERROR);
256   if (_numberOfAttribute == 0)
257     {
258       MESSAGE("Les familles SMESH n ont pas d attribut");
259       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
260                                    ,SALOME::BAD_PARAM);
261     }
262   ASSERT (i <= _numberOfAttribute);
263   return CORBA::string_dup(_attributeDescription[i].c_str());
264 }
265 //=============================================================================
266 /*!
267  * CORBA: Accessor for the number of groups
268  */
269 //=============================================================================
270 CORBA::Long SMESH_MEDFamily_i::getNumberOfGroups()
271     throw (SALOME::SALOME_Exception)
272 {
273   MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
274   THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
275   return 0;
276 }
277 //=============================================================================
278 /*!
279  * CORBA: Accessor for the name of the group i
280  */
281 //=============================================================================
282 char * SMESH_MEDFamily_i::getGroupName( CORBA::Long i)
283   throw (SALOME::SALOME_Exception)
284 {
285   MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
286   THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
287   return NULL;
288 }
289 //=============================================================================
290 /*!
291  * CORBA: Accessor for all the groups name
292  */
293 //=============================================================================
294 SALOME_MED::string_array* SMESH_MEDFamily_i::getGroupsNames()
295   throw (SALOME::SALOME_Exception)
296 {
297   MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
298   THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
299   return NULL;
300 }