1 // SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOMEDS_SequenceOfRealAttribute.cxx
25 // Author : Yves FRICAUD
29 #include "SALOMEDS_SequenceOfRealAttribute.ixx"
30 #include <TDataStd_Real.hxx>
33 //=======================================================================
36 //=======================================================================
38 const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::GetID ()
40 static Standard_GUID SALOMEDS_SequenceOfRealAttributeID ("12837183-8F52-11d6-A8A3-0001021E8C7F");
41 return SALOMEDS_SequenceOfRealAttributeID;
46 //=======================================================================
49 //=======================================================================
51 Handle(SALOMEDS_SequenceOfRealAttribute) SALOMEDS_SequenceOfRealAttribute::Set (const TDF_Label& L)
53 Handle(SALOMEDS_SequenceOfRealAttribute) A;
54 if (!L.FindAttribute(SALOMEDS_SequenceOfRealAttribute::GetID(),A)) {
55 A = new SALOMEDS_SequenceOfRealAttribute();
62 //=======================================================================
63 //function : constructor
65 //=======================================================================
66 SALOMEDS_SequenceOfRealAttribute::SALOMEDS_SequenceOfRealAttribute()
67 {myValue = new TColStd_HSequenceOfReal();}
69 //=======================================================================
72 //=======================================================================
74 const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::ID () const { return GetID(); }
77 //=======================================================================
80 //=======================================================================
82 Handle(TDF_Attribute) SALOMEDS_SequenceOfRealAttribute::NewEmpty () const
84 return new SALOMEDS_SequenceOfRealAttribute();
87 //=======================================================================
90 //=======================================================================
92 void SALOMEDS_SequenceOfRealAttribute::Restore(const Handle(TDF_Attribute)& with)
95 Handle(SALOMEDS_SequenceOfRealAttribute) anSeq = Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(with);
96 if(!anSeq->myValue.IsNull()) {
97 myValue = new TColStd_HSequenceOfReal();
98 Standard_Integer Len = anSeq->Length();
99 for(i = 1; i<=Len; i++) Add(anSeq->Value(i));
106 //=======================================================================
109 //=======================================================================
111 void SALOMEDS_SequenceOfRealAttribute::Paste (const Handle(TDF_Attribute)& into,
112 const Handle(TDF_RelocationTable)& ) const
114 if(!myValue.IsNull()) {
115 Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast (into)->Assign(myValue);
119 void SALOMEDS_SequenceOfRealAttribute::Assign(const Handle(TColStd_HSequenceOfReal)& other)
122 if (myValue.IsNull()) myValue = new TColStd_HSequenceOfReal;
123 myValue->ChangeSequence() = other->Sequence();
126 void SALOMEDS_SequenceOfRealAttribute::ChangeValue(const Standard_Integer Index,const Standard_Real Value)
129 myValue->SetValue(Index, Value);
132 void SALOMEDS_SequenceOfRealAttribute::Add(const Standard_Real Value)
135 myValue->Append(Value);
138 void SALOMEDS_SequenceOfRealAttribute::Remove(const Standard_Integer Index)
141 myValue->Remove(Index);
144 Standard_Integer SALOMEDS_SequenceOfRealAttribute::Length()
146 return myValue->Length();
149 Standard_Real SALOMEDS_SequenceOfRealAttribute::Value(const Standard_Integer Index)
151 return myValue->Value(Index);