Salome HOME
Update version to 3.2.0a1
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttributePythonObject_i.cxx
index c3be0fedce7ea9c47d1c4a42e0b5ab81fb247417..7021d94ead8dde3f7c5996a361173eeaa77297d0 100644 (file)
@@ -1,46 +1,54 @@
-//  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
-//
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
+// Copyright (C) 2005  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 
+// 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 
+// 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 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+// See http://www.salome-platform.org/
 //
 //  File   : SALOMEDS_AttributePythonObject_i.cxx
-//  Author : Michael Ponikarov
+//  Author : Sergey RUIN
 //  Module : SALOME
-//  $Header$
+
 
 #include "SALOMEDS_AttributePythonObject_i.hxx"
+#include "SALOMEDS.hxx"
 #include <TCollection_ExtendedString.hxx>
 #include <TColStd_HArray1OfCharacter.hxx>
-#include "SALOMEDS_SObject_i.hxx"
+
 using namespace std;
 
-void SALOMEDS_AttributePythonObject_i::SetObject(const char* theSequence, CORBA::Boolean IsScript) {
+void SALOMEDS_AttributePythonObject_i::SetObject(const char* theSequence, CORBA::Boolean IsScript) 
+{
+  SALOMEDS::Locker lock;
   CheckLocked();
   char *aSeq = CORBA::string_dup(theSequence);
-  Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->SetObject(aSeq, IsScript);
+  Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->SetObject(aSeq, IsScript);
 }
 
-char* SALOMEDS_AttributePythonObject_i::GetObject() {
-  char* aSeq = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->GetObject();
+char* SALOMEDS_AttributePythonObject_i::GetObject() 
+{
+  SALOMEDS::Locker lock;
+  char* aSeq = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->GetObject().ToCString();
   CORBA::String_var aStr = CORBA::string_dup(aSeq);
   return aStr._retn();
 }
 
-CORBA::Boolean SALOMEDS_AttributePythonObject_i::IsScript() {
-  return Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->IsScript();
+CORBA::Boolean SALOMEDS_AttributePythonObject_i::IsScript() 
+{
+  SALOMEDS::Locker lock;
+  return Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->IsScript();
 }
 
-char* SALOMEDS_AttributePythonObject_i::Store() {
-  CORBA::String_var aString = GetObject();
-  char* aResult = new char[strlen(aString) + 2];
-  aResult[0] = IsScript()?'s':'n';
-  strcpy(aResult+1, aString);
-  return aResult;
-}
 
-void SALOMEDS_AttributePythonObject_i::Restore(const char* value) {
-  char* aString = CORBA::string_dup(value);
-  SetObject(aString + 1, aString[0]=='s');
-  delete(aString);
-}