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