Back to index

salome-med  6.5.0
MEDMEM_Family_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 //=============================================================================
00024 // File      :  MEDMEM_Family_i.cxx
00025 // Project   :  SALOME
00026 // Author    :  EDF
00027 // $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Family_i.cxx
00028 //=============================================================================
00029 //
00030 #include "utilities.h"
00031 #include "Utils_CorbaException.hxx"
00032 #include "MEDMEM_Family_i.hxx"
00033 #include "MEDMEM_Family.hxx"
00034 using namespace MEDMEM;
00035 
00036 //=============================================================================
00040 //=============================================================================
00041 FAMILY_i::FAMILY_i(): _family((::FAMILY*)NULL)
00042 {
00043 }
00044 //=============================================================================
00048 //=============================================================================
00049 FAMILY_i::FAMILY_i(const FAMILY_i & f): SUPPORT_i(f._family),_family(f._family)
00050                                         
00051 {
00052 }
00053 //=============================================================================
00057 //=============================================================================
00058 FAMILY_i::~FAMILY_i()
00059 {
00060 }
00061 //=============================================================================
00065 //=============================================================================
00066 FAMILY_i::FAMILY_i(const ::FAMILY * const f): SUPPORT_i(f),_family(f)
00067 {
00068 }
00069 //=============================================================================
00073 //=============================================================================
00074 
00075 CORBA::Long FAMILY_i::getIdentifier()      
00076 throw (SALOME::SALOME_Exception)
00077 {
00078         if (_family==NULL)
00079                 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00080                                              SALOME::INTERNAL_ERROR); 
00081         try
00082         {
00083                 return _family->getIdentifier();
00084         }
00085         catch(MEDEXCEPTION &ex)
00086         {
00087                 MESSAGE("Unable to acces Family Identifier");
00088                 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
00089         }
00090 
00091 }
00092 //=============================================================================
00096 //=============================================================================
00097 CORBA::Long FAMILY_i::getNumberOfAttributes() 
00098 throw (SALOME::SALOME_Exception)
00099 {
00100         if (_family==NULL)
00101                 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00102                                              SALOME::INTERNAL_ERROR);
00103         try
00104         {
00105                 return _family->getNumberOfAttributes();
00106         }
00107         catch(MEDEXCEPTION &ex)
00108         {
00109                 MESSAGE("Unable to get number of attributes");
00110                 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
00111         }
00112 }
00113 //=============================================================================
00117 //=============================================================================
00118 SALOME_TYPES::ListOfLong*  FAMILY_i::getAttributesIdentifiers() 
00119 throw (SALOME::SALOME_Exception)
00120 {
00121         if (_family==NULL)
00122                 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00123                                              SALOME::INTERNAL_ERROR);
00124         SALOME_TYPES::ListOfLong_var myseq= new SALOME_TYPES::ListOfLong;
00125         try
00126         {
00127                 int nbAttribute=_family->getNumberOfAttributes();
00128                 myseq->length(nbAttribute);
00129                 const int * identifiers=_family->getAttributesIdentifiers();
00130                 for (int i=0;i<nbAttribute;i++)
00131                 {
00132                         myseq[i]=identifiers[i];
00133                 }
00134         }
00135         catch(MEDEXCEPTION &ex)
00136         {
00137                 MESSAGE("Unable to acces Family Identifiers");
00138                 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
00139         }
00140         return myseq._retn();
00141 }
00142 //=============================================================================
00146 //=============================================================================
00147 CORBA::Long FAMILY_i::getAttributeIdentifier(CORBA::Long i) 
00148 throw (SALOME::SALOME_Exception)
00149 {    
00150         if (_family==NULL)
00151                 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00152                                              SALOME::INTERNAL_ERROR);
00153         try
00154         {
00155                 return _family->getAttributeIdentifier(i);
00156         }
00157         catch(MEDEXCEPTION &ex)
00158         {
00159                 MESSAGE("Unable to acces Family Identifier");
00160                 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
00161         }
00162  
00163 }
00164 //=============================================================================
00168 //=============================================================================
00169 SALOME_TYPES::ListOfLong*  FAMILY_i::getAttributesValues() 
00170 throw (SALOME::SALOME_Exception)
00171 {
00172         if (_family==NULL)
00173                 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00174                                              SALOME::INTERNAL_ERROR);
00175         SALOME_TYPES::ListOfLong_var myseq= new SALOME_TYPES::ListOfLong;
00176         try
00177         {
00178                 int nbAttribute=_family->getNumberOfAttributes();
00179                 myseq->length(nbAttribute);
00180                 const int * values=_family->getAttributesValues();
00181                 for (int i=0;i<nbAttribute;i++)
00182                 {
00183                         myseq[i]=values[i];
00184                 }
00185         }
00186         catch(MEDEXCEPTION &ex)
00187         {
00188                 MESSAGE("Unable to acces attributs values");
00189                 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
00190         }
00191         return myseq._retn();
00192 }
00193 //=============================================================================
00197 //=============================================================================
00198 CORBA::Long  FAMILY_i::getAttributeValue(CORBA::Long i) 
00199 throw (SALOME::SALOME_Exception)
00200 {   
00201         if (_family==NULL)
00202                 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00203                                              SALOME::INTERNAL_ERROR);
00204         try
00205         {
00206                 return _family->getAttributeValue(i);
00207         }
00208         catch(MEDEXCEPTION &ex)
00209         {
00210                 MESSAGE("Unable to acces specified attribut value");
00211                 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
00212         }
00213 }
00214 //=============================================================================
00218 //=============================================================================
00219 SALOME_TYPES::ListOfString * FAMILY_i::getAttributesDescriptions() 
00220 throw (SALOME::SALOME_Exception)
00221 {
00222         if (_family==NULL)
00223                 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00224                                              SALOME::INTERNAL_ERROR);
00225         
00226         SALOME_TYPES::ListOfString_var myseq = new SALOME_TYPES::ListOfString;
00227         try
00228         {
00229                 int nbAttribute=_family->getNumberOfAttributes();
00230                 myseq->length(nbAttribute);
00231                 const string * descattribute=_family->getAttributesDescriptions();
00232                 for (int i=0;i<nbAttribute;i++)
00233                 {
00234                         myseq[i]=CORBA::string_dup(descattribute[i].c_str());
00235                 }
00236         }
00237         catch(MEDEXCEPTION &ex)
00238         {
00239                 MESSAGE("Unable to acces attributs descriptions");
00240                 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
00241         }
00242         return myseq._retn();
00243 
00244 }
00245 //=============================================================================
00249 //=============================================================================
00250 char *  FAMILY_i::getAttributeDescription( CORBA::Long i) 
00251 throw (SALOME::SALOME_Exception)
00252 {   
00253         if (_family==NULL)
00254                 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00255                                              SALOME::INTERNAL_ERROR);
00256         try
00257         {
00258                 return CORBA::string_dup(_family->getAttributeDescription(i).c_str());
00259         }
00260         catch(MEDEXCEPTION &ex)
00261         {
00262                 MESSAGE("Unable to acces specified attribut description");
00263                 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
00264         }
00265 }
00266 
00267 //=============================================================================
00271 //=============================================================================
00272 CORBA::Long  FAMILY_i::getNumberOfGroups()
00273 throw (SALOME::SALOME_Exception)
00274 {
00275         if (_family==NULL)
00276                 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00277                                              SALOME::INTERNAL_ERROR);
00278         try
00279         {
00280                 return _family->getNumberOfGroups();
00281         }
00282         catch (MEDEXCEPTION &ex)
00283         {
00284                 MESSAGE("Unable to acces specified attribut value");
00285                 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
00286         }
00287 }
00288 //=============================================================================
00292 //=============================================================================
00293 SALOME_TYPES::ListOfString * FAMILY_i::getGroupsNames()
00294 throw (SALOME::SALOME_Exception)
00295 {
00296         if (_family==NULL)
00297                 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00298                                              SALOME::INTERNAL_ERROR);
00299 
00300         SALOME_TYPES::ListOfString_var myseq = new SALOME_TYPES::ListOfString;
00301         try
00302         {
00303                 int nbGroups=_family->getNumberOfGroups();
00304                 myseq->length(nbGroups);
00305                 const string * descGroups=_family->getGroupsNames();
00306                 for (int i=0;i<nbGroups;i++)
00307                 {
00308                         myseq[i]=CORBA::string_dup(descGroups[i].c_str());
00309                 }
00310         }
00311         catch (MEDEXCEPTION &ex)
00312         {
00313                 MESSAGE("Unable to acces attributs descriptions");
00314                 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
00315         }
00316         return myseq._retn();
00317 
00318 }
00319 //=============================================================================
00323 //=============================================================================
00324 char *  FAMILY_i::getGroupName( CORBA::Long i)
00325 throw (SALOME::SALOME_Exception)
00326 {
00327         if (_family==NULL)
00328                 THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
00329                                              SALOME::INTERNAL_ERROR);
00330         try
00331         {
00332                 return CORBA::string_dup(_family->getGroupName(i).c_str());
00333         }
00334         catch (MEDEXCEPTION &ex)
00335         {
00336                 MESSAGE("Unable to acces specified attribut description");
00337                 THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
00338         }
00339 }
00340