Back to index

salome-smesh  6.5.0
SMESH_MEDFamily_i.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
00024 //  File   : SMESH_MEDFamily_i.cxx
00025 //  Module : SMESH
00026 //
00027 #include "SMESH_MEDFamily_i.hxx"
00028 #include "utilities.h"
00029 #include "Utils_CorbaException.hxx"
00030 
00031 using namespace std;
00032 
00033 //=============================================================================
00037 //=============================================================================
00038 SMESH_MEDFamily_i::SMESH_MEDFamily_i()
00039 {
00040   BEGIN_OF("Default Constructor SMESH_MEDFamily_i");
00041   END_OF("Default Constructor SMESH_MEDFamily_i");
00042 }
00043 //=============================================================================
00047 //=============================================================================
00048 SMESH_MEDFamily_i::SMESH_MEDFamily_i(const SMESH_MEDFamily_i & f): 
00049   SMESH_MEDSupport_i(f._subMesh_i,f._name,f._description,f._entity),
00050   _subMesh_i(f._subMesh_i),
00051   _identifier(f._identifier),
00052   _numberOfAttribute(f._numberOfAttribute),
00053   _numberOfGroup(f._numberOfGroup), 
00054   _attributeValue(f._attributeValue)
00055 {
00056   BEGIN_OF("Copy Constructor SMESH_MEDFamily_i");
00057   _attributeDescription=new string[_numberOfAttribute];
00058   for (int i=0;i<_numberOfAttribute;i++) {
00059     _attributeDescription[i]=f._attributeDescription[i];
00060   };
00061   _groupName=new string[_numberOfGroup];
00062   for (int i=0;i<_numberOfAttribute;i++) {
00063     _groupName[i]=f._groupName[i];
00064   };
00065   END_OF("Copy Constructor SMESH_MEDFamily_i");
00066 }
00067 //=============================================================================
00071 //=============================================================================
00072 SMESH_MEDFamily_i::~SMESH_MEDFamily_i()
00073 {
00074 }
00075 //=============================================================================
00079 //=============================================================================
00080 SMESH_MEDFamily_i::SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm,
00081                                      string name, string description, SALOME_MED::medEntityMesh entity): 
00082   SMESH_MEDSupport_i( sm, name, description, entity ),
00083   
00084   _subMesh_i(sm),
00085   _identifier(identifier),
00086   _numberOfAttribute(0),
00087   _attributeIdentifier((int*)NULL),
00088   _attributeValue((int*)NULL), 
00089   _attributeDescription((string*)NULL),
00090   _numberOfGroup(0), 
00091   _groupName((string*)NULL)
00092 {
00093   BEGIN_OF("Constructor SMESH_MEDFamily_i");
00094   END_OF("Constructor SMESH_MEDFamily_i");
00095 }
00096 //=============================================================================
00100 //=============================================================================
00101 
00102 CORBA::Long SMESH_MEDFamily_i::getIdentifier()      
00103 throw (SALOME::SALOME_Exception)
00104 {
00105   if (_subMesh==NULL)
00106     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00107                                  SALOME::INTERNAL_ERROR); 
00108   return _identifier;
00109   
00110 }
00111 //=============================================================================
00115 //=============================================================================
00116 CORBA::Long SMESH_MEDFamily_i::getNumberOfAttributes() 
00117 throw (SALOME::SALOME_Exception)
00118 {
00119   if (_subMesh==NULL)
00120     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00121                                  SALOME::INTERNAL_ERROR);
00122   return _numberOfAttribute;
00123 }
00124 //=============================================================================
00128 //=============================================================================
00129 SALOME_TYPES::ListOfLong*  SMESH_MEDFamily_i::getAttributesIdentifiers() 
00130 throw (SALOME::SALOME_Exception)
00131 {
00132   if (_subMesh==NULL)
00133     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00134                                  SALOME::INTERNAL_ERROR);
00135   if (_numberOfAttribute == 0)
00136     {
00137       MESSAGE("Les familles SMESH n ont pas d attribut");
00138       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
00139                                    ,SALOME::BAD_PARAM);
00140     };
00141   
00142   SALOME_TYPES::ListOfLong_var myseq= new SALOME_TYPES::ListOfLong;
00143   myseq->length(_numberOfAttribute);
00144   for (int i=0;i<_numberOfAttribute;i++)
00145     {
00146       myseq[i]=_attributeIdentifier[i];
00147     };
00148   return myseq._retn();
00149 
00150 }
00151 //=============================================================================
00155 //=============================================================================
00156 CORBA::Long SMESH_MEDFamily_i::getAttributeIdentifier(CORBA::Long i) 
00157   throw (SALOME::SALOME_Exception)
00158 {    
00159   if (_subMesh==NULL)
00160     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00161                                  SALOME::INTERNAL_ERROR);
00162   MESSAGE("Les familles SMESH n ont pas d attribut");
00163   THROW_SALOME_CORBA_EXCEPTION("No attributes"\
00164                                ,SALOME::BAD_PARAM);
00165   if (_numberOfAttribute == 0)
00166     {
00167       MESSAGE("Les familles SMESH n ont pas d attribut");
00168       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
00169                                    ,SALOME::BAD_PARAM);
00170     };
00171   ASSERT (i <= _numberOfAttribute);
00172   return _attributeIdentifier[i];
00173 }
00174 //=============================================================================
00178 //=============================================================================
00179 SALOME_TYPES::ListOfLong*  SMESH_MEDFamily_i::getAttributesValues() 
00180   throw (SALOME::SALOME_Exception)
00181 {
00182   if (_subMesh==NULL)
00183     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00184                                  SALOME::INTERNAL_ERROR);
00185 
00186   if (_numberOfAttribute == 0)
00187     {
00188       MESSAGE("Les familles SMESH n ont pas d attribut");
00189       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
00190                                    ,SALOME::BAD_PARAM);
00191     };
00192 
00193   SALOME_TYPES::ListOfLong_var myseq= new SALOME_TYPES::ListOfLong;
00194   myseq->length(_numberOfAttribute);
00195   for (int i=0;i<_numberOfAttribute;i++)
00196     {
00197       myseq[i]=_attributeValue[i];
00198     };
00199   return myseq._retn();
00200 }
00201 //=============================================================================
00205 //=============================================================================
00206 CORBA::Long  SMESH_MEDFamily_i::getAttributeValue(CORBA::Long i) 
00207   throw (SALOME::SALOME_Exception)
00208 {   
00209   if (_subMesh==NULL)
00210     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00211                                  SALOME::INTERNAL_ERROR);
00212   if (_numberOfAttribute == 0)
00213     {
00214       MESSAGE("Les familles SMESH n ont pas d attribut");
00215       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
00216                                    ,SALOME::BAD_PARAM);
00217     }
00218 
00219   ASSERT (i <= _numberOfAttribute);
00220   return _attributeValue[i];
00221 }
00222 //=============================================================================
00226 //=============================================================================
00227 SALOME_TYPES::ListOfString * SMESH_MEDFamily_i::getAttributesDescriptions() 
00228   throw (SALOME::SALOME_Exception)
00229 {
00230   if (_subMesh==NULL)
00231     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00232                                  SALOME::INTERNAL_ERROR);
00233   if (_numberOfAttribute == 0)
00234     {
00235       MESSAGE("Les familles SMESH n ont pas d attribut");
00236       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
00237                                    ,SALOME::BAD_PARAM);
00238     }
00239   SALOME_TYPES::ListOfString_var myseq = new SALOME_TYPES::ListOfString;
00240   for (int i=0;i<_numberOfAttribute;i++)
00241     {
00242       myseq[i]=CORBA::string_dup(_attributeDescription[i].c_str());
00243     }
00244   return myseq._retn();
00245 }
00246 //=============================================================================
00250 //=============================================================================
00251 char *  SMESH_MEDFamily_i::getAttributeDescription( CORBA::Long i) 
00252   throw (SALOME::SALOME_Exception)
00253 {   
00254   if (_subMesh==NULL)
00255     THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00256                                  SALOME::INTERNAL_ERROR);
00257   if (_numberOfAttribute == 0)
00258     {
00259       MESSAGE("Les familles SMESH n ont pas d attribut");
00260       THROW_SALOME_CORBA_EXCEPTION("No attributes"\
00261                                    ,SALOME::BAD_PARAM);
00262     }
00263   ASSERT (i <= _numberOfAttribute);
00264   return CORBA::string_dup(_attributeDescription[i].c_str());
00265 }
00266 //=============================================================================
00270 //=============================================================================
00271 CORBA::Long SMESH_MEDFamily_i::getNumberOfGroups()
00272     throw (SALOME::SALOME_Exception)
00273 {
00274   MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
00275   THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
00276   return 0;
00277 }
00278 //=============================================================================
00282 //=============================================================================
00283 char * SMESH_MEDFamily_i::getGroupName( CORBA::Long i)
00284   throw (SALOME::SALOME_Exception)
00285 {
00286   MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
00287   THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
00288   return NULL;
00289 }
00290 //=============================================================================
00294 //=============================================================================
00295 SALOME_TYPES::ListOfString* SMESH_MEDFamily_i::getGroupsNames()
00296   throw (SALOME::SALOME_Exception)
00297 {
00298   MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
00299   THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
00300   return NULL;
00301 }