2 // File : SALOMEDS_SequenceOfRealAttribute.cxx
3 // Created : Wed Nov 28 16:09:35 2001
4 // Author : Yves FRICAUD
7 // Copyright : Open CASCADE 2001
10 #include "SALOMEDS_SequenceOfRealAttribute.ixx"
11 #include <TDataStd_Real.hxx>
13 //=======================================================================
16 //=======================================================================
18 const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::GetID ()
20 static Standard_GUID SALOMEDS_SequenceOfRealAttributeID ("12837183-8F52-11d6-A8A3-0001021E8C7F");
21 return SALOMEDS_SequenceOfRealAttributeID;
26 //=======================================================================
29 //=======================================================================
31 Handle(SALOMEDS_SequenceOfRealAttribute) SALOMEDS_SequenceOfRealAttribute::Set (const TDF_Label& L)
33 Handle(SALOMEDS_SequenceOfRealAttribute) A;
34 if (!L.FindAttribute(SALOMEDS_SequenceOfRealAttribute::GetID(),A)) {
35 A = new SALOMEDS_SequenceOfRealAttribute();
42 //=======================================================================
43 //function : constructor
45 //=======================================================================
46 SALOMEDS_SequenceOfRealAttribute::SALOMEDS_SequenceOfRealAttribute()
47 {myValue = new TColStd_HSequenceOfReal();}
49 //=======================================================================
52 //=======================================================================
54 const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::ID () const { return GetID(); }
57 //=======================================================================
60 //=======================================================================
62 Handle(TDF_Attribute) SALOMEDS_SequenceOfRealAttribute::NewEmpty () const
64 return new SALOMEDS_SequenceOfRealAttribute();
67 //=======================================================================
70 //=======================================================================
72 void SALOMEDS_SequenceOfRealAttribute::Restore(const Handle(TDF_Attribute)& with)
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));
86 //=======================================================================
89 //=======================================================================
91 void SALOMEDS_SequenceOfRealAttribute::Paste (const Handle(TDF_Attribute)& into,
92 const Handle(TDF_RelocationTable)& ) const
94 if(!myValue.IsNull()) {
95 Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast (into)->Assign(myValue);
99 void SALOMEDS_SequenceOfRealAttribute::Assign(const Handle(TColStd_HSequenceOfReal)& other)
102 if (myValue.IsNull()) myValue = new TColStd_HSequenceOfReal;
103 myValue->ChangeSequence() = other->Sequence();
106 void SALOMEDS_SequenceOfRealAttribute::ChangeValue(const Standard_Integer Index,const Standard_Real Value)
109 myValue->SetValue(Index, Value);
112 void SALOMEDS_SequenceOfRealAttribute::Add(const Standard_Real Value)
115 myValue->Append(Value);
118 void SALOMEDS_SequenceOfRealAttribute::Remove(const Standard_Integer Index)
121 myValue->Remove(Index);
124 Standard_Integer SALOMEDS_SequenceOfRealAttribute::Length()
126 return myValue->Length();
129 Standard_Real SALOMEDS_SequenceOfRealAttribute::Value(const Standard_Integer Index)
131 return myValue->Value(Index);