1 // File : SALOMEDS_AttributeSequenceOfInteger.cxx
2 // Author : Sergey RUIN
5 #include "SALOMEDS_AttributeSequenceOfInteger.hxx"
7 #include <TCollection_AsciiString.hxx>
8 #include <TCollection_ExtendedString.hxx>
9 #include <TColStd_HSequenceOfInteger.hxx>
11 SALOMEDS_AttributeSequenceOfInteger
12 ::SALOMEDS_AttributeSequenceOfInteger(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr)
13 :SALOMEDS_GenericAttribute(theAttr)
16 SALOMEDS_AttributeSequenceOfInteger::SALOMEDS_AttributeSequenceOfInteger(SALOMEDS::AttributeSequenceOfInteger_ptr theAttr)
17 :SALOMEDS_GenericAttribute(theAttr)
20 SALOMEDS_AttributeSequenceOfInteger::~SALOMEDS_AttributeSequenceOfInteger()
23 void SALOMEDS_AttributeSequenceOfInteger::Assign(const std::vector<int>& other)
25 int i, aLength = other.size();
27 Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
28 for(i = 0; i < aLength; i++) aSeq->Append(other[i]);
29 Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Assign(aSeq);
32 SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq();
33 aSeq->length(aLength);
34 for(i = 0; i < aLength; i++) aSeq[i] = other[i];
35 SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Assign(aSeq);
39 std::vector<int> SALOMEDS_AttributeSequenceOfInteger::CorbaSequence()
41 std::vector<int> aVector;
44 Handle(SALOMEDSImpl_AttributeSequenceOfInteger) aSeqAttr;
45 aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl);
46 aLength = aSeqAttr->Length();
47 for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
50 SALOMEDS::AttributeSequenceOfInteger_var aSeqAttr = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl);
51 aLength = aSeqAttr->Length();
52 for(i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
57 void SALOMEDS_AttributeSequenceOfInteger::Add(int value)
59 if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Add(value);
60 else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Add(value);
63 void SALOMEDS_AttributeSequenceOfInteger::Remove(int index)
65 if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Remove(index);
66 else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Remove(index);
69 void SALOMEDS_AttributeSequenceOfInteger::ChangeValue(int index, int value)
71 if(_isLocal) Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->ChangeValue(index, value);
72 else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->ChangeValue(index, value);
75 int SALOMEDS_AttributeSequenceOfInteger::Value(int index)
78 if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Value(index);
79 else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Value(index);
83 int SALOMEDS_AttributeSequenceOfInteger::Length()
86 if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)-> Length();
87 else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)-> Length();