1 // Copyright (C) 2007-2023 CEA, EDF, 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, or (at your option) any later version.
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
23 // File : SALOMEDS_AttributeSequenceOfInteger.cxx
24 // Author : Sergey RUIN
27 #include "SALOMEDS_AttributeSequenceOfInteger.hxx"
28 #include "SALOMEDS.hxx"
30 SALOMEDS_AttributeSequenceOfInteger::SALOMEDS_AttributeSequenceOfInteger
31 (SALOMEDSImpl_AttributeSequenceOfInteger* theAttr)
32 :SALOMEDS_GenericAttribute(theAttr)
35 SALOMEDS_AttributeSequenceOfInteger::SALOMEDS_AttributeSequenceOfInteger
36 (SALOMEDS::AttributeSequenceOfInteger_ptr theAttr)
37 :SALOMEDS_GenericAttribute(theAttr)
40 SALOMEDS_AttributeSequenceOfInteger::~SALOMEDS_AttributeSequenceOfInteger()
43 void SALOMEDS_AttributeSequenceOfInteger::Assign(const std::vector<int>& other)
45 int i, aLength = (int)other.size(); //!< TODO: conversion from size_t to int
48 SALOMEDS::Locker lock;
49 dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->Assign(other);
52 SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq();
53 aSeq->length(aLength);
54 for (i = 0; i < aLength; i++) aSeq[i] = other[i];
55 SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Assign(aSeq);
59 std::vector<int> SALOMEDS_AttributeSequenceOfInteger::CorbaSequence()
61 std::vector<int> aVector;
64 SALOMEDS::Locker lock;
65 SALOMEDSImpl_AttributeSequenceOfInteger* aSeqAttr;
66 aSeqAttr = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl);
67 aLength = aSeqAttr->Length();
68 for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
71 SALOMEDS::AttributeSequenceOfInteger_var aSeqAttr =
72 SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl);
73 aLength = aSeqAttr->Length();
74 for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value((CORBA::Short)i)); //!< TODO: conversion from int to CORBA::Short
79 void SALOMEDS_AttributeSequenceOfInteger::Add(int value)
83 SALOMEDS::Locker lock;
84 dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->Add(value);
86 else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Add(value);
89 void SALOMEDS_AttributeSequenceOfInteger::Remove(int index)
93 SALOMEDS::Locker lock;
94 dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->Remove(index);
96 else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Remove(index);
99 void SALOMEDS_AttributeSequenceOfInteger::ChangeValue(int index, int value)
103 SALOMEDS::Locker lock;
104 dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->ChangeValue(index, value);
106 else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->ChangeValue(index, value);
109 int SALOMEDS_AttributeSequenceOfInteger::Value(int index)
113 SALOMEDS::Locker lock;
114 aValue = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->Value(index);
116 else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Value((CORBA::Short)index); //!< TODO: conversion from int to CORBA::Short
120 int SALOMEDS_AttributeSequenceOfInteger::Length()
124 SALOMEDS::Locker lock;
125 aValue = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)-> Length();
127 else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)-> Length();