Salome HOME
NRI : Remove dependence with VISU.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttReal_i.cxx
1 using namespace std;
2 //  File      : SALOMEDS_AttReal_i.cxx
3 //  Created   : Mon Jun 10 10:54:58 CEST 2002 
4 //  Author    : Estelle Deville
5
6 //  Project   : SALOME
7 //  Module    : SALOMEDS
8 //  Copyright : CEA 2002
9 //  $Header$
10
11
12
13 #include "SALOMEDS_AttReal_i.hxx"
14 #include "utilities.h"
15 #include <TDF_Tool.hxx>
16 #include <stdio.h>
17 #include <cstring>
18
19 //============================================================================
20 /*! Function : Set
21  *  Purpose  : Affect a value to the basic attribute
22  */
23 //============================================================================
24 void SALOMEDS_AttReal_i::Set(CORBA::Double r)
25 {
26   CheckLocked();
27   TDataStd_Real::Set (_Lab,r);
28 }
29
30 //============================================================================
31 /*! Function : Get
32  *  Purpose  : Get basic attribute's value
33  */
34 //============================================================================
35 CORBA::Double SALOMEDS_AttReal_i::Get()
36 {
37   Handle(TDataStd_Real) Att;
38   CORBA::Double x;
39   if (_Lab.FindAttribute(TDataStd_Real::GetID(),Att))
40     x = Att->Get ();
41   return x;
42 }
43
44 //============================================================================
45 /*! Function : Save
46  *  Purpose  : 
47  */
48 //============================================================================
49 char* SALOMEDS_AttReal_i::Save()
50 {
51   BEGIN_OF("SALOMEDS_AttReal_i::Save");
52   CORBA::Double x = this->Get();
53   char* out= new char[12];
54   sprintf(out,"%g",x);
55   return out; 
56 }
57
58 //============================================================================
59 /*! Function : Load
60  *  Purpose  : 
61  */
62 //============================================================================
63 void SALOMEDS_AttReal_i::Load()
64 {
65   BEGIN_OF("SALOMEDS_AttReal_i::Load");
66 }
67
68 //============================================================================
69 /*! Function : GetPtr
70  *  Purpose  : return sobject associated to the basic attribute (if exist)
71  */
72 //============================================================================
73 CORBA::Boolean SALOMEDS_AttReal_i::GetPtr(SALOMEDS::SObject_ptr anObject)
74 {
75   Handle(TDataStd_Real) Att;
76   return _Lab.FindAttribute(TDataStd_Real::GetID(),Att);
77 }
78
79 //============================================================================
80 /*! Function : GetType
81  *  Purpose  : 
82  */
83 //============================================================================
84 char* SALOMEDS_AttReal_i::GetType()
85 {
86   return CORBA::string_dup(_type);
87 }