2 // File : SALOMEDS_SequenceOfIntegerAttribute.cxx
3 // Created : Wed Nov 28 16:09:35 2001
4 // Author : Yves FRICAUD
7 // Copyright : Open CASCADE 2001
10 #include "SALOMEDS_SequenceOfIntegerAttribute.ixx"
12 //=======================================================================
15 //=======================================================================
17 const Standard_GUID& SALOMEDS_SequenceOfIntegerAttribute::GetID ()
19 static Standard_GUID SALOMEDS_SequenceOfIntegerAttributeID ("12837182-8F52-11d6-A8A3-0001021E8C7F");
20 return SALOMEDS_SequenceOfIntegerAttributeID;
25 //=======================================================================
28 //=======================================================================
30 Handle(SALOMEDS_SequenceOfIntegerAttribute) SALOMEDS_SequenceOfIntegerAttribute::Set (const TDF_Label& L)
32 Handle(SALOMEDS_SequenceOfIntegerAttribute) A;
33 if (!L.FindAttribute(SALOMEDS_SequenceOfIntegerAttribute::GetID(),A)) {
34 A = new SALOMEDS_SequenceOfIntegerAttribute();
41 //=======================================================================
42 //function : constructor
44 //=======================================================================
45 SALOMEDS_SequenceOfIntegerAttribute::SALOMEDS_SequenceOfIntegerAttribute()
46 {myValue = new TColStd_HSequenceOfInteger();}
48 //=======================================================================
51 //=======================================================================
53 const Standard_GUID& SALOMEDS_SequenceOfIntegerAttribute::ID () const { return GetID(); }
56 //=======================================================================
59 //=======================================================================
61 Handle(TDF_Attribute) SALOMEDS_SequenceOfIntegerAttribute::NewEmpty () const
63 return new SALOMEDS_SequenceOfIntegerAttribute();
66 //=======================================================================
69 //=======================================================================
71 void SALOMEDS_SequenceOfIntegerAttribute::Restore(const Handle(TDF_Attribute)& with)
74 Handle(SALOMEDS_SequenceOfIntegerAttribute) anSeq = Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(with);
75 if(!anSeq->myValue.IsNull()) {
76 myValue = new TColStd_HSequenceOfInteger();
77 Standard_Integer Len = anSeq->Length();
78 for(i = 1; i<=Len; i++) Add(anSeq->Value(i));
85 //=======================================================================
88 //=======================================================================
90 void SALOMEDS_SequenceOfIntegerAttribute::Paste (const Handle(TDF_Attribute)& into,
91 const Handle(TDF_RelocationTable)& ) const
93 if(!myValue.IsNull()) {
94 Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast (into)->Assign(myValue);
98 void SALOMEDS_SequenceOfIntegerAttribute::Assign(const Handle(TColStd_HSequenceOfInteger)& other)
101 if (myValue.IsNull()) myValue = new TColStd_HSequenceOfInteger;
102 myValue->ChangeSequence() = other->Sequence();
105 void SALOMEDS_SequenceOfIntegerAttribute::ChangeValue(const Standard_Integer Index,const Standard_Integer Value)
108 myValue->SetValue(Index, Value);
111 void SALOMEDS_SequenceOfIntegerAttribute::Add(const Standard_Integer Value)
114 myValue->Append(Value);
117 void SALOMEDS_SequenceOfIntegerAttribute::Remove(const Standard_Integer Index)
120 myValue->Remove(Index);
123 Standard_Integer SALOMEDS_SequenceOfIntegerAttribute::Length()
125 return myValue->Length();
127 Standard_Integer SALOMEDS_SequenceOfIntegerAttribute::Value(const Standard_Integer Index)
129 return myValue->Value(Index);