Salome HOME
7aaeb5337bd07121ee3b838938443dce2a93694d
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttLong_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_AttLong_i.cxx
24 //  Author : Estelle Deville
25 //  Module : SALOME
26 //  $Header$
27 //
28 #include "SALOMEDS_AttLong_i.hxx"
29 #include "utilities.h"
30 #include <stdio.h>
31 #include <SALOMEDSImpl_AttributeInteger.hxx>
32 using namespace std;
33
34 //============================================================================
35 /*! Function : Set
36  *  Purpose  : Affect a value to the basic attribute
37  */
38 //============================================================================
39 void SALOMEDS_AttLong_i::Set(CORBA::Long i)
40 {
41   CheckLocked();
42   SALOMEDSImpl_AttributeInteger::Set (_Lab,i);
43 }
44
45 //============================================================================
46 /*! Function : Get
47  *  Purpose  : Get basic attribute's value
48  */
49 //============================================================================
50 CORBA::Long SALOMEDS_AttLong_i::Get()
51 {
52   SALOMEDSImpl_AttributeInteger* Att = NULL;
53   CORBA::Long x;
54   if ((Att=(SALOMEDSImpl_AttributeInteger*)_Lab.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID())))
55     x = Att->Get ();
56   return x;
57 }
58
59 //============================================================================
60 /*! Function : Save
61  *  Purpose  : 
62  */
63 //============================================================================
64 char* SALOMEDS_AttLong_i::Save()
65 {
66   BEGIN_OF("SALOMEDS_AttLong_i::Save");
67   CORBA::Long x = this->Get();
68   char* out= new char[12];
69   sprintf(out,"%ld",x);
70   return out; 
71 }
72
73 //============================================================================
74 /*! Function : Load
75  *  Purpose  : 
76  */
77 //============================================================================
78 void SALOMEDS_AttLong_i::Load()
79 {
80   BEGIN_OF("SALOMEDS_AttLong_i::Load");
81 }
82
83 //============================================================================
84 /*! Function : GetPtr
85  *  Purpose  : return sobject associated to the basic attribute (if exist)
86  */
87 //============================================================================
88 CORBA::Boolean SALOMEDS_AttLong_i::GetPtr(SALOMEDS::SObject_ptr anObject)
89 {
90   return (_Lab.IsAttribute(SALOMEDSImpl_AttributeInteger::GetID()));
91 }
92
93 //============================================================================
94 /*! Function : GetType
95  *  Purpose  : 
96  */
97 //============================================================================
98 char* SALOMEDS_AttLong_i::GetType()
99 {
100   return CORBA::string_dup(_type);
101 }