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.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : SALOMEDS_SequenceOfIntegerAttribute.cxx
25 // Author : Yves FRICAUD
29 #include "SALOMEDS_SequenceOfIntegerAttribute.ixx"
32 //=======================================================================
35 //=======================================================================
37 const Standard_GUID& SALOMEDS_SequenceOfIntegerAttribute::GetID ()
39 static Standard_GUID SALOMEDS_SequenceOfIntegerAttributeID ("12837182-8F52-11d6-A8A3-0001021E8C7F");
40 return SALOMEDS_SequenceOfIntegerAttributeID;
45 //=======================================================================
48 //=======================================================================
50 Handle(SALOMEDS_SequenceOfIntegerAttribute) SALOMEDS_SequenceOfIntegerAttribute::Set (const TDF_Label& L)
52 Handle(SALOMEDS_SequenceOfIntegerAttribute) A;
53 if (!L.FindAttribute(SALOMEDS_SequenceOfIntegerAttribute::GetID(),A)) {
54 A = new SALOMEDS_SequenceOfIntegerAttribute();
61 //=======================================================================
62 //function : constructor
64 //=======================================================================
65 SALOMEDS_SequenceOfIntegerAttribute::SALOMEDS_SequenceOfIntegerAttribute()
66 {myValue = new TColStd_HSequenceOfInteger();}
68 //=======================================================================
71 //=======================================================================
73 const Standard_GUID& SALOMEDS_SequenceOfIntegerAttribute::ID () const { return GetID(); }
76 //=======================================================================
79 //=======================================================================
81 Handle(TDF_Attribute) SALOMEDS_SequenceOfIntegerAttribute::NewEmpty () const
83 return new SALOMEDS_SequenceOfIntegerAttribute();
86 //=======================================================================
89 //=======================================================================
91 void SALOMEDS_SequenceOfIntegerAttribute::Restore(const Handle(TDF_Attribute)& with)
94 Handle(SALOMEDS_SequenceOfIntegerAttribute) anSeq = Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(with);
95 if(!anSeq->myValue.IsNull()) {
96 myValue = new TColStd_HSequenceOfInteger();
97 Standard_Integer Len = anSeq->Length();
98 for(i = 1; i<=Len; i++) Add(anSeq->Value(i));
105 //=======================================================================
108 //=======================================================================
110 void SALOMEDS_SequenceOfIntegerAttribute::Paste (const Handle(TDF_Attribute)& into,
111 const Handle(TDF_RelocationTable)& ) const
113 if(!myValue.IsNull()) {
114 Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast (into)->Assign(myValue);
118 void SALOMEDS_SequenceOfIntegerAttribute::Assign(const Handle(TColStd_HSequenceOfInteger)& other)
121 if (myValue.IsNull()) myValue = new TColStd_HSequenceOfInteger;
122 myValue->ChangeSequence() = other->Sequence();
125 void SALOMEDS_SequenceOfIntegerAttribute::ChangeValue(const Standard_Integer Index,const Standard_Integer Value)
128 myValue->SetValue(Index, Value);
131 void SALOMEDS_SequenceOfIntegerAttribute::Add(const Standard_Integer Value)
134 myValue->Append(Value);
137 void SALOMEDS_SequenceOfIntegerAttribute::Remove(const Standard_Integer Index)
140 myValue->Remove(Index);
143 Standard_Integer SALOMEDS_SequenceOfIntegerAttribute::Length()
145 return myValue->Length();
147 Standard_Integer SALOMEDS_SequenceOfIntegerAttribute::Value(const Standard_Integer Index)
149 return myValue->Value(Index);