Salome HOME
ADD a end user module (services.py) to help the manipulation of SALOME KERNEL service...
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttributeSequenceOfReal.cxx
index 9697594f8c49e0c9314d6febace9fd4becec004f..c9a7e3f0ce68d87985e48be589b584c1203d10c9 100644 (file)
@@ -1,35 +1,34 @@
-// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// 
+//
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either 
+// License as published by the Free Software Foundation; either
 // version 2.1 of the License.
-// 
-// This library is distributed in the hope that it will be useful 
-// but WITHOUT ANY WARRANTY; without even the implied warranty of 
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 // Lesser General Public License for more details.
 //
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  File   : SALOMEDS_AttributeSequenceOfReal.cxx
 //  Author : Sergey RUIN
 //  Module : SALOME
-
+//
 #include "SALOMEDS_AttributeSequenceOfReal.hxx"
 #include "SALOMEDS.hxx"
 
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfReal.hxx>
-
 SALOMEDS_AttributeSequenceOfReal::SALOMEDS_AttributeSequenceOfReal
-                  (const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr)
+                  (SALOMEDSImpl_AttributeSequenceOfReal* theAttr)
 :SALOMEDS_GenericAttribute(theAttr)
 {}
 
@@ -47,9 +46,7 @@ void SALOMEDS_AttributeSequenceOfReal::Assign(const std::vector<double>& other)
   if (_isLocal) {
     CheckLocked();
     SALOMEDS::Locker lock; 
-    Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal;
-    for (i = 0; i < aLength; i++) aSeq->Append(other[i]);
-    Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Assign(aSeq);
+    dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl)->Assign(other);
   }
   else {
     SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq();
@@ -65,8 +62,8 @@ std::vector<double> SALOMEDS_AttributeSequenceOfReal::CorbaSequence()
   int i, aLength;
   if (_isLocal) {
     SALOMEDS::Locker lock; 
-    Handle(SALOMEDSImpl_AttributeSequenceOfReal) aSeqAttr;
-    aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl);
+    SALOMEDSImpl_AttributeSequenceOfReal* aSeqAttr = NULL;
+    aSeqAttr = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl);
     aLength = aSeqAttr->Length();
     for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
   }
@@ -83,7 +80,7 @@ void SALOMEDS_AttributeSequenceOfReal::Add(double value)
   if (_isLocal) {
     CheckLocked();
     SALOMEDS::Locker lock; 
-    Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Add(value);
+    dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl)->Add(value);
   }
   else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Add(value);
 }
@@ -93,7 +90,7 @@ void SALOMEDS_AttributeSequenceOfReal::Remove(int index)
   if (_isLocal) {
     CheckLocked();
     SALOMEDS::Locker lock; 
-    Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Remove(index);
+    dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl)->Remove(index);
   }
   else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Remove(index);
 }
@@ -103,7 +100,7 @@ void SALOMEDS_AttributeSequenceOfReal::ChangeValue(int index, double value)
   if (_isLocal) {
     CheckLocked();
     SALOMEDS::Locker lock; 
-    Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->ChangeValue(index, value);
+    dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl)->ChangeValue(index, value);
   }
   else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->ChangeValue(index, value);
 }
@@ -113,7 +110,7 @@ double SALOMEDS_AttributeSequenceOfReal::Value(int index)
   double aValue;
   if (_isLocal) {
     SALOMEDS::Locker lock; 
-    aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Value(index);
+    aValue = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl)->Value(index);
   }
   else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Value(index);
   return aValue;
@@ -124,7 +121,7 @@ int SALOMEDS_AttributeSequenceOfReal::Length()
   int aValue;
   if (_isLocal) {
     SALOMEDS::Locker lock; 
-    aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)-> Length();
+    aValue = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl)-> Length();
   }
   else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)-> Length();
   return aValue;