1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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
22 // File : SALOMEDS_AttributeSequenceOfInteger.cxx
23 // Author : Sergey RUIN
26 #include "SALOMEDS_AttributeSequenceOfInteger.hxx"
27 #include "SALOMEDS.hxx"
29 SALOMEDS_AttributeSequenceOfInteger::SALOMEDS_AttributeSequenceOfInteger
30 (SALOMEDSImpl_AttributeSequenceOfInteger* theAttr)
31 :SALOMEDS_GenericAttribute(theAttr)
34 SALOMEDS_AttributeSequenceOfInteger::SALOMEDS_AttributeSequenceOfInteger
35 (SALOMEDS::AttributeSequenceOfInteger_ptr theAttr)
36 :SALOMEDS_GenericAttribute(theAttr)
39 SALOMEDS_AttributeSequenceOfInteger::~SALOMEDS_AttributeSequenceOfInteger()
42 void SALOMEDS_AttributeSequenceOfInteger::Assign(const std::vector<int>& other)
44 int i, aLength = other.size();
47 SALOMEDS::Locker lock;
48 dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->Assign(other);
51 SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq();
52 aSeq->length(aLength);
53 for (i = 0; i < aLength; i++) aSeq[i] = other[i];
54 SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Assign(aSeq);
58 std::vector<int> SALOMEDS_AttributeSequenceOfInteger::CorbaSequence()
60 std::vector<int> aVector;
63 SALOMEDS::Locker lock;
64 SALOMEDSImpl_AttributeSequenceOfInteger* aSeqAttr;
65 aSeqAttr = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl);
66 aLength = aSeqAttr->Length();
67 for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
70 SALOMEDS::AttributeSequenceOfInteger_var aSeqAttr =
71 SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl);
72 aLength = aSeqAttr->Length();
73 for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
78 void SALOMEDS_AttributeSequenceOfInteger::Add(int value)
82 SALOMEDS::Locker lock;
83 dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->Add(value);
85 else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Add(value);
88 void SALOMEDS_AttributeSequenceOfInteger::Remove(int index)
92 SALOMEDS::Locker lock;
93 dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->Remove(index);
95 else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Remove(index);
98 void SALOMEDS_AttributeSequenceOfInteger::ChangeValue(int index, int value)
102 SALOMEDS::Locker lock;
103 dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->ChangeValue(index, value);
105 else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->ChangeValue(index, value);
108 int SALOMEDS_AttributeSequenceOfInteger::Value(int index)
112 SALOMEDS::Locker lock;
113 aValue = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->Value(index);
115 else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Value(index);
119 int SALOMEDS_AttributeSequenceOfInteger::Length()
123 SALOMEDS::Locker lock;
124 aValue = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)-> Length();
126 else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)-> Length();