Salome HOME
CCAR: remove some memory leaks in non local SALOMEDS
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttReal_i.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
23 //  File   : SALOMEDS_AttReal_i.cxx
24 //  Author : Estelle Deville
25 //  Module : SALOME
26 //  $Header$
27 //
28 #include "SALOMEDS_AttReal_i.hxx"
29 #include "utilities.h"
30 #include <stdio.h>
31 #include <cstring>
32 #include <SALOMEDSImpl_AttributeReal.hxx>
33 using namespace std;
34
35 //============================================================================
36 /*! Function : Set
37  *  Purpose  : Affect a value to the basic attribute
38  */
39 //============================================================================
40 void SALOMEDS_AttReal_i::Set(CORBA::Double r)
41 {
42   CheckLocked();
43   SALOMEDSImpl_AttributeReal::Set (_Lab,r);
44 }
45
46 //============================================================================
47 /*! Function : Get
48  *  Purpose  : Get basic attribute's value
49  */
50 //============================================================================
51 CORBA::Double SALOMEDS_AttReal_i::Get()
52 {
53   SALOMEDSImpl_AttributeReal* Att;
54   CORBA::Double x;
55   if ((Att=(SALOMEDSImpl_AttributeReal*)_Lab.FindAttribute(TDataStd_Real::GetID())))
56     x = Att->Get ();
57   return x;
58 }
59
60 //============================================================================
61 /*! Function : Save
62  *  Purpose  : 
63  */
64 //============================================================================
65 char* SALOMEDS_AttReal_i::Save()
66 {
67   BEGIN_OF("SALOMEDS_AttReal_i::Save");
68   CORBA::Double x = this->Get();
69   char* out= new char[12];
70   sprintf(out,"%g",x);
71   return out; 
72 }
73
74 //============================================================================
75 /*! Function : Load
76  *  Purpose  : 
77  */
78 //============================================================================
79 void SALOMEDS_AttReal_i::Load()
80 {
81   BEGIN_OF("SALOMEDS_AttReal_i::Load");
82 }
83
84 //============================================================================
85 /*! Function : GetPtr
86  *  Purpose  : return sobject associated to the basic attribute (if exist)
87  */
88 //============================================================================
89 CORBA::Boolean SALOMEDS_AttReal_i::GetPtr(SALOMEDS::SObject_ptr anObject)
90 {
91   return _Lab.IsAttribute(SALOMEDSImpl_AttributeReal::GetID());
92 }
93
94 //============================================================================
95 /*! Function : GetType
96  *  Purpose  : 
97  */
98 //============================================================================
99 char* SALOMEDS_AttReal_i::GetType()
100 {
101   return CORBA::string_dup(_type);
102 }