Salome HOME
Initialisation de la base KERNEL avec la version operationnelle de KERNEL_SRC issue...
[modules/yacs.git] / src / SALOMEDS / SALOMEDS_SequenceOfRealAttribute.cxx
1 using namespace std;
2 //  File      : SALOMEDS_SequenceOfRealAttribute.cxx
3 //  Created   : Wed Nov 28 16:09:35 2001
4 //  Author    : Yves FRICAUD
5 //  Project   : SALOME
6 //  Module    : SALOMEDS
7 //  Copyright : Open CASCADE 2001
8 //  $Header: 
9
10 #include "SALOMEDS_SequenceOfRealAttribute.ixx"
11 #include <TDataStd_Real.hxx>
12
13 //=======================================================================
14 //function : GetID
15 //purpose  : 
16 //=======================================================================
17
18 const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::GetID () 
19 {
20   static Standard_GUID SALOMEDS_SequenceOfRealAttributeID ("12837183-8F52-11d6-A8A3-0001021E8C7F");
21   return SALOMEDS_SequenceOfRealAttributeID;
22 }
23
24
25
26 //=======================================================================
27 //function : Set
28 //purpose  : 
29 //=======================================================================
30
31 Handle(SALOMEDS_SequenceOfRealAttribute) SALOMEDS_SequenceOfRealAttribute::Set (const TDF_Label& L) 
32 {
33   Handle(SALOMEDS_SequenceOfRealAttribute) A;
34   if (!L.FindAttribute(SALOMEDS_SequenceOfRealAttribute::GetID(),A)) {
35     A = new  SALOMEDS_SequenceOfRealAttribute(); 
36     L.AddAttribute(A);
37   }
38   return A;
39 }
40
41
42 //=======================================================================
43 //function : constructor
44 //purpose  : 
45 //=======================================================================
46 SALOMEDS_SequenceOfRealAttribute::SALOMEDS_SequenceOfRealAttribute()
47 {myValue = new TColStd_HSequenceOfReal();}
48
49 //=======================================================================
50 //function : ID
51 //purpose  : 
52 //=======================================================================
53
54 const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::ID () const { return GetID(); }
55
56
57 //=======================================================================
58 //function : NewEmpty
59 //purpose  : 
60 //=======================================================================
61
62 Handle(TDF_Attribute) SALOMEDS_SequenceOfRealAttribute::NewEmpty () const
63 {  
64   return new SALOMEDS_SequenceOfRealAttribute(); 
65 }
66
67 //=======================================================================
68 //function : Restore
69 //purpose  : 
70 //=======================================================================
71
72 void SALOMEDS_SequenceOfRealAttribute::Restore(const Handle(TDF_Attribute)& with) 
73 {
74   Standard_Integer i;
75   Handle(SALOMEDS_SequenceOfRealAttribute) anSeq = Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(with);
76   if(!anSeq->myValue.IsNull()) {
77     myValue = new TColStd_HSequenceOfReal();
78     Standard_Integer Len = anSeq->Length();
79     for(i = 1; i<=Len; i++) Add(anSeq->Value(i)); 
80   }
81   else
82     myValue.Nullify();
83   return;
84 }
85
86 //=======================================================================
87 //function : Paste
88 //purpose  : 
89 //=======================================================================
90
91 void SALOMEDS_SequenceOfRealAttribute::Paste (const Handle(TDF_Attribute)& into,
92                                     const Handle(TDF_RelocationTable)& ) const
93 {
94   if(!myValue.IsNull()) {
95     Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast (into)->Assign(myValue);
96   }
97 }
98
99 void SALOMEDS_SequenceOfRealAttribute::Assign(const Handle(TColStd_HSequenceOfReal)& other) 
100 {
101   Backup();
102   if (myValue.IsNull()) myValue = new TColStd_HSequenceOfReal;
103   myValue->ChangeSequence() = other->Sequence();
104 }
105
106 void SALOMEDS_SequenceOfRealAttribute::ChangeValue(const Standard_Integer Index,const Standard_Real Value) 
107 {
108   Backup();
109   myValue->SetValue(Index, Value);
110 }
111
112 void SALOMEDS_SequenceOfRealAttribute::Add(const Standard_Real Value) 
113 {
114   Backup();
115   myValue->Append(Value);
116 }
117
118 void SALOMEDS_SequenceOfRealAttribute::Remove(const Standard_Integer Index) 
119 {
120   Backup();
121   myValue->Remove(Index);
122 }
123
124 Standard_Integer SALOMEDS_SequenceOfRealAttribute::Length() 
125 {
126   return myValue->Length();
127 }
128
129 Standard_Real SALOMEDS_SequenceOfRealAttribute::Value(const Standard_Integer Index) 
130 {
131   return myValue->Value(Index);
132 }
133